mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-14 00:24:05 +00:00
Issue #8506 - translate spanish comments in fskmodem to english (according to bug guidelines)
Thanks merbanan! git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48273 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -19,7 +19,6 @@
|
|||||||
/*! \file
|
/*! \file
|
||||||
* \brief FSK Modem Support
|
* \brief FSK Modem Support
|
||||||
* \note Includes code and algorithms from the Zapata library.
|
* \note Includes code and algorithms from the Zapata library.
|
||||||
* \todo Translate Emiliano Zapata's spanish comments to english, please.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _ASTERISK_FSKMODEM_H
|
#ifndef _ASTERISK_FSKMODEM_H
|
||||||
@@ -42,20 +41,20 @@ typedef struct {
|
|||||||
float x1;
|
float x1;
|
||||||
float x2;
|
float x2;
|
||||||
float cont;
|
float cont;
|
||||||
int bw; /*!< Ancho de Banda */
|
int bw; /*!< Bandwidth */
|
||||||
double fmxv[8],fmyv[8]; /*!< filter stuff for M filter */
|
double fmxv[8],fmyv[8]; /*!< filter stuff for M filter */
|
||||||
int fmp; /*!< pointer for M filter */
|
int fmp; /*!< pointer for M filter */
|
||||||
double fsxv[8],fsyv[8]; /*!< filter stuff for S filter */
|
double fsxv[8],fsyv[8]; /*!< filter stuff for S filter */
|
||||||
int fsp; /*!< pointer for S filter */
|
int fsp; /*!< pointer for S filter */
|
||||||
double flxv[8],flyv[8]; /*!< filter stuff for L filter */
|
double flxv[8],flyv[8]; /*!< filter stuff for L filter */
|
||||||
int flp; /*!< pointer for L filter */
|
int flp; /*!< pointer for L filter */
|
||||||
int f_mark_idx; /*!< Indice de frecuencia de marca (f_M-500)/5 */
|
int f_mark_idx; /*!< Mark frequency index (f_M-500)/5 */
|
||||||
int f_space_idx; /*!< Indice de frecuencia de espacio (f_S-500)/5 */
|
int f_space_idx; /*!< Space frequency index (f_S-500)/5 */
|
||||||
int state;
|
int state;
|
||||||
int pcola; /*!< Puntero de las colas de datos */
|
int pcola; /*!< Pointer to data queues */
|
||||||
float cola_in[NCOLA]; /*!< Cola de muestras de entrada */
|
float cola_in[NCOLA]; /*!< Queue of input samples */
|
||||||
float cola_filtro[NCOLA]; /*!< Cola de muestras tras filtros */
|
float cola_filtro[NCOLA]; /*!< Queue of samples after filters */
|
||||||
float cola_demod[NCOLA]; /*!< Cola de muestras demoduladas */
|
float cola_demod[NCOLA]; /*!< Queue of demodulated samples */
|
||||||
} fsk_data;
|
} fsk_data;
|
||||||
|
|
||||||
/* \brief Retrieve a serial byte into outbyte.
|
/* \brief Retrieve a serial byte into outbyte.
|
||||||
|
@@ -26,8 +26,6 @@
|
|||||||
*
|
*
|
||||||
* \arg Includes code and algorithms from the Zapata library.
|
* \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"
|
#include "asterisk.h"
|
||||||
@@ -59,12 +57,13 @@ static inline float get_sample(short **buffer, int *len)
|
|||||||
|
|
||||||
#define GET_SAMPLE get_sample(&buffer, len)
|
#define GET_SAMPLE get_sample(&buffer, len)
|
||||||
|
|
||||||
/* Coeficientes para filtros de entrada */
|
/*! \brief Coefficients for input filters
|
||||||
/* Tabla de coeficientes, generada a partir del programa "mkfilter" */
|
* Coefficients table, generated by program "mkfilter"
|
||||||
/* Formato: coef[IDX_FREC][IDX_BW][IDX_COEF] */
|
* mkfilter is part of the zapatatelephony.org distribution
|
||||||
/* IDX_COEF = 0 => 1/GAIN */
|
* Format: coef[IDX_FREC][IDX_BW][IDX_COEF]
|
||||||
/* IDX_COEF = 1-6 => Coeficientes y[n] */
|
* IDX_COEF = 0 => 1/GAIN
|
||||||
|
* IDX_COEF = 1-6 => Coefficientes y[n]
|
||||||
|
*/
|
||||||
static double coef_in[NF][NBW][8] = {
|
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, },
|
{ 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 */
|
/*! \brief Coefficients for output filter
|
||||||
/* Tabla de coeficientes, generada a partir del programa "mkfilter" */
|
* Coefficients table, generated by program "mkfilter"
|
||||||
/* Formato: coef[IDX_BW][IDX_COEF] */
|
* Format: coef[IDX_BW][IDX_COEF]
|
||||||
/* IDX_COEF = 0 => 1/GAIN */
|
* 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] = {
|
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, },
|
{ 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, },
|
{ 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)
|
static inline float filtroM(fsk_data *fskd,float in)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
@@ -123,7 +122,7 @@ static inline float filtroM(fsk_data *fskd,float in)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Filtro pasa-banda para frecuencia de ESPACIO */
|
/*! Band-pass filter for SPACE frequency */
|
||||||
static inline float filtroS(fsk_data *fskd,float in)
|
static inline float filtroS(fsk_data *fskd,float in)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
@@ -142,7 +141,7 @@ static inline float filtroS(fsk_data *fskd,float in)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Filtro pasa-bajos para datos demodulados */
|
/*! Low-pass filter for demodulated data */
|
||||||
static inline float filtroL(fsk_data *fskd,float in)
|
static inline float filtroL(fsk_data *fskd,float in)
|
||||||
{
|
{
|
||||||
int i, j;
|
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)
|
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;
|
float x,spb,spb2,ds;
|
||||||
int f;
|
int f;
|
||||||
|
|
||||||
@@ -200,7 +199,7 @@ static int get_bit_raw(fsk_data *fskd, short *buffer, int *len)
|
|||||||
for (f = 0;;) {
|
for (f = 0;;) {
|
||||||
if (demodulador(fskd, &x, GET_SAMPLE))
|
if (demodulador(fskd, &x, GET_SAMPLE))
|
||||||
return -1;
|
return -1;
|
||||||
if ((x * fskd->x0) < 0) { /* Transicion */
|
if ((x * fskd->x0) < 0) { /* Transition */
|
||||||
if (!f) {
|
if (!f) {
|
||||||
if (fskd->cont<(spb2))
|
if (fskd->cont<(spb2))
|
||||||
fskd->cont += ds;
|
fskd->cont += ds;
|
||||||
@@ -236,7 +235,7 @@ int fsk_serie(fsk_data *fskd, short *buffer, int *len, int *outbyte)
|
|||||||
case STATE_GET_BYTE:
|
case STATE_GET_BYTE:
|
||||||
goto getbyte;
|
goto getbyte;
|
||||||
}
|
}
|
||||||
/* Esperamos bit de start */
|
/* We await for start bit */
|
||||||
do {
|
do {
|
||||||
/* this was jesus's nice, reasonable, working (at least with RTTY) code
|
/* 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
|
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
|
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
|
level to maybe, perhaps, guess, maybe that its maybe the beginning of
|
||||||
a start bit, perhaps. This whole thing stinks! */
|
a start bit, perhaps. This whole thing stinks! */
|
||||||
if (demodulador(fskd,&fskd->x1,GET_SAMPLE))
|
if (demodulador(fskd, &fskd->x1, GET_SAMPLE))
|
||||||
return -1;
|
return -1;
|
||||||
samples++;
|
samples++;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
@@ -264,7 +263,7 @@ search_startbit2:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
samples++;
|
samples++;
|
||||||
if (demodulador(fskd,&fskd->x2,GET_SAMPLE))
|
if (demodulador(fskd, &fskd->x2, GET_SAMPLE))
|
||||||
return(-1);
|
return(-1);
|
||||||
#if 0
|
#if 0
|
||||||
printf("x2 = %5.5f ", fskd->x2);
|
printf("x2 = %5.5f ", fskd->x2);
|
||||||
@@ -273,14 +272,14 @@ search_startbit2:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
search_startbit3:
|
search_startbit3:
|
||||||
/* Esperamos 0.5 bits antes de usar DPLL */
|
/* We await for 0.5 bits before using DPLL */
|
||||||
i = fskd->spb/2;
|
i = fskd->spb/2;
|
||||||
if (*len < i) {
|
if (*len < i) {
|
||||||
fskd->state = STATE_SEARCH_STARTBIT3;
|
fskd->state = STATE_SEARCH_STARTBIT3;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
for(;i;i--) {
|
for(;i;i--) {
|
||||||
if (demodulador(fskd,&fskd->x1,GET_SAMPLE))
|
if (demodulador(fskd, &fskd->x1, GET_SAMPLE))
|
||||||
return(-1);
|
return(-1);
|
||||||
#if 0
|
#if 0
|
||||||
printf("x1 = %5.5f ", fskd->x1);
|
printf("x1 = %5.5f ", fskd->x1);
|
||||||
@@ -288,7 +287,7 @@ search_startbit3:
|
|||||||
samples++;
|
samples++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* x1 debe ser negativo (confirmaci<EFBFBD>n del bit de start) */
|
/* x1 must be negative (start bit confirmation) */
|
||||||
|
|
||||||
} while (fskd->x1 > 0);
|
} while (fskd->x1 > 0);
|
||||||
fskd->state = STATE_GET_BYTE;
|
fskd->state = STATE_GET_BYTE;
|
||||||
@@ -304,7 +303,7 @@ getbyte:
|
|||||||
if (*len < 80)
|
if (*len < 80)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* Leemos ahora los bits de datos */
|
/* Now we read the data bits */
|
||||||
j = fskd->nbit;
|
j = fskd->nbit;
|
||||||
for (a = n1 = 0; j; j--) {
|
for (a = n1 = 0; j; j--) {
|
||||||
olen = *len;
|
olen = *len;
|
||||||
@@ -320,7 +319,7 @@ getbyte:
|
|||||||
j = 8-fskd->nbit;
|
j = 8-fskd->nbit;
|
||||||
a >>= j;
|
a >>= j;
|
||||||
|
|
||||||
/* Leemos bit de paridad (si existe) y la comprobamos */
|
/* We read parity bit (if exists) and check parity */
|
||||||
if (fskd->paridad) {
|
if (fskd->paridad) {
|
||||||
olen = *len;
|
olen = *len;
|
||||||
i = get_bit_raw(fskd, buffer, len);
|
i = get_bit_raw(fskd, buffer, len);
|
||||||
@@ -329,16 +328,16 @@ getbyte:
|
|||||||
return(-1);
|
return(-1);
|
||||||
if (i)
|
if (i)
|
||||||
n1++;
|
n1++;
|
||||||
if (fskd->paridad == 1) { /* paridad = 1 (par) */
|
if (fskd->paridad == 1) { /* parity=1 (even) */
|
||||||
if (n1&1)
|
if (n1&1)
|
||||||
a |= 0x100; /* error */
|
a |= 0x100; /* error */
|
||||||
} else { /* paridad = 2 (impar) */
|
} else { /* parity=2 (odd) */
|
||||||
if (!(n1&1))
|
if (!(n1&1))
|
||||||
a |= 0x100; /* error */
|
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--) {
|
for (j = fskd->nstop;j;j--) {
|
||||||
r = get_bit_raw(fskd, buffer, len);
|
r = get_bit_raw(fskd, buffer, len);
|
||||||
@@ -348,9 +347,9 @@ getbyte:
|
|||||||
a |= 0x200;
|
a |= 0x200;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Por fin retornamos */
|
/* And finally we return */
|
||||||
/* Bit 8 : Error de paridad */
|
/* Bit 8 : Parity error */
|
||||||
/* Bit 9 : Error de Framming */
|
/* Bit 9 : Framming error*/
|
||||||
|
|
||||||
*outbyte = a;
|
*outbyte = a;
|
||||||
fskd->state = STATE_SEARCH_STARTBIT;
|
fskd->state = STATE_SEARCH_STARTBIT;
|
||||||
|
Reference in New Issue
Block a user