/* * Implementation of the V34 phase 2 * * Copyright (c) 1999,2000 Fabrice Bellard. * * This code is released under the GNU General Public License version * 2. Please read the file COPYING to know the exact terms of the * license. * * This implementation is totally clean room. It was written by * reading the V34 specification and by using basic signal processing * knowledge. */ #include "lm.h" #include "v34priv.h" #define DEBUG #define INFO_SYNC 0x72 /* send the v34 info0 sequence */ void V34_send_info0(V34State *s, int ack) { u8 buf[48], *p, *q; int crc; p = buf; put_bits(&p, 4, 0xf); /* fill bits */ put_bits(&p, 8, INFO_SYNC); /* sync word */ put_bits(&p, 1, 1); /* symbol rate 2743 supported ? */ put_bits(&p, 1, 1); /* symbol rate 2800 supported ? */ put_bits(&p, 1, 1); /* symbol rate 3429 supported ? */ put_bits(&p, 1, 1); /* symbol rate 3000, low carrier supported ? */ put_bits(&p, 1, 1); /* symbol rate 3000, high carrier supported ? */ put_bits(&p, 1, 1); /* symbol rate 3200, low carrier supported ? */ put_bits(&p, 1, 1); /* symbol rate 3200, high carrier supported ? */ put_bits(&p, 1, 1); /* symbol rate 3429 disallowed ? */ put_bits(&p, 1, 1); /* can power reduce ? */ put_bits(&p, 3, 5); /* difference between emit & receive sym rate */ put_bits(&p, 1, 0); /* from CME modem ? */ put_bits(&p, 1, 0); /* reserved by ITU */ put_bits(&p, 2, 0); /* tx clock source: 0=internal */ put_bits(&p, 1, ack); /* ack reception */ /* crc */ crc = calc_crc(buf + 12, p - (buf + 12)); put_bits(&p, 16, crc); put_bits(&p, 4, 0xf); /* fill bits */ for(q=buf;qcal (XXX : 3200) */ put_bits(&p, 3, 4); /* sym rate cal->ans (XXX : 3200) */ put_bits(&p, 10, 0); /* frequency offset (XXX) */ /* crc */ crc = calc_crc(buf + 12, p - (buf + 12)); put_bits(&p, 16, crc); put_bits(&p, 4, 0xf); /* fill bits */ } void V34_send_L1(V34State *s, int rep) { static char ph[25] = { /* 150 */ 1,-1, 1, 1, /* 750 */ 1, 0, 1, 0, /*1350 */ 1, 1,-1, 0, /*1950 */ 1, 1,-1, 0, /*2550 */ 1,-1, 1,-1, /*3150 */ -1,-1,-1, 1, /*3750 */ 1 }; for(n=0;nstate) { case V34_P2_INFO0_SEND: V34_send_info0( } /* demodulation */ switch(s->state) { case V34_P2_INFO0_SEND: } }