Courtesy of Víctor Paesa.
MvH
Benjamin Larsson
Index: fskmodem.c
===================================================================
--- fskmodem.c (revision 48224)
+++ fskmodem.c (working copy)
@@ -26,8 +26,6 @@
*
* \arg Includes code and algorithms from the Zapata library.
*
- * \todo - REMOVE ALL SPANISH COMMENTS AND TRANSLATE THEM TO ENGLISH. Thank
you.
- * Swedish will work too :-)
*/
#include "asterisk.h"
@@ -59,11 +57,11 @@
#define GET_SAMPLE get_sample(&buffer, len)
-/* Coeficientes para filtros de entrada
*/
-/* Tabla de coeficientes, generada a partir del programa "mkfilter" */
-/* Formato: coef[IDX_FREC][IDX_BW][IDX_COEF] */
+/* Coefficients for input filters */
+/* Coefficients table, generated by program "mkfilter" */
+/* Format: coef[IDX_FREC][IDX_BW][IDX_COEF] */
/* IDX_COEF = 0 => 1/GAIN
*/
-/* IDX_COEF = 1-6 => Coeficientes y[n] */
+/* IDX_COEF = 1-6 => Coefficientes y[n] */
static double coef_in[NF][NBW][8] = {
{
@@ -91,12 +89,11 @@
{
9.8531160936e-02,-5.6297236492e-02,-5.7284484199e-02,-4.3673866734e-01,-1.9564766257e-01,-6.2028156584e-01,-3.4692356122e-01,0.0000000000e+00,
},
},
};
-
-/* Coeficientes para filtro de salida */
-/* Tabla de coeficientes, generada a partir del programa "mkfilter" */
-/* Formato: coef[IDX_BW][IDX_COEF] */
+/* Coefficients for output filter */
+/* Coefficients table, generated by program "mkfilter" */
+/* Format: coef[IDX_BW][IDX_COEF] */
/* IDX_COEF = 0 => 1/GAIN
*/
-/* IDX_COEF = 1-6 => Coeficientes y[n] */
+/* IDX_COEF = 1-6 => Coefficientes y[n] */
static double coef_out[NBW][8] = {
{
1.3868644653e-08,-6.3283665042e-01,4.0895057217e+00,-1.1020074592e+01,1.5850766191e+01,-1.2835109292e+01,5.5477477340e+00,0.0000000000e+00,
},
@@ -104,7 +101,7 @@
};
-/*! Filtro pasa-banda para frecuencia de MARCA */
+/*! Band-pass filter for MARK frequency */
static inline float filtroM(fsk_data *fskd,float in)
{
int i, j;
@@ -123,7 +120,7 @@
return s;
}
-/*! Filtro pasa-banda para frecuencia de ESPACIO */
+/*! Band-pass filter for SPACE frequency */
static inline float filtroS(fsk_data *fskd,float in)
{
int i, j;
@@ -142,7 +139,7 @@
return s;
}
-/*! Filtro pasa-bajos para datos demodulados */
+/*! Low-pass filter for demodulated data */
static inline float filtroL(fsk_data *fskd,float in)
{
int i, j;
@@ -187,7 +184,7 @@
static int get_bit_raw(fsk_data *fskd, short *buffer, int *len)
{
- /* Esta funcion implementa un DPLL para sincronizarse con los bits */
+ /* This function implements a DPLL to synchronize with the bits */
float x,spb,spb2,ds;
int f;
@@ -200,7 +197,7 @@
for (f = 0;;) {
if (demodulador(fskd, &x, GET_SAMPLE))
return -1;
- if ((x * fskd->x0) < 0) { /* Transicion */
+ if ((x * fskd->x0) < 0) { /* Transition */
if (!f) {
if (fskd->cont<(spb2))
fskd->cont += ds;
@@ -236,7 +233,7 @@
case STATE_GET_BYTE:
goto getbyte;
}
- /* Esperamos bit de start */
+ /* We await for start bit */
do {
/* this was jesus's nice, reasonable, working (at least with
RTTY) code
to look for the beginning of the start bit. Unfortunately,
since TTY/TDD's
@@ -273,7 +270,7 @@
break;
}
search_startbit3:
- /* Esperamos 0.5 bits antes de usar DPLL */
+ /* We await for 0.5 bits before using DPLL */
i = fskd->spb/2;
if (*len < i) {
fskd->state = STATE_SEARCH_STARTBIT3;
@@ -288,7 +285,7 @@
samples++;
}
- /* x1 debe ser negativo (confirmación del bit de start) */
+ /* x1 must be negative (start bit confirmation) */
} while (fskd->x1 > 0);
fskd->state = STATE_GET_BYTE;
@@ -304,7 +301,7 @@
if (*len < 80)
return 0;
}
- /* Leemos ahora los bits de datos */
+ /* Now we read the data bits */
j = fskd->nbit;
for (a = n1 = 0; j; j--) {
olen = *len;
@@ -320,7 +317,7 @@
j = 8-fskd->nbit;
a >>= j;
- /* Leemos bit de paridad (si existe) y la comprobamos */
+ /* We read parity bit (if exists) and check parity */
if (fskd->paridad) {
olen = *len;
i = get_bit_raw(fskd, buffer, len);
@@ -329,16 +326,16 @@
return(-1);
if (i)
n1++;
- if (fskd->paridad == 1) { /* paridad = 1 (par) */
+ if (fskd->paridad == 1) { /* parity=1 (even) */
if (n1&1)
a |= 0x100; /* error */
- } else { /* paridad = 2 (impar) */
+ } else { /* parity=2 (odd) */
if (!(n1&1))
a |= 0x100; /* error */
}
}
- /* Leemos bits de STOP. Todos deben ser 1 */
+ /* We read STOP bits. All of them must be 1 */
for (j = fskd->nstop;j;j--) {
r = get_bit_raw(fskd, buffer, len);
@@ -348,9 +345,9 @@
a |= 0x200;
}
- /* Por fin retornamos */
- /* Bit 8 : Error de paridad */
- /* Bit 9 : Error de Framming */
+ /* And finally we return */
+ /* Bit 8 : Parity error */
+ /* Bit 9 : Framming error*/
*outbyte = a;
fskd->state = STATE_SEARCH_STARTBIT;
_______________________________________________
Openpbx-dev mailing list
[email protected]
http://lists.openpbx.org/mailman/listinfo/openpbx-dev