mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-17 01:02:12 +00:00
update
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@210 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
9923827d1e
commit
42c70840d8
@ -306,7 +306,39 @@ dsp_fsk_sample (dsp_fsk_handle_t *handle, double normalized_sample)
|
|||||||
|
|
||||||
if (handle->cellpos > 1.0) {
|
if (handle->cellpos > 1.0) {
|
||||||
handle->cellpos -= 1.0;
|
handle->cellpos -= 1.0;
|
||||||
(*handle->attr.bithandler) (handle->attr.bithandler_arg, handle->current_bit);
|
|
||||||
|
|
||||||
|
switch (handle->state) {
|
||||||
|
case FSK_STATE_DATA:
|
||||||
|
(*handle->attr.bithandler) (handle->attr.bithandler_arg, handle->current_bit);
|
||||||
|
break;
|
||||||
|
case FSK_STATE_CHANSEIZE:
|
||||||
|
if (handle->last_bit != handle->current_bit) {
|
||||||
|
|
||||||
|
|
||||||
|
handle->conscutive_state_bits++;
|
||||||
|
} else {
|
||||||
|
handle->conscutive_state_bits = 0;
|
||||||
|
}
|
||||||
|
if (handle->conscutive_state_bits > 15) {
|
||||||
|
handle->state = FSK_STATE_CARRIERSIG;
|
||||||
|
handle->conscutive_state_bits = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case FSK_STATE_CARRIERSIG:
|
||||||
|
if (handle->current_bit) {
|
||||||
|
handle->conscutive_state_bits++;
|
||||||
|
} else {
|
||||||
|
handle->conscutive_state_bits = 0;
|
||||||
|
}
|
||||||
|
if (handle->conscutive_state_bits > 15) {
|
||||||
|
handle->state = FSK_STATE_DATA;
|
||||||
|
handle->conscutive_state_bits = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
handle->last_bit = handle->current_bit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,12 @@
|
|||||||
#define __FSK_H__
|
#define __FSK_H__
|
||||||
#include "uart.h"
|
#include "uart.h"
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
FSK_STATE_CHANSEIZE = 0,
|
||||||
|
FSK_STATE_CARRIERSIG,
|
||||||
|
FSK_STATE_DATA
|
||||||
|
} fsk_state_t;
|
||||||
|
|
||||||
typedef struct dsp_fsk_attr_s
|
typedef struct dsp_fsk_attr_s
|
||||||
{
|
{
|
||||||
int sample_rate; /* sample rate in HZ */
|
int sample_rate; /* sample rate in HZ */
|
||||||
@ -46,7 +52,8 @@ typedef struct dsp_fsk_attr_s
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
dsp_fsk_attr_t attr; /* attributes structure */
|
fsk_state_t state;
|
||||||
|
dsp_fsk_attr_t attr; /* attributes structure */
|
||||||
double *correlates[4]; /* one for each of sin/cos for mark/space */
|
double *correlates[4]; /* one for each of sin/cos for mark/space */
|
||||||
int corrsize; /* correlate size (also number of samples in ring buffer) */
|
int corrsize; /* correlate size (also number of samples in ring buffer) */
|
||||||
double *buffer; /* sample ring buffer */
|
double *buffer; /* sample ring buffer */
|
||||||
@ -55,8 +62,10 @@ typedef struct
|
|||||||
double celladj; /* bit cell adjustment for each sample */
|
double celladj; /* bit cell adjustment for each sample */
|
||||||
int previous_bit; /* previous bit (for detecting a transition to sync-up cell position) */
|
int previous_bit; /* previous bit (for detecting a transition to sync-up cell position) */
|
||||||
int current_bit; /* current bit */
|
int current_bit; /* current bit */
|
||||||
|
int last_bit;
|
||||||
int downsampling_count; /* number of samples to skip */
|
int downsampling_count; /* number of samples to skip */
|
||||||
int current_downsample; /* current skip count */
|
int current_downsample; /* current skip count */
|
||||||
|
int conscutive_state_bits; /* number of bits in a row that matches the pattern for the current state */
|
||||||
} dsp_fsk_handle_t;
|
} dsp_fsk_handle_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user