mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	Bring all app_rpt and chan_usbradio stuff up to date
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@116731 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		| @@ -101,3 +101,9 @@ misdn/isdn_lib.o: ASTCFLAGS+=-Wno-strict-aliasing | ||||
| $(if $(filter chan_misdn,$(EMBEDDED_MODS)),modules.link,chan_misdn.so): misdn_config.o misdn/isdn_lib.o misdn/isdn_msg_parser.o | ||||
|  | ||||
| $(if $(filter chan_oss,$(EMBEDDED_MODS)),modules.link,chan_oss.so): console_video.o vgrabbers.o console_board.o | ||||
|  | ||||
| chan_usbradio.o: ./xpmr/xpmr.c ./xpmr/xpmr.h ./xpmr/xpmr_coef.h | ||||
|  | ||||
| chan_usbradio.so: LIBS+=-lusb -lasound | ||||
|  | ||||
|  | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -4,16 +4,26 @@ | ||||
|  * All Rights Reserved. Copyright (C)2007, Xelatec, LLC | ||||
|  *  | ||||
|  * 20070808 1235 Steven Henke, W9SH, sph@xelatec.com | ||||
|  *  | ||||
|  * 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 | ||||
|  * 		  | ||||
|  * This version may be optionally licenced under the GNU LGPL licence. | ||||
|  * | ||||
|  * 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. | ||||
|  * A license has been granted to Digium (via disclaimer) for the use of | ||||
|  * this code. | ||||
|  * | ||||
|  * 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 | ||||
| @@ -24,11 +34,11 @@ | ||||
|  */ | ||||
|  | ||||
| #ifndef XPMR_SINETABX_H | ||||
| #define XPMR_SINETABX_H 1 | ||||
| #define XPMR_SINETABX_H 	1 | ||||
| 		 | ||||
| #define SAMPLES_PER_SINE 256		 | ||||
| 		 | ||||
| const i16 sinetablex[]={		 | ||||
| static const i16 sinetablex[]={		 | ||||
| 0,			// 0 | ||||
| 804,		// 1 | ||||
| 1608,		// 2 | ||||
|   | ||||
							
								
								
									
										2282
									
								
								channels/xpmr/xpmr.c
									
									
									
									
									
								
							
							
						
						
									
										2282
									
								
								channels/xpmr/xpmr.c
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -5,15 +5,25 @@ | ||||
|  *  | ||||
|  * 20070808 1235 Steven Henke, W9SH, sph@xelatec.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; 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 | ||||
|  * 		  | ||||
|  * 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. | ||||
|  * | ||||
|  * 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 | ||||
| @@ -23,25 +33,73 @@ | ||||
|  * \author Steven Henke, W9SH <sph@xelatec.com> Xelatec, LLC | ||||
|  */ | ||||
|  | ||||
| #ifndef XPMR_H | ||||
| #define XPMR_H			1 | ||||
| #ifndef  XPMR_H | ||||
| #define  XPMR_H				1 | ||||
|  | ||||
| #define  XPMR_DEV   		0 			// when running in test mode | ||||
|  | ||||
| #define  XPMR_TRACE_LEVEL	0 | ||||
|  | ||||
| #ifdef	 RADIO_RTX | ||||
| #define	 DTX_PROG			1			// rf transceiver module | ||||
| #define  XPMR_PPTP			0 			// parallel port test probe | ||||
| #else | ||||
| #define	 DTX_PROG			0 | ||||
| #define  XPMR_PPTP			0 			 | ||||
| #endif | ||||
|  | ||||
| #if (DTX_PROG == 1) || 	XPMR_PPTP == 1 | ||||
| #include <parapindriver.h> | ||||
| #endif | ||||
|  | ||||
| #ifdef	CHAN_USBRADIO | ||||
| #define XPMR_DEBUG0		1 | ||||
| #define XPMR_TRACE		0 | ||||
| #define XPMR_TRACE		1 | ||||
| #define TRACEO(level,a) { if ( o->tracelevel >= level ) {printf a;} } | ||||
| #else | ||||
| #define XPMR_DEBUG0		1 | ||||
| #define XPMR_TRACE		1 | ||||
| #define TRACEO(level,a) | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #define LSD_DFS			5 | ||||
| #define LSD_DFD			1 | ||||
|  | ||||
| #if(XPMR_DEBUG0 == 1) | ||||
| #define XPMR_DEBUG_CHANS	16 | ||||
| #define TSCOPE(a) {strace a;} | ||||
| #else | ||||
| #define XPMR_DEBUG_CHANS	0 | ||||
| #define TSCOPE(a) | ||||
| #endif   | ||||
|  | ||||
| #define	XPMR_TRACE_AMP		8192 | ||||
|  | ||||
| // TRACEM(3,TSYS_LSD,("pmr_lsdctl_exec() RX FRAME UNPROCESSED.\n")); | ||||
| #if(XPMR_TRACE == 1) | ||||
| #define TRACEX(a) {printf a;} | ||||
| #define TRACEXL(a) {printf("%s @ %u : ",__FILE__ ,__LINE__); printf a; } | ||||
| #define TRACEXT(a) { struct timeval hack; gettimeofday(&hack,NULL); printf("%ld.",hack.tv_sec%100000); printf("%i : ",(int)hack.tv_usec); printf a; } | ||||
| #define TRACEXT(a) {struct timeval hack; gettimeofday(&hack,NULL); printf("%ld.",hack.tv_sec%100000); printf("%i : ",(int)hack.tv_usec); printf a; } | ||||
| #define TRACEXR(a) {printf a;} | ||||
| #define TRACEC(level,a) {if(pChan->tracelevel>=level){printf("%08i ",pChan->frameCountRx);printf a;} } | ||||
| #define TRACEF(level,a) {if(pChan->tracelevel>=level){printf a;} } | ||||
| #define TRACEJ(level,a) {if(XPMR_TRACE_LEVEL>=level){printf a;} } | ||||
| #define TRACES(level,a) {if(mySps->parentChan->tracelevel >= level){printf a;} } | ||||
| #define TRACET(level,a) {if(pChan->tracelevel>=level){printf("%08i %02i",pChan->frameCountRx,pChan->rptnum);printf a;} } | ||||
| #define TRACEXR(a) {printf a;} | ||||
| #define TRACEM(level,sys,a) {if(pChan->tracelevel>=level || (pChan->tracesys[sys])){printf a;} } | ||||
| #else						   | ||||
| #define TRACEX(a) | ||||
| #define TRACEXL(a) | ||||
| #define TRACEXT(a) | ||||
| #define TRACEC(level,a) | ||||
| #define TRACEF(level,a) | ||||
| #define TRACEJ(level,a) | ||||
| #define TRACES(level,a) | ||||
| #define TRACET(level,a) | ||||
| #define TRACEXR(a) | ||||
| #define TRACEM(level,sys,a) | ||||
| #endif | ||||
|  | ||||
| #define i8  	int8_t | ||||
| @@ -52,11 +110,18 @@ | ||||
| #define u32 	u_int32_t | ||||
| #define i64 	int64_t | ||||
| #define u64 	u_int64_t | ||||
| 			 | ||||
|  | ||||
| #define M_Q31			0x80000000		// | ||||
| #define M_Q30			0x40000000		// | ||||
| #define M_Q29			0x20000000		// | ||||
| #define M_Q28			0x10000000		// | ||||
| #define M_Q27			0x08000000		// | ||||
| #define M_Q26			0x04000000		// | ||||
| #define M_Q25			0x02000000		//			 | ||||
| #define M_Q24			0x01000000		// | ||||
| #define M_Q23			0x00800000		// | ||||
| #define M_Q22			0x00400000		//					 | ||||
| #define M_Q21			0x00200000		//  		 | ||||
| #define M_Q21			0x00200000		// undsoweiter  		 | ||||
| #define M_Q20			0x00100000		// 1048576 | ||||
| #define M_Q19			0x00080000		// 524288		    | ||||
| #define M_Q18			0x00040000		// 262144 | ||||
| @@ -86,8 +151,11 @@ | ||||
|  | ||||
| #define SAMPLES_PER_BLOCK       160 | ||||
| #define MS_PER_FRAME            20 | ||||
| #define SAMPLES_PER_MS          8 | ||||
|  | ||||
| #define CTCSS_NUM_CODES			38 | ||||
| #define CTCSS_NULL              -1 | ||||
| #define CTCSS_RXONLY            -2 | ||||
| #define CTCSS_NUM_CODES			38 			// 0 - 37 | ||||
| #define CTCSS_SCOUNT_MUL		100 | ||||
| #define CTCSS_INTEGRATE	  		3932       // 32767*.120 // 120/1000  // 0.120 | ||||
| #define CTCSS_INPUT_LIMIT	  	1000 | ||||
| @@ -98,6 +166,61 @@ | ||||
| #define CTCSS_TURN_OFF_SHIFT    240			// degrees | ||||
| #define TOC_NOTONE_TIME			600			// ms | ||||
|  | ||||
| #define	DDB_FRAME_SIZE			160		   	// clock de-drift defaults | ||||
| #define DDB_FRAMES_IN_BUFF		8 | ||||
| #define DDB_ERR_MODULUS 		10000 | ||||
|  | ||||
| #define DCS_TURN_OFF_TIME       180 | ||||
|  | ||||
| #define	NUM_TXLSD_FRAMEBUFFERS	4 | ||||
|  | ||||
| #define CHAN_TXSTATE_IDLE		0 | ||||
| #define CHAN_TXSTATE_ACTIVE		1 | ||||
| #define CHAN_TXSTATE_TOC		2 | ||||
| #define CHAN_TXSTATE_HANGING    3 | ||||
| #define CHAN_TXSTATE_FINISHING  4 | ||||
| #define CHAN_TXSTATE_COMPLETE	5 | ||||
| #define CHAN_TXSTATE_USURPED	9 | ||||
|  | ||||
| #define SMODE_NULL				0 | ||||
| #define SMODE_CARRIER			1 | ||||
| #define SMODE_CTCSS				2 | ||||
| #define SMODE_DCS       		3 | ||||
| #define SMODE_LSD				4 | ||||
| #define SMODE_MPT				5 | ||||
| #define SMODE_DST				6 | ||||
| #define SMODE_P25				7 | ||||
| #define SMODE_MDC				8 | ||||
|  | ||||
|  | ||||
| #define SPS_OPT_START			1 | ||||
| #define SPS_OPT_STOP			2 | ||||
| #define SPS_OPT_TURNOFF         3 | ||||
| #define SPS_OPT_STOPNOW			4 | ||||
|  | ||||
| #define SPS_STAT_STOPPED		0 | ||||
| #define SPS_STAT_STARTING		1 | ||||
| #define SPS_STAT_RUNNING		2 | ||||
| #define SPS_STAT_HALTING		3 | ||||
|  | ||||
|   | ||||
| #define PP_BIT_TEST		6 | ||||
| #define PP_REG_LEN		32 | ||||
| #define PP_BIT_TIME		100000 | ||||
| 					  	 | ||||
| #define DTX_CLK 	LP_PIN02 | ||||
| #define DTX_DATA 	LP_PIN03 | ||||
| #define DTX_ENABLE 	LP_PIN04 | ||||
| #define DTX_TX 	    LP_PIN05		// only used on older mods | ||||
| #define DTX_TXPWR 	LP_PIN06		// not used | ||||
| #define DTX_TP1 	LP_PIN07		// not used | ||||
| #define DTX_TP2 	LP_PIN08		// not used | ||||
|  | ||||
| #define BIN_PROG_0 	LP_PIN06 | ||||
| #define BIN_PROG_1 	LP_PIN07 | ||||
| #define BIN_PROG_2 	LP_PIN08 | ||||
| #define BIN_PROG_3 	LP_PIN09  | ||||
| 		  | ||||
| #ifndef CHAN_USBRADIO   | ||||
| enum {RX_AUDIO_NONE,RX_AUDIO_SPEAKER,RX_AUDIO_FLAT}; | ||||
| enum {TX_AUDIO_NONE,TX_AUDIO_FLAT,TX_AUDIO_FILTERED,TX_AUDIO_PROC}; | ||||
| @@ -108,6 +231,130 @@ enum {TX_OUT_OFF,TX_OUT_VOICE,TX_OUT_LSD,TX_OUT_COMPOSITE,TX_OUT_AUX}; | ||||
| enum {TOC_NONE,TOC_PHASE,TOC_NOTONE}; | ||||
| #endif | ||||
|  | ||||
| enum dbg_pts { | ||||
|   | ||||
| RX_INPUT,	 | ||||
| RX_NOISE_AMP,  | ||||
| RX_NOISE_TRIG, | ||||
|  | ||||
| RX_CTCSS_LPF, | ||||
| RX_CTCSS_CENTER, | ||||
| RX_CTCSS_NRZ, | ||||
| RX_CTCSS_CLK, | ||||
| RX_CTCSS_P0,   | ||||
| RX_CTCSS_P1, | ||||
| RX_CTCSS_ACCUM, | ||||
| RX_CTCSS_DVDT, | ||||
| RX_CTCSS_DECODE, | ||||
|  | ||||
| RX_DCS_CENTER, | ||||
| RX_DCS_DEC, | ||||
| RX_DCS_DIN, | ||||
| RX_DCS_CLK, | ||||
| RX_DCS_DAT, | ||||
|  | ||||
| RX_LSD_LPF, | ||||
| RX_LSD_CLK, | ||||
| RX_LSD_DAT, | ||||
| RX_LSD_DEC, | ||||
|  | ||||
| RX_LSD_CENTER, | ||||
| RX_LSD_SYNC,   | ||||
| RX_LSD_STATE, | ||||
| RX_LSD_ERR, | ||||
| RX_LSD_INTE, | ||||
|  | ||||
| RX_SMODE, | ||||
|  | ||||
| TX_PTT_IN, | ||||
| TX_PTT_OUT, | ||||
|  | ||||
| TX_DEDRIFT_LEAD, | ||||
| TX_DEDRIFT_ERR, | ||||
| TX_DEDRIFT_FACTOR, | ||||
| TX_DEDRIFT_DRIFT, | ||||
| TX_DEDRIFT_TWIDDLE, | ||||
|  | ||||
| TX_CTCSS_GEN, | ||||
|  | ||||
| TX_SIGGEN_0, | ||||
|  | ||||
| TX_DCS_CLK, | ||||
| TX_DCS_DAT, | ||||
| TX_DCS_LPF, | ||||
|  | ||||
| TX_LSD_CLK, | ||||
| TX_LSD_DAT, | ||||
| TX_LSD_GEN,  	 | ||||
| TX_LSD_LPF, | ||||
|  | ||||
| TX_NET_INT, | ||||
| TX_VOX_HPF, | ||||
| TX_VOX_LIM, | ||||
|  | ||||
| TX_VOX_LPF, | ||||
|  | ||||
| TX_OUT_A, | ||||
| TX_OUT_B, | ||||
|  | ||||
| NUM_DEBUG_PTS   | ||||
| }; | ||||
|  | ||||
| typedef struct | ||||
| { | ||||
| 	i16 mode; | ||||
| 	i16	point[NUM_DEBUG_PTS]; | ||||
| 	i16 trace[16]; | ||||
| 	i16 scale[16]; | ||||
| 	i16 offset[16]; | ||||
| 	i16 buffer[16 * SAMPLES_PER_BLOCK];  // allocate for rx and tx | ||||
| 	i16 *source[16]; | ||||
| } t_sdbg; | ||||
|  | ||||
| typedef struct | ||||
| { | ||||
| 	i16 lock; | ||||
| 	i16 option;					// 1 = data in, 0 = data out | ||||
| 	i16 debug; | ||||
| 	i16 debugcnt; | ||||
| 	i32 rxframecnt; | ||||
| 	i32 txframecnt; | ||||
|  | ||||
| 	i32 skew; | ||||
|  | ||||
| 	i16 frames; | ||||
| 	i16 framesize; | ||||
| 	i16 buffersize; | ||||
|  | ||||
| 	i32 timer; | ||||
| 	 | ||||
| 	i32 x0,x1,y0,y1; | ||||
|  | ||||
| 	i16 inputindex; | ||||
| 	i16 outputindex; | ||||
| 	i16 lead; | ||||
| 	i16 err; | ||||
| 	i16 accum; | ||||
|  | ||||
| 	i16 *ptr;					// source or destination | ||||
| 	i16	*buff; | ||||
| 	 | ||||
| 	i16 inputcnt; | ||||
| 	i16 initcnt; | ||||
|  | ||||
| 	i32 factor; | ||||
| 	i32 drift; | ||||
| 	i32 modulus; | ||||
| 	i32	z1; | ||||
| 	struct { | ||||
| 		unsigned rxlock:1; | ||||
| 		unsigned txlock:1; | ||||
| 		unsigned twiddle:1; | ||||
| 		unsigned doitnow:1; | ||||
| 	}b; | ||||
| } | ||||
| t_dedrift; | ||||
|  | ||||
| /* | ||||
| 	one structure for each ctcss tone to decode  | ||||
| */ | ||||
| @@ -121,7 +368,7 @@ typedef struct | ||||
| 	i16 enabled; | ||||
| 	i16 state;				// dead, running, error				  | ||||
| 	i16 zIndex;				// z bucket index | ||||
| 	i16 z[4];	  			// maw sph today | ||||
| 	i16 z[4];	  			  | ||||
| 	i16 zi; | ||||
| 	i16 dvu; | ||||
| 	i16 dvd; | ||||
| @@ -130,78 +377,62 @@ typedef struct | ||||
| 	i16 hyst; | ||||
| 	i16 decode; | ||||
| 	i16 diffpeak; | ||||
| 	i16 debug;				// value held from last pass | ||||
| 	i16 debug;				  | ||||
|  | ||||
| 	#if XPMR_DEBUG0 == 1 | ||||
| 	i16 lasttv0; | ||||
| 	i16 lasttv1; | ||||
| 	i16 lasttv2; | ||||
| 	i16 lasttv3; | ||||
|  | ||||
| 	i16 *pDebug0;			// pointer to debug output | ||||
| 	i16 *pDebug1;			// pointer to debug output | ||||
| 	i16 *pDebug2;			// pointer to debug output | ||||
| 	i16 *pDebug3;			// pointer to debug output | ||||
| 	#endif | ||||
|  | ||||
| } t_tdet; | ||||
|  | ||||
| typedef struct | ||||
| { | ||||
| 	i16 enabled;						// if 0 none, 0xFFFF all tones, or single tone | ||||
| 	i16 *input; | ||||
| 	i16 *input;							// source data | ||||
| 	i16 clamplitude; | ||||
| 	i16 center; | ||||
| 	i16 decode;		  					// current ctcss decode index | ||||
| 	i32 BlankingTimer; | ||||
| 	u32 TurnOffTimer; | ||||
| 	t_tdet tdet[CTCSS_NUM_CODES];	 | ||||
| 	i16 gain; | ||||
| 	i16 limit; | ||||
| 	i16 debugIndex; | ||||
| 	i16 *pDebug0; | ||||
| 	i16 *pDebug1; | ||||
| 	i16 *pDebug2; | ||||
| 	i16 *pDebug3; | ||||
| 	i16 testIndex; | ||||
| 	i16 multiFreq; | ||||
| 	i8 relax; | ||||
| 	t_tdet tdet[CTCSS_NUM_CODES]; | ||||
|  | ||||
| 	i8 		numrxcodes; | ||||
| 	i16 	rxCtcssMap[CTCSS_NUM_CODES]; | ||||
| 	char    *rxctcss[CTCSS_NUM_CODES];		// pointers to each tone in string above | ||||
| 	char    *txctcss[CTCSS_NUM_CODES]; | ||||
|  | ||||
| 	i32		txctcssdefault_index; | ||||
| 	float 	txctcssdefault_value; | ||||
|  | ||||
| 	struct{ | ||||
| 		unsigned valid:1; | ||||
| 	}b; | ||||
| } t_dec_ctcss; | ||||
|  | ||||
| typedef struct | ||||
| { | ||||
| 	i16 enabled;						// if 0 none, 0xFFFF all tones, or single tone | ||||
| 	i16 clamplitude; | ||||
| 	i16 center; | ||||
| 	i16 decode;		  				// current ctcss decode value | ||||
| 	i32 BlankingTimer; | ||||
| 	u32 TurnOffTimer; | ||||
| 	i16 gain; | ||||
| 	i16 limit; | ||||
| 	i16 *pDebug0; | ||||
| 	i16 *pDebug1; | ||||
| 	i16 rxPolarity; | ||||
| } t_dec_dcs; | ||||
|  | ||||
| /* | ||||
| 	Low Speed Data decoding both polarities | ||||
| 	Low Speed Data | ||||
| */ | ||||
| /*  | ||||
| 	general purpose pmr signal processing element  | ||||
| */ | ||||
| typedef struct | ||||
| { | ||||
| 	i16 counter;			// counter to next sample | ||||
| 	i16 synced; | ||||
| 	u32 syncCorr[2]; | ||||
| 	u32 data[2]; | ||||
| 	i16 state;				// disabled, enabled, | ||||
| 	i16 decode; | ||||
| 	i16 debug; | ||||
|  | ||||
| 	i16 polarity; | ||||
| 	u32 frameNum; | ||||
|  | ||||
| 	u16 area; | ||||
| 	u16 chan; | ||||
| 	u16 home; | ||||
| 	u16 id; | ||||
| 	u16 free; | ||||
|  | ||||
| 	u16 crc; | ||||
| 	i16 rssi; | ||||
|  | ||||
| } t_decLsd; | ||||
|  | ||||
|  | ||||
| /* general purpose pmr signal processing element */ | ||||
|  | ||||
| struct t_pmr_chan; | ||||
|  | ||||
| @@ -211,6 +442,7 @@ typedef struct t_pmr_sps | ||||
|  | ||||
| 	i16  enabled;		// enabled/disabled | ||||
|  | ||||
|  | ||||
| 	struct t_pmr_chan *parentChan; | ||||
| 	 | ||||
| 	i16  *source;		// source buffer | ||||
| @@ -220,7 +452,9 @@ typedef struct t_pmr_sps | ||||
| 	i16  numChanOut;	// allows output direct to interleaved buffer | ||||
| 	i16  selChanOut; | ||||
|  | ||||
| 	u32  ticks; | ||||
| 	i32  ticks;			 | ||||
| 	i32  timer; | ||||
| 	i32  count; | ||||
|  | ||||
| 	void *buff;			// this structure's internal buffer | ||||
|  | ||||
| @@ -258,6 +492,29 @@ typedef struct t_pmr_sps | ||||
| 	i16  err;			// error condition | ||||
| 	i16  option;		// option / request zero | ||||
| 	i16  state;         // stopped, start, stopped assumes zero'd | ||||
| 	 | ||||
| 	i16  pending; | ||||
|  | ||||
| 	struct { | ||||
| 		unsigned hit:1; | ||||
| 		unsigned hitlast:1; | ||||
| 		unsigned hita:1; | ||||
| 		unsigned hitb:1; | ||||
| 		unsigned bithit:1; | ||||
| 		unsigned now:1; | ||||
| 		unsigned next:1; | ||||
| 		unsigned prev:1; | ||||
| 		unsigned clock:1; | ||||
| 		unsigned hold:1; | ||||
| 		unsigned opt1:1; | ||||
| 		unsigned opt2:1; | ||||
| 		unsigned polarity:1; | ||||
| 		unsigned dotting:1; | ||||
| 		unsigned lastbitpending:1; | ||||
| 		unsigned outzero:1; | ||||
| 		unsigned settling:1; | ||||
| 		unsigned syncing:1; | ||||
| 	}b; | ||||
|  | ||||
| 	i16  cleared;		// output buffer cleared | ||||
|  | ||||
| @@ -288,14 +545,28 @@ typedef struct t_pmr_sps | ||||
|  | ||||
| } t_pmr_sps; | ||||
|  | ||||
|  | ||||
| struct t_dec_dcs; | ||||
| struct t_lsd_control; | ||||
| struct t_decLsd;;	 | ||||
| struct t_encLsd; | ||||
|  | ||||
| /* | ||||
| 	pmr channel | ||||
| */ | ||||
| typedef struct	t_pmr_chan | ||||
| { | ||||
| 	i16 index;				// which one | ||||
| 	i16 devicenum;			// belongs to | ||||
|  | ||||
| 	char *name; | ||||
|  | ||||
| 	i16 enabled;			// enabled/disabled | ||||
| 	i16 status;				// ok, error, busy, idle, initializing | ||||
| 	 | ||||
| 	i16  tracelevel; | ||||
| 	i16  tracetype; | ||||
| 	u32  tracemask; | ||||
|  | ||||
| 	i16 nSamplesRx;			// max frame size | ||||
| 	i16 nSamplesTx; | ||||
| @@ -306,11 +577,23 @@ typedef struct	t_pmr_chan | ||||
| 	i16 inputGain; | ||||
| 	i16 inputOffset; | ||||
|  | ||||
| 	i32  ticks;				// time ticks | ||||
| 	u32  frameCountRx;		// number processed | ||||
| 	u32  frameCountTx; | ||||
|  | ||||
| 	i8   txframelock; | ||||
|  | ||||
| 	i32  txHangTime; | ||||
| 	i32  txHangTimer; | ||||
| 	i32  txTurnOff; | ||||
| 	i16  txBufferClear; | ||||
|  | ||||
| 	u32 txfreq; | ||||
| 	u32 rxfreq; | ||||
| 	i8  txpower; | ||||
|  | ||||
| 	i32 txsettletime;		// in samples | ||||
| 	i32 txsettletimer; | ||||
|  | ||||
| 	i16 rxDC;			    // average DC value of input | ||||
| 	i16 rxSqSet;			// carrier squelch threshold | ||||
| @@ -319,6 +602,7 @@ typedef struct	t_pmr_chan | ||||
| 	i16 rxQuality;			// signal quality metric | ||||
| 	i16 rxCarrierDetect;    // carrier detect | ||||
| 	i16 rxCdType; | ||||
| 	i16 rxSqVoxAdj; | ||||
| 	i16 rxExtCarrierDetect;  | ||||
| 	i32 inputBlanking;  	// Tx pulse eliminator | ||||
|  | ||||
| @@ -340,20 +624,54 @@ typedef struct	t_pmr_chan | ||||
|  | ||||
| 	char radioDuplex; | ||||
|  | ||||
| 	struct { | ||||
| 		unsigned pmrNoiseSquelch:1; | ||||
| 		unsigned rxHpf:1; | ||||
| 		unsigned txHpf:1; | ||||
| 		unsigned txLpf:1; | ||||
| 		unsigned rxDeEmphasis:1; | ||||
| 		unsigned txPreEmphasis:1; | ||||
| 		unsigned startSpecialTone:1; | ||||
| 		unsigned stopSpecialTone:1; | ||||
| 		unsigned doingSpecialTone:1; | ||||
| 		unsigned extCarrierDetect:1; | ||||
| 		unsigned txCapture:1; | ||||
| 		unsigned rxCapture:1; | ||||
| 	}b; | ||||
| 	char    *pStr; | ||||
|  | ||||
| 	// 		start channel signaling codes source | ||||
| 	char 	*pRxCodeSrc;					// source | ||||
| 	char 	*pTxCodeSrc;					// source | ||||
| 	char 	*pTxCodeDefault;				// source | ||||
| 	// 		end channel signaling codes source | ||||
|  | ||||
| 	// 		start signaling code info derived from source | ||||
| 	i16  	numrxcodes; | ||||
| 	i16  	numtxcodes; | ||||
| 	char 	*pRxCodeStr;					// copied and cut up | ||||
| 	char 	**pRxCode;						// pointers to subs | ||||
| 	char 	*pTxCodeStr;					  | ||||
| 	char 	**pTxCode; | ||||
|  | ||||
| 	char 	txctcssdefault[16];				// codes from higher level | ||||
|  | ||||
| 	char	*rxctcssfreqs; 					// rest are derived from this  | ||||
| 	char    *txctcssfreqs; | ||||
| 	 | ||||
| 	char    numrxctcssfreqs; | ||||
| 	char    numtxctcssfreqs; | ||||
|  | ||||
| 	char    *rxctcss[CTCSS_NUM_CODES];		// pointers to each tone in string above | ||||
| 	char    *txctcss[CTCSS_NUM_CODES]; | ||||
|  | ||||
| 	i16 	rxCtcssMap[CTCSS_NUM_CODES]; | ||||
|  | ||||
| 	i8		txcodedefaultsmode; | ||||
| 	i16		txctcssdefault_index; | ||||
| 	float 	txctcssdefault_value; | ||||
|  | ||||
| 	char	txctcssfreq[32];				// encode now | ||||
| 	char    rxctcssfreq[32];				// decode now | ||||
| 	// 		end most of signaling code info derived from source | ||||
|  | ||||
| 	struct t_lsd_control	*pLsdCtl; | ||||
|  | ||||
| 	i16  rptnum; | ||||
| 	i16  area; | ||||
| 	char *ukey; | ||||
| 	u32  idleinterval; | ||||
| 	char turnoffs; | ||||
|  | ||||
| 	char pplock; | ||||
|  | ||||
| 	t_dedrift	dd; | ||||
|  | ||||
| 	i16 dummy; | ||||
|  | ||||
| @@ -379,21 +697,34 @@ typedef struct	t_pmr_chan | ||||
|  | ||||
| 	i16 rxCarrierPoint; | ||||
| 	i16 rxCarrierHyst; | ||||
|  | ||||
| 	i16 rxCtcssMap[CTCSS_NUM_CODES]; | ||||
| 	 | ||||
| 	i16 txCtcssTocShift; | ||||
| 	i16 txCtcssTocTime; | ||||
| 	i8	txTocType; | ||||
|  | ||||
| 	float txCtcssFreq; | ||||
| 	float rxCtcssFreq; | ||||
| 	float rxInputGain; | ||||
| 	 | ||||
| 	i16 rxCtcssIndex; | ||||
| 	i16 smode;	  							// ctcss, dcs, lsd | ||||
| 	i16 smodecode; | ||||
| 	i16 smodewas;	  						// ctcss, dcs, lsd | ||||
| 	i32 smodetimer;	  						// in ms | ||||
| 	i32 smodetime;							// to set in ms | ||||
|  | ||||
| 	t_dec_ctcss			*rxCtcss; | ||||
| 	struct t_dec_dcs	*decDcs; | ||||
| 	struct t_decLsd 	*decLsd;		 				 | ||||
| 	struct t_encLsd		*pLsdEnc; | ||||
|  | ||||
| 	i16 clamplitudeDcs; | ||||
| 	i16 centerDcs; | ||||
| 	u32 dcsBlankingTimer; | ||||
| 	i16 dcsDecode;							// current dcs decode value | ||||
|  | ||||
| 	i16 clamplitudeLsd; | ||||
| 	i16 centerLsd; | ||||
|  | ||||
|  | ||||
| 	i16 txPttIn;	 		// from external request | ||||
| 	i16 txPttOut;			// to radio hardware | ||||
| 	i16 txPttHid; | ||||
|  | ||||
| 	i16 bandwidth;			// wide/narrow | ||||
| 	i16 txCompand;			// type | ||||
| @@ -410,12 +741,15 @@ typedef struct	t_pmr_chan | ||||
|  | ||||
| 	i16 function; | ||||
|  | ||||
| 	i16 txState;			// off,settling,on,hangtime,turnoff | ||||
| 	i16 txState;				// off,settling,on,hangtime,turnoff | ||||
|  | ||||
| 	t_pmr_sps *spsMeasure;	// measurement block | ||||
| 	i16 spsIndex; | ||||
|  | ||||
| 	t_pmr_sps *spsMeasure;		// measurement block | ||||
|  | ||||
| 	t_pmr_sps *spsRx;			// 1st signal processing struct | ||||
| 	t_pmr_sps *spsRxLsd; | ||||
| 	t_pmr_sps *spsRxLsdNrz; | ||||
| 	t_pmr_sps *spsRxDeEmp; | ||||
| 	t_pmr_sps *spsRxHpf; | ||||
| 	t_pmr_sps *spsRxVox; | ||||
| @@ -423,14 +757,14 @@ typedef struct	t_pmr_chan | ||||
| 	t_pmr_sps *spsRxOut;		// Last signal processing struct | ||||
|  | ||||
| 	t_pmr_sps *spsTx;			// 1st  signal processing struct | ||||
|  | ||||
| 	t_pmr_sps *spsTxLsdLpf; | ||||
| 	 | ||||
| 	t_pmr_sps *spsTxOutA;		// Last signal processing struct | ||||
|  | ||||
| 	t_pmr_sps *spsTxOutB;		// Last signal processing struct | ||||
|  | ||||
| 	t_pmr_sps *spsSigGen0;		// ctcss | ||||
| 	t_pmr_sps *spsSigGen1;		// test and other tones | ||||
| 	t_pmr_sps *spsLsdGen; | ||||
| 	t_pmr_sps *spsTxLsdLpf; | ||||
|  | ||||
| 	// tune tweaks | ||||
|  | ||||
| @@ -452,6 +786,58 @@ typedef struct	t_pmr_chan | ||||
|  | ||||
| 	i32	*ptxLimiterAdjust;		// from calling application | ||||
|  | ||||
| 	struct { | ||||
| 		unsigned pmrNoiseSquelch:1; | ||||
| 		unsigned rxHpf:1; | ||||
| 		unsigned txHpf:1; | ||||
| 		unsigned txLpf:1; | ||||
| 		unsigned rxDeEmphasis:1; | ||||
| 		unsigned txPreEmphasis:1; | ||||
| 		unsigned startSpecialTone:1; | ||||
| 		unsigned stopSpecialTone:1; | ||||
| 		unsigned doingSpecialTone:1; | ||||
| 		unsigned extCarrierDetect:1; | ||||
| 		unsigned txCapture:1; | ||||
| 		unsigned rxCapture:1; | ||||
| 		unsigned reprog:1; | ||||
| 		unsigned radioactive:1; | ||||
| 		unsigned rxplmon:1; | ||||
| 		unsigned remoted:1; | ||||
| 		unsigned loopback:1; | ||||
| 		unsigned rxpolarity:1; | ||||
| 		unsigned txpolarity:1; | ||||
| 		unsigned dcsrxpolarity:1; | ||||
| 		unsigned dcstxpolarity:1; | ||||
| 		unsigned lsdrxpolarity:1; | ||||
| 		unsigned lsdtxpolarity:1; | ||||
| 		unsigned txsettling:1; | ||||
| 		unsigned smodeturnoff:1; | ||||
|  | ||||
| 		unsigned ctcssRxEnable:1; | ||||
| 		unsigned ctcssTxEnable:1; | ||||
| 		unsigned dcsRxEnable:1; | ||||
| 		unsigned dcsTxEnable:1; | ||||
| 		unsigned lmrRxEnable:1; | ||||
| 		unsigned lmrTxEnable:1; | ||||
| 		unsigned mdcRxEnable:1; | ||||
| 		unsigned mdcTxEnable:1; | ||||
| 		unsigned dstRxEnable:1; | ||||
| 		unsigned dstTxEnable:1; | ||||
| 		unsigned p25RxEnable:1; | ||||
| 		unsigned p25TxEnable:1; | ||||
| 		unsigned ax25Enable:1; | ||||
|  | ||||
| 		unsigned txCtcssInhibit:1; | ||||
|  | ||||
| 		unsigned rxkeyed:1; | ||||
| 		unsigned rxhalted:1; | ||||
| 		unsigned txhalted:1; | ||||
| 		unsigned pptp_p1:1; | ||||
| 		unsigned pptp_p2:1; | ||||
| 		unsigned tuning:1; | ||||
| 		unsigned pttwas:1; | ||||
| 	}b; | ||||
|  | ||||
| 	i16 *pRxDemod;				// buffers | ||||
| 	i16 *pRxBase;	 			// decimated lpf input | ||||
| 	i16 *pRxNoise;    | ||||
| @@ -463,7 +849,10 @@ typedef struct	t_pmr_chan | ||||
| 	i16 *pRxLsdLimit;         	// LSD Limited | ||||
| 	i16 *pRxCtcss;				// | ||||
| 	i16 *pRxSquelch; | ||||
| 	i16 *prxVoxMeas;				 | ||||
| 	i16 *prxMeasure; | ||||
|  | ||||
| 	i16 *pTxInput;				// input data | ||||
| 	i16 *pTxBase;				// input data | ||||
| 	i16 *pTxHpf; | ||||
| 	i16 *pTxPreEmp; | ||||
| @@ -474,11 +863,6 @@ typedef struct	t_pmr_chan | ||||
| 	i16 *pTxMod;			// upsampled, low pass filtered | ||||
| 	 | ||||
| 	i16 *pTxOut;			//  | ||||
| 	 | ||||
| 	i16 *pTxPttIn; | ||||
| 	i16 *pTxPttOut; | ||||
| 	i16 *pTxHang; | ||||
| 	i16 *pTxCode; | ||||
|  | ||||
| 	i16	*pSigGen0; | ||||
| 	i16	*pSigGen1; | ||||
| @@ -488,6 +872,12 @@ typedef struct	t_pmr_chan | ||||
|  | ||||
| 	i16 *pNull; | ||||
|  | ||||
| 	#if XPMR_DEBUG0 == 1 | ||||
|  | ||||
| 	i16 *pRxLsdCen; | ||||
|  | ||||
| 	i16 *pTstTxOut; | ||||
|  | ||||
| 	i16 *prxDebug;			// consolidated debug buffer | ||||
| 	i16 *ptxDebug;			// consolidated debug buffer | ||||
|  | ||||
| @@ -501,23 +891,23 @@ typedef struct	t_pmr_chan | ||||
| 	i16 *ptxDebug2; | ||||
| 	i16 *ptxDebug3; | ||||
|  | ||||
| 	t_dec_ctcss	*rxCtcss; | ||||
| 			   | ||||
| 	i16 clamplitudeDcs; | ||||
| 	i16 centerDcs; | ||||
| 	u32 dcsBlankingTimer; | ||||
| 	i16 dcsDecode;							// current dcs decode value | ||||
| 	#endif | ||||
|  | ||||
| 	i16 clamplitudeLsd; | ||||
| 	i16 centerLsd; | ||||
| 	t_decLsd decLsd[2];		 				// for both polarities | ||||
| 	i16 numDebugChannels; | ||||
|  | ||||
| 	t_sdbg	*sdbg; | ||||
|  | ||||
| } t_pmr_chan; | ||||
|  | ||||
| static i16			TxTestTone(t_pmr_chan *pChan, i16 function); | ||||
| /* | ||||
| 	function prototype declarations | ||||
| */ | ||||
| void 		strace(i16 point, t_sdbg *sdbg, i16 index, i16 value); | ||||
| void 		strace2(t_sdbg *sdbg); | ||||
|  | ||||
| static i16	TxTestTone(t_pmr_chan *pChan, i16 function); | ||||
| t_pmr_chan	*createPmrChannel(t_pmr_chan *tChan, i16 numSamples); | ||||
| t_pmr_sps 	*createPmrSps(void); | ||||
| t_pmr_sps 	*createPmrSps(t_pmr_chan *pChan); | ||||
| i16			destroyPmrChannel(t_pmr_chan *pChan); | ||||
| i16			destroyPmrSps(t_pmr_sps  *pSps); | ||||
| i16 		pmr_rx_frontend(t_pmr_sps *mySps); | ||||
| @@ -531,10 +921,28 @@ i16 		SoftLimiter(t_pmr_sps *mySps); | ||||
| i16			SigGen(t_pmr_sps *mySps); | ||||
| i16 		pmrMixer(t_pmr_sps *mySps); | ||||
| i16 		DelayLine(t_pmr_sps *mySps); | ||||
| i16			PmrRx(t_pmr_chan *PmrChan, i16 *input, i16 *output); | ||||
| i16			PmrTx(t_pmr_chan *PmrChan, i16 *input, i16 *output); | ||||
|  | ||||
| i16			PmrRx(t_pmr_chan *PmrChan, i16 *input, i16 *outputrx, i16 *outputtx ); | ||||
| i16			PmrTx(t_pmr_chan *PmrChan, i16 *input); | ||||
|  | ||||
| i16 		string_parse(char *src, char **dest, char ***ptrs); | ||||
| i16 		code_string_parse(t_pmr_chan *pChan); | ||||
|  | ||||
| i16 		CtcssFreqIndex(float freq); | ||||
| i16 		MeasureBlock(t_pmr_sps *mySps); | ||||
|  | ||||
| void		dedrift			(t_pmr_chan *pChan); | ||||
| void 		dedrift_write	(t_pmr_chan *pChan, i16 *src); | ||||
|  | ||||
| void		ppspiout	(u32 spidata); | ||||
| void		progdtx		(t_pmr_chan *pChan); | ||||
| void		ppbinout	(u8 chan); | ||||
|  | ||||
| #if XPMR_PPTP == 1 | ||||
| void		pptp_init 		(void); | ||||
| void		pptp_write		(i16 bit, i16 state); | ||||
| #endif | ||||
|  | ||||
| #endif /* ! XPMR_H */ | ||||
|  | ||||
| /* end of file */ | ||||
|   | ||||
| @@ -4,16 +4,28 @@ | ||||
|  * All Rights Reserved. Copyright (C)2007, Xelatec, LLC | ||||
|  *  | ||||
|  * 20070808 1235 Steven Henke, W9SH, sph@xelatec.com | ||||
|  *  | ||||
|  * 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 | ||||
|  * 		  | ||||
|  * This version may be optionally licenced under the GNU LGPL licence. | ||||
|  * | ||||
|  * 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. | ||||
|  * A license has been granted to Digium (via disclaimer) for the use of | ||||
|  * this code. | ||||
|  * | ||||
|  * Some filter coeficients via 'WinFilter' http://www.winfilter.20m.com. | ||||
|  * | ||||
|  * 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 | ||||
| @@ -24,30 +36,25 @@ | ||||
|  */ | ||||
|  | ||||
| #ifndef XPMR_COEF_H | ||||
| #define XMPR_COEF_H 1 | ||||
| #define XMPR_COEF_H 	1 | ||||
|  | ||||
| // frequencies in 0.1 Hz | ||||
| const u32 dtmf_row[] = | ||||
| static const u32 dtmf_row[] = | ||||
| { | ||||
| 	6970,  7700,  8520,  9410 | ||||
| }; | ||||
| const u32 dtmf_col[] = | ||||
| static const u32 dtmf_col[] = | ||||
| { | ||||
| 	12090, 13360, 14770, 16330 | ||||
| }; | ||||
|  | ||||
| const i16 coef_dcs_rx  = 1488;	   		// dcs rx data divisor for oversampling 8000/134.4 | ||||
| const i16 coef_dcs_tx  = 5952;	   		// dcs tx data divisor | ||||
|  | ||||
| const i16 coef_lsd_div  = 672;	   		// low speed data divisor | ||||
| const u32 coef_lsd_sync = 0x158;        // 000101011000 | ||||
| const u32 coef_lsd_sync_pattern[] = {0x0000000F, 0x0F0FF000}; | ||||
|  | ||||
| #define CTCSS_COEF_INT		120 | ||||
| #define CTCSS_SAMPLE_RATE   8000 | ||||
| #define TDIV(x) ((CTCSS_SAMPLE_RATE*1000/x)+5)/10 | ||||
|  | ||||
| i32 coef_ctcss[4][5]= | ||||
| #if 0 | ||||
| static i32 coef_ctcss[4][5]= | ||||
| { | ||||
| 	// freq, divisor, integrator, filter | ||||
| 	{770,TDIV(770),CTCSS_COEF_INT,0,0}, | ||||
| @@ -55,9 +62,9 @@ i32 coef_ctcss[4][5]= | ||||
| 	{1035,TDIV(1035),CTCSS_COEF_INT,0,0}, | ||||
| 	{0,0,0,0} | ||||
| }; | ||||
| #endif | ||||
|  | ||||
|  | ||||
| i16 coef_ctcss_div[]= | ||||
| static i16 coef_ctcss_div[]= | ||||
| { | ||||
| 2985,    // 00   067.0 | ||||
| 2782,    // 01   071.9 | ||||
| @@ -99,7 +106,7 @@ i16 coef_ctcss_div[]= | ||||
| 799     // 37   250.3 | ||||
| }; | ||||
|  | ||||
| float freq_ctcss[]= | ||||
| static float freq_ctcss[]= | ||||
| { | ||||
| 067.0,    // 00    | ||||
| 071.9,    // 01    | ||||
| @@ -378,7 +385,8 @@ static const int16_t coef_int_lpf_300_1_2[]={ | ||||
| // pre-emphasis differentiator 4000 Hz with 8KS/s | ||||
| // a0,a1,b0, | ||||
| static const int16_t taps_int_hpf_4000_1_2 = 2; | ||||
| static const int32_t gain_int_hpf_4000_1_2 = 16384; | ||||
| //static const int32_t gain_int_hpf_4000_1_2 = 16384;  // per calculations | ||||
| static const int32_t gain_int_hpf_4000_1_2 = 13404; // hand tweaked for unity gain at 1KHz | ||||
| static const int16_t coef_int_hpf_4000_1_2[]={ | ||||
| 17610, | ||||
| -17610, | ||||
| @@ -386,298 +394,6 @@ static const int16_t coef_int_hpf_4000_1_2[]={ | ||||
| }; | ||||
|  | ||||
|  | ||||
| /* | ||||
| 	ltr crc table | ||||
| 	from http://www.radioreference.com/forums/showthread.php?t=24126 | ||||
| */ | ||||
|  | ||||
| static const u8	ltr_table[]= | ||||
| { | ||||
| 0x38, // 00 Area 		0111000 | ||||
| 0x1c, // 01	Channel 4 	0011100 | ||||
| 0x0e, // 02 Channel 3 	0001110 | ||||
| 0x46, // 03 Channel 2 	1000110 | ||||
| 0x23, // 04 Channel 1 	0100011 | ||||
| 0x51, // 05 Channel 0 	1010001 | ||||
| 0x68, // 06 Home 4  	1101000 | ||||
| 0x75, // 07 Home 3 		1110101 | ||||
| 0x7a, // 08 Home 2 		1111010 | ||||
| 0x3d, // 09 Home 1 		0111101 | ||||
| 0x1f, // 10 Home 0 		0011111 | ||||
| 0x4f, // 11 Group 7 	1001111 | ||||
| 0x26, // 12 Group 6 	0100110 | ||||
| 0x52, // 13 Group 5 	1010010 | ||||
| 0x29, // 14 Group 4 	0101001 | ||||
| 0x15, // 15 Group 3 	0010101 | ||||
| 0x0d, // 16 Group 2 	0001101 | ||||
| 0x45, // 17 Group 1 	1000101 | ||||
| 0x62, // 18 Group 0 	1100010 | ||||
| 0x31, // 19 Free 4 		0110001 | ||||
| 0x19, // 20 Free 3 		0011001 | ||||
| 0x0d, // 21 Free 2 		0001101 | ||||
| 0x07, // 22 Free 1 		0000111 | ||||
| 0x43  // 23 Free 0 		1000011 | ||||
| }; | ||||
|  | ||||
| static const i16 bitWeight[]= | ||||
| { | ||||
| 0,   // 0 | ||||
| 1,   // 1 | ||||
| 1,   // 2 | ||||
| 2,   // 3 | ||||
| 1,   // 4 | ||||
| 2,   // 5 | ||||
| 2,   // 6 | ||||
| 3,   // 7 | ||||
| 1,   // 8 | ||||
| 2,   // 9 | ||||
| 2,   // 10 | ||||
| 3,   // 11 | ||||
| 2,   // 12 | ||||
| 3,   // 13 | ||||
| 3,   // 14 | ||||
| 4,   // 15 | ||||
| 1,   // 16 | ||||
| 2,   // 17 | ||||
| 2,   // 18 | ||||
| 3,   // 19 | ||||
| 2,   // 20 | ||||
| 3,   // 21 | ||||
| 3,   // 22 | ||||
| 4,   // 23 | ||||
| 2,   // 24 | ||||
| 3,   // 25 | ||||
| 3,   // 26 | ||||
| 4,   // 27 | ||||
| 3,   // 28 | ||||
| 4,   // 29 | ||||
| 4,   // 30 | ||||
| 5,   // 31 | ||||
| 1,   // 32 | ||||
| 2,   // 33 | ||||
| 2,   // 34 | ||||
| 3,   // 35 | ||||
| 2,   // 36 | ||||
| 3,   // 37 | ||||
| 3,   // 38 | ||||
| 4,   // 39 | ||||
| 2,   // 40 | ||||
| 3,   // 41 | ||||
| 3,   // 42 | ||||
| 4,   // 43 | ||||
| 3,   // 44 | ||||
| 4,   // 45 | ||||
| 4,   // 46 | ||||
| 5,   // 47 | ||||
| 2,   // 48 | ||||
| 3,   // 49 | ||||
| 3,   // 50 | ||||
| 4,   // 51 | ||||
| 3,   // 52 | ||||
| 4,   // 53 | ||||
| 4,   // 54 | ||||
| 5,   // 55 | ||||
| 3,   // 56 | ||||
| 4,   // 57 | ||||
| 4,   // 58 | ||||
| 5,   // 59 | ||||
| 4,   // 60 | ||||
| 5,   // 61 | ||||
| 5,   // 62 | ||||
| 6,   // 63 | ||||
| 1,   // 64 | ||||
| 2,   // 65 | ||||
| 2,   // 66 | ||||
| 3,   // 67 | ||||
| 2,   // 68 | ||||
| 3,   // 69 | ||||
| 3,   // 70 | ||||
| 4,   // 71 | ||||
| 2,   // 72 | ||||
| 3,   // 73 | ||||
| 3,   // 74 | ||||
| 4,   // 75 | ||||
| 3,   // 76 | ||||
| 4,   // 77 | ||||
| 4,   // 78 | ||||
| 5,   // 79 | ||||
| 2,   // 80 | ||||
| 3,   // 81 | ||||
| 3,   // 82 | ||||
| 4,   // 83 | ||||
| 3,   // 84 | ||||
| 4,   // 85 | ||||
| 4,   // 86 | ||||
| 5,   // 87 | ||||
| 3,   // 88 | ||||
| 4,   // 89 | ||||
| 4,   // 90 | ||||
| 5,   // 91 | ||||
| 4,   // 92 | ||||
| 5,   // 93 | ||||
| 5,   // 94 | ||||
| 6,   // 95 | ||||
| 2,   // 96 | ||||
| 3,   // 97 | ||||
| 3,   // 98 | ||||
| 4,   // 99 | ||||
| 3,   // 100 | ||||
| 4,   // 101 | ||||
| 4,   // 102 | ||||
| 5,   // 103 | ||||
| 3,   // 104 | ||||
| 4,   // 105 | ||||
| 4,   // 106 | ||||
| 5,   // 107 | ||||
| 4,   // 108 | ||||
| 5,   // 109 | ||||
| 5,   // 110 | ||||
| 6,   // 111 | ||||
| 3,   // 112 | ||||
| 4,   // 113 | ||||
| 4,   // 114 | ||||
| 5,   // 115 | ||||
| 4,   // 116 | ||||
| 5,   // 117 | ||||
| 5,   // 118 | ||||
| 6,   // 119 | ||||
| 4,   // 120 | ||||
| 5,   // 121 | ||||
| 5,   // 122 | ||||
| 6,   // 123 | ||||
| 5,   // 124 | ||||
| 6,   // 125 | ||||
| 6,   // 126 | ||||
| 7,   // 127 | ||||
| 1,   // 128 | ||||
| 2,   // 129 | ||||
| 2,   // 130 | ||||
| 3,   // 131 | ||||
| 2,   // 132 | ||||
| 3,   // 133 | ||||
| 3,   // 134 | ||||
| 4,   // 135 | ||||
| 2,   // 136 | ||||
| 3,   // 137 | ||||
| 3,   // 138 | ||||
| 4,   // 139 | ||||
| 3,   // 140 | ||||
| 4,   // 141 | ||||
| 4,   // 142 | ||||
| 5,   // 143 | ||||
| 2,   // 144 | ||||
| 3,   // 145 | ||||
| 3,   // 146 | ||||
| 4,   // 147 | ||||
| 3,   // 148 | ||||
| 4,   // 149 | ||||
| 4,   // 150 | ||||
| 5,   // 151 | ||||
| 3,   // 152 | ||||
| 4,   // 153 | ||||
| 4,   // 154 | ||||
| 5,   // 155 | ||||
| 4,   // 156 | ||||
| 5,   // 157 | ||||
| 5,   // 158 | ||||
| 6,   // 159 | ||||
| 2,   // 160 | ||||
| 3,   // 161 | ||||
| 3,   // 162 | ||||
| 4,   // 163 | ||||
| 3,   // 164 | ||||
| 4,   // 165 | ||||
| 4,   // 166 | ||||
| 5,   // 167 | ||||
| 3,   // 168 | ||||
| 4,   // 169 | ||||
| 4,   // 170 | ||||
| 5,   // 171 | ||||
| 4,   // 172 | ||||
| 5,   // 173 | ||||
| 5,   // 174 | ||||
| 6,   // 175 | ||||
| 3,   // 176 | ||||
| 4,   // 177 | ||||
| 4,   // 178 | ||||
| 5,   // 179 | ||||
| 4,   // 180 | ||||
| 5,   // 181 | ||||
| 5,   // 182 | ||||
| 6,   // 183 | ||||
| 4,   // 184 | ||||
| 5,   // 185 | ||||
| 5,   // 186 | ||||
| 6,   // 187 | ||||
| 5,   // 188 | ||||
| 6,   // 189 | ||||
| 6,   // 190 | ||||
| 7,   // 191 | ||||
| 2,   // 192 | ||||
| 3,   // 193 | ||||
| 3,   // 194 | ||||
| 4,   // 195 | ||||
| 3,   // 196 | ||||
| 4,   // 197 | ||||
| 4,   // 198 | ||||
| 5,   // 199 | ||||
| 3,   // 200 | ||||
| 4,   // 201 | ||||
| 4,   // 202 | ||||
| 5,   // 203 | ||||
| 4,   // 204 | ||||
| 5,   // 205 | ||||
| 5,   // 206 | ||||
| 6,   // 207 | ||||
| 3,   // 208 | ||||
| 4,   // 209 | ||||
| 4,   // 210 | ||||
| 5,   // 211 | ||||
| 4,   // 212 | ||||
| 5,   // 213 | ||||
| 5,   // 214 | ||||
| 6,   // 215 | ||||
| 4,   // 216 | ||||
| 5,   // 217 | ||||
| 5,   // 218 | ||||
| 6,   // 219 | ||||
| 5,   // 220 | ||||
| 6,   // 221 | ||||
| 6,   // 222 | ||||
| 7,   // 223 | ||||
| 3,   // 224 | ||||
| 4,   // 225 | ||||
| 4,   // 226 | ||||
| 5,   // 227 | ||||
| 4,   // 228 | ||||
| 5,   // 229 | ||||
| 5,   // 230 | ||||
| 6,   // 231 | ||||
| 4,   // 232 | ||||
| 5,   // 233 | ||||
| 5,   // 234 | ||||
| 6,   // 235 | ||||
| 5,   // 236 | ||||
| 6,   // 237 | ||||
| 6,   // 238 | ||||
| 7,   // 239 | ||||
| 4,   // 240 | ||||
| 5,   // 241 | ||||
| 5,   // 242 | ||||
| 6,   // 243 | ||||
| 5,   // 244 | ||||
| 6,   // 245 | ||||
| 6,   // 246 | ||||
| 7,   // 247 | ||||
| 5,   // 248 | ||||
| 6,   // 249 | ||||
| 6,   // 250 | ||||
| 7,   // 251 | ||||
| 6,   // 252 | ||||
| 7,   // 253 | ||||
| 7,   // 254 | ||||
| 8    // 255 | ||||
| }; | ||||
|  | ||||
|  | ||||
| /* | ||||
|   | ||||
		Reference in New Issue
	
	Block a user