[asterisk-commits] qwell: trunk r48276 - in /trunk: include/asterisk/ main/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Dec 5 13:15:38 MST 2006


Author: qwell
Date: Tue Dec  5 14:15:37 2006
New Revision: 48276

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48276
Log:
Expand on r48273 (from issue 8506), to translate more of the fskmodem stuff to English.

r48273 dealt with the comments and such, this deals with the code itself.
(This couldn't have been easily done if it weren't for 48273 - thanks again for that merbanan)

Modified:
    trunk/include/asterisk/fskmodem.h
    trunk/main/callerid.c
    trunk/main/fskmodem.c
    trunk/main/tdd.c

Modified: trunk/include/asterisk/fskmodem.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/fskmodem.h?view=diff&rev=48276&r1=48275&r2=48276
==============================================================================
--- trunk/include/asterisk/fskmodem.h (original)
+++ trunk/include/asterisk/fskmodem.h Tue Dec  5 14:15:37 2006
@@ -35,7 +35,7 @@
 	float spb;	/*!< Samples / Bit */
 	int nbit;	/*!< Number of Data Bits (5,7,8) */
 	float nstop;	/*!< Number of Stop Bits 1,1.5,2  */
-	int paridad;	/*!< Parity 0=none 1=even 2=odd */
+	int parity;	/*!< Parity 0=none 1=even 2=odd */
 	int hdlc;	/*!< Modo Packet */
 	float x0;
 	float x1;
@@ -53,7 +53,7 @@
 	int state;
 	int pcola;			/*!< Pointer to data queues */
 	float cola_in[NCOLA];		/*!< Queue of input samples */
-	float cola_filtro[NCOLA];	/*!< Queue of samples after filters */
+	float cola_filter[NCOLA];	/*!< Queue of samples after filters */
 	float cola_demod[NCOLA];	/*!< Queue of demodulated samples */
 } fsk_data;
 
@@ -66,6 +66,6 @@
    \arg 1: An output byte was received and stored in outbyte
    \arg -1: An error occured in the transmission
    He must be called with at least 80 bytes of buffer. */
-int fsk_serie(fsk_data *fskd, short *buffer, int *len, int *outbyte);
+int fsk_serial(fsk_data *fskd, short *buffer, int *len, int *outbyte);
 
 #endif /* _ASTERISK_FSKMODEM_H */

Modified: trunk/main/callerid.c
URL: http://svn.digium.com/view/asterisk/trunk/main/callerid.c?view=diff&rev=48276&r1=48275&r2=48276
==============================================================================
--- trunk/main/callerid.c (original)
+++ trunk/main/callerid.c Tue Dec  5 14:15:37 2006
@@ -298,17 +298,17 @@
 	while (mylen >= 160) {
 		b = b2 = 0;
 		olen = mylen;
-		res = fsk_serie(&cid->fskd, buf, &mylen, &b);
+		res = fsk_serial(&cid->fskd, buf, &mylen, &b);
 
 		if (mylen < 0) {
-			ast_log(LOG_ERROR, "fsk_serie made mylen < 0 (%d)\n", mylen);
+			ast_log(LOG_ERROR, "fsk_serial made mylen < 0 (%d)\n", mylen);
 			return -1;
 		}
 
 		buf += (olen - mylen);
 
 		if (res < 0) {
-			ast_log(LOG_NOTICE, "fsk_serie failed\n");
+			ast_log(LOG_NOTICE, "fsk_serial failed\n");
 			return -1;
 		}
 
@@ -538,14 +538,14 @@
 		buf[x+cid->oldlen/2] = AST_XLAW(ubuf[x]);
 	while (mylen >= 160) {
 		olen = mylen;
-		res = fsk_serie(&cid->fskd, buf, &mylen, &b);
+		res = fsk_serial(&cid->fskd, buf, &mylen, &b);
 		if (mylen < 0) {
-			ast_log(LOG_ERROR, "fsk_serie made mylen < 0 (%d)\n", mylen);
+			ast_log(LOG_ERROR, "fsk_serial made mylen < 0 (%d)\n", mylen);
 			return -1;
 		}
 		buf += (olen - mylen);
 		if (res < 0) {
-			ast_log(LOG_NOTICE, "fsk_serie failed\n");
+			ast_log(LOG_NOTICE, "fsk_serial failed\n");
 			return -1;
 		}
 		if (res == 1) {

Modified: trunk/main/fskmodem.c
URL: http://svn.digium.com/view/asterisk/trunk/main/fskmodem.c?view=diff&rev=48276&r1=48275&r2=48276
==============================================================================
--- trunk/main/fskmodem.c (original)
+++ trunk/main/fskmodem.c Tue Dec  5 14:15:37 2006
@@ -104,7 +104,7 @@
 
 
 /*! Band-pass filter for MARK frequency */
-static inline float filtroM(fsk_data *fskd,float in)
+static inline float filterM(fsk_data *fskd,float in)
 {
 	int i, j;
 	double s;
@@ -123,7 +123,7 @@
 }
 
 /*! Band-pass filter for SPACE frequency */
-static inline float filtroS(fsk_data *fskd,float in)
+static inline float filterS(fsk_data *fskd,float in)
 {
 	int i, j;
 	double s;
@@ -142,7 +142,7 @@
 }
 
 /*! Low-pass filter for demodulated data */
-static inline float filtroL(fsk_data *fskd,float in)
+static inline float filterL(fsk_data *fskd,float in)
 {
 	int i, j;
 	double s;
@@ -164,18 +164,18 @@
 	return s;
 }
 
-static inline int demodulador(fsk_data *fskd, float *retval, float x)
+static inline int demodulator(fsk_data *fskd, float *retval, float x)
 {
 	float xS,xM;
 
 	fskd->cola_in[fskd->pcola] = x;
 	
-	xS = filtroS(fskd,x);
-	xM = filtroM(fskd,x);
-
-	fskd->cola_filtro[fskd->pcola] = xM-xS;
-
-	x = filtroL(fskd,xM*xM - xS*xS);
+	xS = filterS(fskd,x);
+	xM = filterM(fskd,x);
+
+	fskd->cola_filter[fskd->pcola] = xM-xS;
+
+	x = filterL(fskd,xM*xM - xS*xS);
 	
 	fskd->cola_demod[fskd->pcola++] = x;
 	fskd->pcola &=  (NCOLA-1);
@@ -197,7 +197,7 @@
 	spb2 = spb/2.;
 
 	for (f = 0;;) {
-		if (demodulador(fskd, &x, GET_SAMPLE))
+		if (demodulator(fskd, &x, GET_SAMPLE))
 			return -1;
 		if ((x * fskd->x0) < 0) {	/* Transition */
 			if (!f) {
@@ -219,7 +219,7 @@
 	return f;
 }
 
-int fsk_serie(fsk_data *fskd, short *buffer, int *len, int *outbyte)
+int fsk_serial(fsk_data *fskd, short *buffer, int *len, int *outbyte)
 {
 	int a;
 	int i,j,n1,r;
@@ -242,9 +242,9 @@
 		just start sending a start bit with nothing preceding it at the beginning
 		of a transmission (what a LOSING design), we cant do it this elegantly */
 		/*
-		if (demodulador(zap,&x1)) return(-1);
+		if (demodulator(zap,&x1)) return(-1);
 		for(;;) {
-			if (demodulador(zap,&x2)) return(-1);
+			if (demodulator(zap,&x2)) return(-1);
 			if (x1>0 && x2<0) break;
 			x1 = x2;
 		}
@@ -253,7 +253,7 @@
 		beginning of a start bit in the TDD sceanario. It just looks for sufficient
 		level to maybe, perhaps, guess, maybe that its maybe the beginning of
 		a start bit, perhaps. This whole thing stinks! */
-		if (demodulador(fskd, &fskd->x1, GET_SAMPLE))
+		if (demodulator(fskd, &fskd->x1, GET_SAMPLE))
 			return -1;
 		samples++;
 		for(;;) {
@@ -263,7 +263,7 @@
 				return 0;
 			}
 			samples++;
-			if (demodulador(fskd, &fskd->x2, GET_SAMPLE))
+			if (demodulator(fskd, &fskd->x2, GET_SAMPLE))
 				return(-1);
 #if 0
 			printf("x2  =  %5.5f ", fskd->x2);
@@ -279,7 +279,7 @@
 			return 0;
 		}
 		for(;i;i--) {
-			if (demodulador(fskd, &fskd->x1, GET_SAMPLE))
+			if (demodulator(fskd, &fskd->x1, GET_SAMPLE))
 				return(-1); 
 #if 0
 			printf("x1 = %5.5f ", fskd->x1);
@@ -320,7 +320,7 @@
 	a >>= j;
 
 	/* We read parity bit (if exists) and check parity */
-	if (fskd->paridad) {
+	if (fskd->parity) {
 		olen = *len;
 		i = get_bit_raw(fskd, buffer, len); 
 		buffer += (olen - *len);
@@ -328,7 +328,7 @@
 			return(-1);
 		if (i)
 			n1++;
-		if (fskd->paridad == 1) {	/* parity=1 (even) */
+		if (fskd->parity == 1) {	/* parity=1 (even) */
 			if (n1&1)
 				a |= 0x100;		/* error */
 		} else {			/* parity=2 (odd) */

Modified: trunk/main/tdd.c
URL: http://svn.digium.com/view/asterisk/trunk/main/tdd.c?view=diff&rev=48276&r1=48275&r2=48276
==============================================================================
--- trunk/main/tdd.c (original)
+++ trunk/main/tdd.c Tue Dec  5 14:15:37 2006
@@ -108,7 +108,7 @@
 		tdd->fskd.hdlc = 0;         /* Async */
 		tdd->fskd.nbit = 5;         /* 5 bits */
 		tdd->fskd.nstop = 1.5;      /* 1.5 stop bits */
-		tdd->fskd.paridad = 0;      /* No parity */
+		tdd->fskd.parity = 0;       /* No parity */
 		tdd->fskd.bw=0;             /* Filter 75 Hz */
 		tdd->fskd.f_mark_idx = 0;   /* 1400 Hz */
 		tdd->fskd.f_space_idx = 1;  /* 1800 Hz */
@@ -157,15 +157,15 @@
 	c = res = 0;
 	while (mylen >= 1320) { /* has to have enough to work on */
 		olen = mylen;
-		res = fsk_serie(&tdd->fskd, buf, &mylen, &b);
+		res = fsk_serial(&tdd->fskd, buf, &mylen, &b);
 		if (mylen < 0) {
-			ast_log(LOG_ERROR, "fsk_serie made mylen < 0 (%d) (olen was %d)\n", mylen, olen);
+			ast_log(LOG_ERROR, "fsk_serial made mylen < 0 (%d) (olen was %d)\n", mylen, olen);
 			free(obuf);
 			return -1;
 		}
 		buf += (olen - mylen);
 		if (res < 0) {
-			ast_log(LOG_NOTICE, "fsk_serie failed\n");
+			ast_log(LOG_NOTICE, "fsk_serial failed\n");
 			free(obuf);
 			return -1;
 		}



More information about the asterisk-commits mailing list