Issue #8506 - translate spanish comments in fskmodem to english (according to bug guidelines)
Thanks merbanan! git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48273 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
eea4555a9b
commit
0fca2eac77
|
@ -19,7 +19,6 @@
|
|||
/*! \file
|
||||
* \brief FSK Modem Support
|
||||
* \note Includes code and algorithms from the Zapata library.
|
||||
* \todo Translate Emiliano Zapata's spanish comments to english, please.
|
||||
*/
|
||||
|
||||
#ifndef _ASTERISK_FSKMODEM_H
|
||||
|
@ -42,20 +41,20 @@ typedef struct {
|
|||
float x1;
|
||||
float x2;
|
||||
float cont;
|
||||
int bw; /*!< Ancho de Banda */
|
||||
int bw; /*!< Bandwidth */
|
||||
double fmxv[8],fmyv[8]; /*!< filter stuff for M filter */
|
||||
int fmp; /*!< pointer for M filter */
|
||||
double fsxv[8],fsyv[8]; /*!< filter stuff for S filter */
|
||||
int fsp; /*!< pointer for S filter */
|
||||
double flxv[8],flyv[8]; /*!< filter stuff for L filter */
|
||||
int flp; /*!< pointer for L filter */
|
||||
int f_mark_idx; /*!< Indice de frecuencia de marca (f_M-500)/5 */
|
||||
int f_space_idx; /*!< Indice de frecuencia de espacio (f_S-500)/5 */
|
||||
int f_mark_idx; /*!< Mark frequency index (f_M-500)/5 */
|
||||
int f_space_idx; /*!< Space frequency index (f_S-500)/5 */
|
||||
int state;
|
||||
int pcola; /*!< Puntero de las colas de datos */
|
||||
float cola_in[NCOLA]; /*!< Cola de muestras de entrada */
|
||||
float cola_filtro[NCOLA]; /*!< Cola de muestras tras filtros */
|
||||
float cola_demod[NCOLA]; /*!< Cola de muestras demoduladas */
|
||||
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_demod[NCOLA]; /*!< Queue of demodulated samples */
|
||||
} fsk_data;
|
||||
|
||||
/* \brief Retrieve a serial byte into outbyte.
|
||||
|
|
|
@ -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,12 +57,13 @@ static inline float get_sample(short **buffer, int *len)
|
|||
|
||||
#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] */
|
||||
/* IDX_COEF = 0 => 1/GAIN */
|
||||
/* IDX_COEF = 1-6 => Coeficientes y[n] */
|
||||
|
||||
/*! \brief Coefficients for input filters
|
||||
* Coefficients table, generated by program "mkfilter"
|
||||
* mkfilter is part of the zapatatelephony.org distribution
|
||||
* Format: coef[IDX_FREC][IDX_BW][IDX_COEF]
|
||||
* IDX_COEF = 0 => 1/GAIN
|
||||
* IDX_COEF = 1-6 => Coefficientes y[n]
|
||||
*/
|
||||
static double coef_in[NF][NBW][8] = {
|
||||
{
|
||||
{ 1.8229206611e-04,-7.8997325866e-01,2.2401819940e+00,-4.6751353581e+00,5.5080745712e+00,-5.0571565772e+00,2.6215820004e+00,0.0000000000e+00, },
|
||||
|
@ -92,19 +91,19 @@ static double coef_in[NF][NBW][8] = {
|
|||
},
|
||||
};
|
||||
|
||||
/* Coeficientes para filtro de salida */
|
||||
/* Tabla de coeficientes, generada a partir del programa "mkfilter" */
|
||||
/* Formato: coef[IDX_BW][IDX_COEF] */
|
||||
/* IDX_COEF = 0 => 1/GAIN */
|
||||
/* IDX_COEF = 1-6 => Coeficientes y[n] */
|
||||
|
||||
/*! \brief 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 => 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, },
|
||||
{ 3.1262119724e-03,-7.8390522307e-03,8.5209627801e-02,-4.0804129163e-01,1.1157139955e+00,-1.8767603680e+00,1.8916395224e+00,0.0000000000e+00, },
|
||||
};
|
||||
|
||||
|
||||
/*! 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 +122,7 @@ static inline float filtroM(fsk_data *fskd,float in)
|
|||
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 +141,7 @@ static inline float filtroS(fsk_data *fskd,float in)
|
|||
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 +186,7 @@ static inline int demodulador(fsk_data *fskd, float *retval, float x)
|
|||
|
||||
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 +199,7 @@ static int get_bit_raw(fsk_data *fskd, short *buffer, int *len)
|
|||
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 +235,7 @@ int fsk_serie(fsk_data *fskd, short *buffer, int *len, int *outbyte)
|
|||
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
|
||||
|
@ -254,7 +253,7 @@ int fsk_serie(fsk_data *fskd, short *buffer, int *len, int *outbyte)
|
|||
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 (demodulador(fskd, &fskd->x1, GET_SAMPLE))
|
||||
return -1;
|
||||
samples++;
|
||||
for(;;) {
|
||||
|
@ -264,7 +263,7 @@ search_startbit2:
|
|||
return 0;
|
||||
}
|
||||
samples++;
|
||||
if (demodulador(fskd,&fskd->x2,GET_SAMPLE))
|
||||
if (demodulador(fskd, &fskd->x2, GET_SAMPLE))
|
||||
return(-1);
|
||||
#if 0
|
||||
printf("x2 = %5.5f ", fskd->x2);
|
||||
|
@ -273,14 +272,14 @@ search_startbit2:
|
|||
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;
|
||||
return 0;
|
||||
}
|
||||
for(;i;i--) {
|
||||
if (demodulador(fskd,&fskd->x1,GET_SAMPLE))
|
||||
if (demodulador(fskd, &fskd->x1, GET_SAMPLE))
|
||||
return(-1);
|
||||
#if 0
|
||||
printf("x1 = %5.5f ", fskd->x1);
|
||||
|
@ -288,7 +287,7 @@ search_startbit3:
|
|||
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 +303,7 @@ getbyte:
|
|||
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 +319,7 @@ getbyte:
|
|||
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 +328,16 @@ getbyte:
|
|||
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 +347,9 @@ getbyte:
|
|||
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;
|
||||
|
|
Reference in New Issue