Transmit of SYNC bits working. Very dirty state

This commit is contained in:
Ed Gonzalez 2015-06-17 18:04:43 -05:00
parent 13d4d64014
commit fe678569b4
5 changed files with 154 additions and 48 deletions

View file

@ -711,6 +711,14 @@ BOOL dstar_stateMachine(DSTAR_MACHINE machine, BOOL in_bit, unsigned char * ambe
return have_audio_packet;
}
void dstar_pfcsUpdateBuffer(DSTAR_PFCS pfcs, unsigned char * bytes, uint32 length)
{
uint32 i = 0;
for ( i = 0 ; i < length ; i++ ) {
pfcs->crc16 = (uint16)(pfcs->crc8[1]) ^ ccittTab[pfcs->crc8[0] ^ bytes[i]];
}
}
void dstar_pfcsUpdate(DSTAR_PFCS pfcs, BOOL * bits )
{
unsigned char byte;
@ -719,7 +727,16 @@ void dstar_pfcsUpdate(DSTAR_PFCS pfcs, BOOL * bits )
pfcs->crc16 = (uint16)pfcs->crc8[1] ^ ccittTab[ pfcs->crc8[0] ^ byte ];
}
void dstar_pfcsResult( DSTAR_PFCS pfcs, BOOL * bits )
void dstar_pfcsResult( DSTAR_PFCS pfcs, unsigned char * chksum )
{
pfcs->crc16 = ~ pfcs->crc16;
chksum[0] = pfcs->crc8[0];
chksum[1] = pfcs->crc8[1];
}
void dstar_pfcsResultBits( DSTAR_PFCS pfcs, BOOL * bits )
{
pfcs->crc16 = ~pfcs->crc16;
@ -739,7 +756,7 @@ BOOL dstar_pfcsCheck(DSTAR_PFCS pfcs, BOOL * bits )
{
uint32 i = 0;
BOOL sum[16];
dstar_pfcsResult(pfcs, sum);
dstar_pfcsResultBits(pfcs, sum);
for ( i = 0 ; i < 16 ; i++ ) {
if ( sum[i] != bits[i] ) {

View file

@ -98,10 +98,14 @@ BOOL dstar_stateMachine(DSTAR_MACHINE machine, BOOL in_bit, unsigned char * ambe
void dstar_pfcsUpdate(DSTAR_PFCS pfcs, BOOL * bits );
BOOL dstar_pfcsCheck(DSTAR_PFCS pfcs, BOOL * bits );
void dstar_pfcsResult(DSTAR_PFCS pfcs, unsigned char * chksum);
void dstar_pfcsResultBits( DSTAR_PFCS pfcs, BOOL * bits );
void dstar_pfcsUpdateBuffer(DSTAR_PFCS pfcs, unsigned char * bytes, uint32 length);
void dstar_FECTest(void);
void dstar_scramble(BOOL * in, BOOL * out, uint32 length, uint32 * scramble_count);
void dstar_interleave(const BOOL * in, BOOL * out, unsigned int length);
void dstar_deinterleave(const BOOL * in, BOOL * out, unsigned int length);
BOOL dstar_FECdecode(DSTAR_FEC fec, const BOOL * in, BOOL * out, unsigned int inLen, unsigned int * outLen);
void dstar_FECencode(const BOOL * in, BOOL * out, unsigned int inLen, unsigned int * outLen);
#endif /* THUMBDV_DSTAR_H_ */

View file

@ -95,20 +95,20 @@ void gmsk_bytesToBits(unsigned char * bytes, BOOL * bits, uint32 num_bits)
byte_idx++;
bits_left -= 8;
}
uint32 i = 0;
output("Bytes: ");
for ( i = 0 ; i < num_bits / 8U ; i++ ) {
output(" 0x%02X", bytes[i]);
}
output("\nBits: ");
for ( i = 0 ; i < num_bits ; i++ ) {
output("%s ", bits[i] ? "1":"0");
if ( (i+1) % 4 == 0 ) {
output(" ");
}
}
output("\n");
//
// uint32 i = 0;
// output("Bytes: ");
// for ( i = 0 ; i < num_bits / 8U ; i++ ) {
// output(" 0x%02X", bytes[i]);
// }
// output("\nBits: ");
// for ( i = 0 ; i < num_bits ; i++ ) {
// output("%s ", bits[i] ? "1":"0");
// if ( (i+1) % 4 == 0 ) {
// output(" ");
// }
// }
// output("\n");
}
@ -307,9 +307,9 @@ uint32 gmsk_encode(GMSK_MOD mod, BOOL bit, float * buffer, unsigned int length)
for (i = 0; i < DSTAR_RADIO_BIT_LENGTH; i++) {
if (bit) {
buffer[i] = gmsk_FilterProcessSingle(mod->filter, -0.5f);
buffer[i] = gmsk_FilterProcessSingle(mod->filter, -1.0f);
} else {
buffer[i] = gmsk_FilterProcessSingle(mod->filter, 0.5f);
buffer[i] = gmsk_FilterProcessSingle(mod->filter, 1.0f);
}
}

View file

@ -387,7 +387,7 @@ int thumbDV_processSerial(int serial_fd)
} else if ( packet_type == AMBE3000_CHAN_PKT_TYPE ) {
desc = hal_BufferRequest(respLen, sizeof(unsigned char) );
memcpy(desc->buf_ptr, buffer, respLen);
thumbDV_dump(ANSI_BLUE "Coded Packet" ANSI_WHITE, buffer, respLen);
//thumbDV_dump(ANSI_BLUE "Coded Packet" ANSI_WHITE, buffer, respLen);
/* Encoded data */
_thumbDVEncodedList_LinkTail(desc);
} else if ( packet_type == AMBE3000_SPEECH_PKT_TYPE ) {