Ejemplo n.º 1
0
static void v29_rx_status(void *user_data, int status)
{
    v29_rx_state_t *s;
    int i;
    int len;
#if defined(SPANDSP_USE_FIXED_POINT)
    complexi16_t *coeffs;
#else
    complexf_t *coeffs;
#endif

    printf("V.29 rx status is %s (%d)\n", signal_status_to_str(status), status);
    s = (v29_rx_state_t *) user_data;
    switch (status)
    {
    case SIG_STATUS_TRAINING_SUCCEEDED:
        printf("Training succeeded\n");
        if ((len = v29_rx_equalizer_state(s, &coeffs)))
        {
            printf("Equalizer:\n");
            for (i = 0;  i < len;  i++)
#if defined(SPANDSP_USE_FIXED_POINT)
                printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/V29_CONSTELLATION_SCALING_FACTOR, coeffs[i].im/V29_CONSTELLATION_SCALING_FACTOR);
#else
                printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
#endif
        }
        break;
    }
}
Ejemplo n.º 2
0
static void v17_rx_status(void *user_data, int status)
{
    v17_rx_state_t *s;
    int i;
    int len;
#if defined(SPANDSP_USE_FIXED_POINT)
    complexi16_t *coeffs;
#else
    complexf_t *coeffs;
#endif

    printf("V.17 rx status is %s (%d)\n", signal_status_to_str(status), status);
    s = (v17_rx_state_t *) user_data;
    switch (status)
    {
    case SIG_STATUS_TRAINING_SUCCEEDED:
        len = v17_rx_equalizer_state(s, &coeffs);
        printf("Equalizer:\n");
        for (i = 0;  i < len;  i++)
#if defined(SPANDSP_USE_FIXED_POINT)
            printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/4096.0f, coeffs[i].im/4096.0f);
#else
            printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
#endif
        break;
    }
}
Ejemplo n.º 3
0
static void v22bis_rx_status(void *user_data, int status)
{
    endpoint_t *s;
    int bit_rate;
    int i;
    int len;
#if defined(SPANDSP_USE_FIXED_POINT)
    complexi16_t *coeffs;
#else
    complexf_t *coeffs;
#endif

    /* Special conditions */
    s = (endpoint_t *) user_data;
    printf("V.22bis rx %p status is %s (%d)\n", user_data, signal_status_to_str(status), status);
    switch (status)
    {
    case SIG_STATUS_TRAINING_SUCCEEDED:
        bit_rate = v22bis_get_current_bit_rate(s->v22bis);
        printf("Negotiated bit rate: %d\n", bit_rate);
        if ((len = v22bis_rx_equalizer_state(s->v22bis, &coeffs)))
        {
            printf("Equalizer:\n");
            for (i = 0;  i < len;  i++)
#if defined(SPANDSP_USE_FIXED_POINT)
                printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/V22BIS_CONSTELLATION_SCALING_FACTOR, coeffs[i].im/V22BIS_CONSTELLATION_SCALING_FACTOR);
#else
                printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
#endif
        }
        break;
    }
}
Ejemplo n.º 4
0
static void v27ter_put_bit(void *user_data, int bit)
{
    if (bit < 0)
    {
        /* Special conditions */
        fprintf(stderr, "V.27ter rx status is %s (%d)\n", signal_status_to_str(bit), bit);
        switch (bit)
        {
        case SIG_STATUS_TRAINING_SUCCEEDED:
            fast_trained = FAX_V27TER_RX;
            t4_begin();
            break;
        case SIG_STATUS_CARRIER_DOWN:
            t4_end();
            if (fast_trained == FAX_V27TER_RX)
                fast_trained = FAX_NONE;
            break;
        }
        return;
    }
    if (error_correcting_mode)
    {
        hdlc_rx_put_bit(&hdlcrx, bit);
    }
    else
    {
        if (t4_rx_put_bit(&t4_rx_state, bit))
        {
            t4_end();
            fprintf(stderr, "End of page detected\n");
        }
    }
    //printf("V.27ter Rx bit %d - %d\n", rx_bits++, bit);
}
Ejemplo n.º 5
0
static void v42_status(void *user_data, int status)
{
    v42_state_t *s;

    s = (v42_state_t *) user_data;
    if (status < 0)
        printf("%p: Status is '%s' (%d)\n", s, signal_status_to_str(status), status);
    else
        printf("%p: Status is '%s' (%d)\n", s, lapm_status_to_str(status), status);
}
Ejemplo n.º 6
0
static void cutoff_test_rx_status(void *user_data, int status)
{
    printf("FSK rx status is %s (%d)\n", signal_status_to_str(status), status);
    switch (status)
    {
    case SIG_STATUS_CARRIER_UP:
        cutoff_test_carrier = TRUE;
        break;
    case SIG_STATUS_CARRIER_DOWN:
        cutoff_test_carrier = FALSE;
        break;
    }
}
Ejemplo n.º 7
0
static void hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok)
{
    int type;
    int frame_no;
    int i;

    if (len < 0)
    {
        /* Special conditions */
        fprintf(stderr, "HDLC status is %s (%d)\n", signal_status_to_str(len), len);
        return;
    }

    if (ok)
    {
        if (msg[0] != 0xFF  ||  !(msg[1] == 0x03  ||  msg[1] == 0x13))
        {
            fprintf(stderr, "Bad frame header - %02x %02x\n", msg[0], msg[1]);
            return;
        }
        print_frame("HDLC: ", msg, len);
        type = msg[2] & 0xFE;
        switch (type)
        {
        case T4_FCD:
            if (len <= 4 + 256)
            {
                frame_no = msg[3];
                /* Just store the actual image data, and record its length */
                memcpy(&ecm_data[frame_no][0], &msg[4], len - 4);
                ecm_len[frame_no] = (int16_t) (len - 4);
            }
            break;
        case T30_DCS:
            check_rx_dcs(msg, len);
            break;
        }
    }
    else
    {
        fprintf(stderr, "Bad HDLC frame ");
        for (i = 0;  i < len;  i++)
            fprintf(stderr, " %02x", msg[i]);
        fprintf(stderr, "\n");
    }
}
Ejemplo n.º 8
0
static void v21_put_bit(void *user_data, int bit)
{
    if (bit < 0)
    {
        /* Special conditions */
        fprintf(stderr, "V.21 rx status is %s (%d)\n", signal_status_to_str(bit), bit);
        switch (bit)
        {
        case SIG_STATUS_CARRIER_DOWN:
            //t4_end();
            break;
        }
        return;
    }
    if (fast_trained == FAX_NONE)
        hdlc_rx_put_bit(&hdlcrx, bit);
    //printf("V.21 Rx bit %d - %d\n", rx_bits++, bit);
}
Ejemplo n.º 9
0
static void v17_rx_status(void *user_data, int status)
{
    v17_rx_state_t *rx;
    int i;
    int len;
    complexf_t *coeffs;
    
    printf("V.17 rx status is %s (%d)\n", signal_status_to_str(status), status);
    rx = (v17_rx_state_t *) user_data;
    switch (status)
    {
    case SIG_STATUS_TRAINING_SUCCEEDED:
        len = v17_rx_equalizer_state(rx, &coeffs);
        printf("Equalizer:\n");
        for (i = 0;  i < len;  i++)
            printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
        break;
    }
}
Ejemplo n.º 10
0
static void frame_handler(void *user_data, const uint8_t *pkt, int len, int ok)
{
    if (len < 0)
    {
        /* Special conditions */
        printf("HDLC rx status is %s (%d)\n", signal_status_to_str(len), len);
        switch (len)
        {
        case SIG_STATUS_FRAMING_OK:
            framing_ok_reported = TRUE;
            framing_ok_reports++;
            break;
        case SIG_STATUS_ABORT:
            abort_reported = TRUE;
            break;
        }
        return;
    }
    if (ok)
    {
        if (len != ref_len)
        {
            printf("Len error - %d %d\n", len, ref_len);
            frame_len_errors++;
            return;
        }
        if (memcmp(pkt, buf, len))
        {
            printf("Frame data error\n");
            frame_data_errors++;
            return;
        }
        frame_handled = TRUE;
    }
    else
    {
        frame_failed = TRUE;
    }
}
Ejemplo n.º 11
0
static void decode_handler(void *user_data, const uint8_t *pkt, int len, int ok)
{
    int i;

    if (len < 0)
    {
        /* Special conditions */
        printf("HDLC rx status is %s (%d)\n", signal_status_to_str(len), len);
        return;
    }
    if (ok)
    {
        printf("Good frame, len = %d\n", len);
        printf("HDLC:  ");
        for (i = 0;  i < len;  i++)
            printf("%02X ", pkt[i]);
        printf("\n");
    }
    else
    {
        printf("Bad frame, len = %d\n", len);
    }
}
Ejemplo n.º 12
0
static void v17_tx_status(void *user_data, int status)
{
    printf("V.17 tx status is %s (%d)\n", signal_status_to_str(status), status);
}
Ejemplo n.º 13
0
static void rx_status(void *user_data, int status)
{
    printf("FSK rx status is %s (%d)\n", signal_status_to_str(status), status);
}
Ejemplo n.º 14
0
static void v27ter_rx_status(void *user_data, int status)
{
    printf("V.27ter rx status is %s (%d)\n", signal_status_to_str(status), status);
}