This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Defines | |
| #define | NCOLA 0x4000 |
| #define | PARITY_EVEN 1 |
| #define | PARITY_NONE 0 |
| #define | PARITY_ODD 2 |
Functions | |
| int | fsk_serie (fsk_data *fskd, short *buffer, int *len, int *outbyte) |
Definition in file fskmodem.h.
|
|
Definition at line 33 of file fskmodem.h. Referenced by filtroL(). |
|
|
Definition at line 29 of file fskmodem.h. |
|
|
Definition at line 28 of file fskmodem.h. |
|
|
Definition at line 30 of file fskmodem.h. |
|
||||||||||||||||||||
|
Definition at line 201 of file fskmodem.c. References demodulador(), GET_SAMPLE, and STATE_SEARCH_STARTBIT2. Referenced by callerid_feed(), and tdd_feed(). 00205 {
00206 if (demodulador(zap,&x2)) return(-1);
00207 if (x1>0 && x2<0) break;
00208 x1=x2;
00209 }
00210 */
00211 /* this is now the imprecise, losing, but functional code to detect the
00212 beginning of a start bit in the TDD sceanario. It just looks for sufficient
00213 level to maybe, perhaps, guess, maybe that its maybe the beginning of
00214 a start bit, perhaps. This whole thing stinks! */
00215 if (demodulador(fskd,&fskd->x1,GET_SAMPLE)) return(-1);
00216 samples++;
00217 for(;;)
00218 {
00219 search_startbit2:
00220 if (!*len) {
00221 fskd->state = STATE_SEARCH_STARTBIT2;
00222 return 0;
00223 }
00224 samples++;
00225 if (demodulador(fskd,&fskd->x2,GET_SAMPLE)) return(-1);
00226 #if 0
00227 printf("x2 = %5.5f ", fskd->x2);
00228 #endif
00229 if (fskd->x2 < -0.5) break;
00230 }
00231 search_startbit3:
00232 /* Esperamos 0.5 bits antes de usar DPLL */
00233 i=fskd->spb/2;
00234 if (*len < i) {
00235 fskd->state = STATE_SEARCH_STARTBIT3;
00236 return 0;
00237 }
00238 for(;i;i--) { if (demodulador(fskd,&fskd->x1,GET_SAMPLE)) return(-1);
00239 #if 0
00240 printf("x1 = %5.5f ", fskd->x1);
00241 #endif
00242 samples++; }
00243
00244 /* x1 debe ser negativo (confirmación del bit de start) */
00245
00246 } while (fskd->x1>0);
00247 fskd->state = STATE_GET_BYTE;
00248
00249 getbyte:
00250
00251 /* Need at least 80 samples (for 1200) or
00252 1320 (for 45.5) to be sure we'll have a byte */
00253 if (fskd->nbit < 8) {
00254 if (*len < 1320)
00255 return 0;
00256 } else {
00257 if (*len < 80)
00258 return 0;
00259 }
00260 /* Leemos ahora los bits de datos */
00261 j=fskd->nbit;
00262 for (a=n1=0;j;j--) {
00263 olen = *len;
00264 i=get_bit_raw(fskd, buffer, len);
00265 buffer += (olen - *len);
00266 if (i == -1) return(-1);
00267 if (i) n1++;
00268 a>>=1; a|=i;
00269 }
00270 j=8-fskd->nbit;
00271 a>>=j;
00272
00273 /* Leemos bit de paridad (si existe) y la comprobamos */
00274 if (fskd->paridad) {
00275 olen = *len;
00276 i=get_bit_raw(fskd, buffer, len);
00277 buffer += (olen - *len);
00278 if (i == -1) return(-1);
00279 if (i) n1++;
00280 if (fskd->paridad==1) { /* paridad=1 (par) */
00281 if (n1&1) a|=0x100; /* error */
00282 } else { /* paridad=2 (impar) */
00283 if (!(n1&1)) a|=0x100; /* error */
00284 }
00285 }
00286
00287 /* Leemos bits de STOP. Todos deben ser 1 */
00288
00289 for (j=fskd->nstop;j;j--) {
00290 r = get_bit_raw(fskd, buffer, len);
00291 if (r == -1) return(-1);
00292 if (!r) a|=0x200;
00293 }
00294
00295 /* Por fin retornamos */
00296 /* Bit 8 : Error de paridad */
00297 /* Bit 9 : Error de Framming */
00298
00299 *outbyte = a;
00300 fskd->state = STATE_SEARCH_STARTBIT;
00301 return 1;
00302 }
00303 }
|
1.4.2