aboutsummaryrefslogtreecommitdiffstats
path: root/src/amps
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2016-12-09 16:34:33 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2016-12-09 16:34:33 +0100
commit7585f9c22dd0dffdaac8b57b1e370fa901a20df4 (patch)
tree04261045ffd0f7839a6ffc771c1ffc6669e2b6c6 /src/amps
parentf111c50478bc05274b551e243898861cef14f436 (diff)
Add function to change dsp state, more debug with channel info
Diffstat (limited to 'src/amps')
-rw-r--r--src/amps/amps.c80
-rw-r--r--src/amps/dsp.c4
-rw-r--r--src/amps/frame.c36
3 files changed, 62 insertions, 58 deletions
diff --git a/src/amps/amps.c b/src/amps/amps.c
index f330f2f..04b47db 100644
--- a/src/amps/amps.c
+++ b/src/amps/amps.c
@@ -35,6 +35,8 @@
* are processed.
*/
+#define CHAN amps->sender.kanal
+
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
@@ -250,7 +252,7 @@ static void amps_new_state(amps_t *amps, enum amps_state new_state)
{
if (amps->state == new_state)
return;
- PDEBUG(DAMPS, DEBUG_DEBUG, "State change: %s -> %s\n", amps_state_name(amps->state), amps_state_name(new_state));
+ PDEBUG_CHAN(DAMPS, DEBUG_DEBUG, "State change: %s -> %s\n", amps_state_name(amps->state), amps_state_name(new_state));
amps->state = new_state;
}
@@ -522,14 +524,14 @@ static void amps_go_idle(amps_t *amps)
amps_new_state(amps, STATE_IDLE);
if (amps->chan_type != CHAN_TYPE_VC) {
- PDEBUG(DAMPS, DEBUG_INFO, "Entering IDLE state, sending Overhead/Filler frames on %s.\n", chan_type_long_name(amps->chan_type));
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Entering IDLE state, sending Overhead/Filler frames on %s.\n", chan_type_long_name(amps->chan_type));
if (amps->sender.loopback)
frame_length = 441; /* bits after sync (FOCC) */
else
frame_length = 247; /* bits after sync (RECC) */
amps_set_dsp_mode(amps, DSP_MODE_FRAME_RX_FRAME_TX, frame_length);
} else {
- PDEBUG(DAMPS, DEBUG_INFO, "Entering IDLE state, sending test tone on %s.\n", chan_type_long_name(amps->chan_type));
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Entering IDLE state, sending test tone on %s.\n", chan_type_long_name(amps->chan_type));
amps_set_dsp_mode(amps, DSP_MODE_OFF, 0);
}
}
@@ -564,14 +566,14 @@ void amps_rx_signaling_tone(amps_t *amps, int tone, double quality)
{
transaction_t *trans = amps->trans_list;
if (trans == NULL) {
- PDEBUG(DAMPS, DEBUG_ERROR, "Signaling Tone without transaction, please fix!\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_ERROR, "Signaling Tone without transaction, please fix!\n");
return;
}
if (tone)
- PDEBUG(DAMPS, DEBUG_INFO, "Detected Signaling Tone with quality=%.0f.\n", quality * 100.0);
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Detected Signaling Tone with quality=%.0f.\n", quality * 100.0);
else
- PDEBUG(DAMPS, DEBUG_INFO, "Lost Signaling Tone signal\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Lost Signaling Tone signal\n");
switch (trans->state) {
case TRANS_CALL:
@@ -606,7 +608,7 @@ void amps_rx_signaling_tone(amps_t *amps, int tone, double quality)
}
break;
default:
- PDEBUG(DAMPS, DEBUG_ERROR, "Signaling Tone without active call, please fix!\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_ERROR, "Signaling Tone without active call, please fix!\n");
}
}
@@ -614,7 +616,7 @@ void amps_rx_sat(amps_t *amps, int tone, double quality)
{
transaction_t *trans = amps->trans_list;
if (trans == NULL) {
- PDEBUG(DAMPS, DEBUG_ERROR, "SAT signal without transaction, please fix!\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_ERROR, "SAT signal without transaction, please fix!\n");
return;
}
/* irgnoring SAT loss on release */
@@ -624,7 +626,7 @@ void amps_rx_sat(amps_t *amps, int tone, double quality)
if (trans->state != TRANS_CALL
&& trans->state != TRANS_CALL_MT_ALERT
&& trans->state != TRANS_CALL_MT_ALERT_SEND) {
- PDEBUG(DAMPS, DEBUG_ERROR, "SAT signal without active call, please fix!\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_ERROR, "SAT signal without active call, please fix!\n");
return;
}
@@ -654,14 +656,14 @@ void amps_rx_sat(amps_t *amps, int tone, double quality)
static void timeout_sat(amps_t *amps, double duration)
{
if (!amps->trans_list) {
- PDEBUG(DAMPS, DEBUG_ERROR, "SAT timeout, but no transaction, please fix!\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_ERROR, "SAT timeout, but no transaction, please fix!\n");
return;
}
if (duration == SAT_TO1)
- PDEBUG(DAMPS, DEBUG_NOTICE, "Timeout after %.0f seconds not receiving SAT signal.\n", duration);
+ PDEBUG_CHAN(DAMPS, DEBUG_NOTICE, "Timeout after %.0f seconds not receiving SAT signal.\n", duration);
else
- PDEBUG(DAMPS, DEBUG_NOTICE, "Timeout after %.0f seconds loosing SAT signal.\n", duration);
- PDEBUG(DAMPS, DEBUG_INFO, "Release call towards network.\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_NOTICE, "Timeout after %.0f seconds loosing SAT signal.\n", duration);
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Release call towards network.\n");
amps_release(amps->trans_list, CAUSE_TEMPFAIL);
}
@@ -674,12 +676,12 @@ void amps_rx_recc(amps_t *amps, uint8_t scm, uint32_t esn, uint32_t min1, uint16
/* check if we are busy, so we ignore all signaling */
if (amps->state == STATE_BUSY) {
- PDEBUG(DAMPS, DEBUG_NOTICE, "Ignoring RECC messages from phone while using this channel for voice.\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_NOTICE, "Ignoring RECC messages from phone while using this channel for voice.\n");
return;
}
if (order == 13 && (ordq == 0 || ordq == 1 || ordq == 2 || ordq == 3) && msg_type == 0) {
- PDEBUG(DAMPS, DEBUG_INFO, "Registration %s (ESN = %08x, %s)\n", callerid, esn, amps_scm(scm));
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Registration %s (ESN = %08x, %s)\n", callerid, esn, amps_scm(scm));
trans = create_transaction(amps, TRANS_REGISTER_ACK, min1, min2, msg_type, ordq, order, 0);
if (!trans) {
PDEBUG(DAMPS, DEBUG_ERROR, "Failed to create transaction\n");
@@ -687,7 +689,7 @@ void amps_rx_recc(amps_t *amps, uint8_t scm, uint32_t esn, uint32_t min1, uint16
}
} else
if (order == 13 && ordq == 3 && msg_type == 1) {
- PDEBUG(DAMPS, DEBUG_INFO, "Registration - Power Down %s (ESN = %08x, %s)\n", callerid, esn, amps_scm(scm));
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Registration - Power Down %s (ESN = %08x, %s)\n", callerid, esn, amps_scm(scm));
trans = create_transaction(amps, TRANS_REGISTER_ACK, min1, min2, msg_type, ordq, order, 0);
if (!trans) {
PDEBUG(DAMPS, DEBUG_ERROR, "Failed to create transaction\n");
@@ -696,9 +698,9 @@ void amps_rx_recc(amps_t *amps, uint8_t scm, uint32_t esn, uint32_t min1, uint16
} else
if (order == 0 && ordq == 0 && msg_type == 0) {
if (!dialing)
- PDEBUG(DAMPS, DEBUG_INFO, "Paging reply %s (ESN = %08x, %s)\n", callerid, esn, amps_scm(scm));
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Paging reply %s (ESN = %08x, %s)\n", callerid, esn, amps_scm(scm));
else
- PDEBUG(DAMPS, DEBUG_INFO, "Call %s -> %s (ESN = %08x, %s)\n", callerid, dialing, esn, amps_scm(scm));
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Call %s -> %s (ESN = %08x, %s)\n", callerid, dialing, esn, amps_scm(scm));
trans = search_transaction_number(amps, min1, min2);
if (!trans && !dialing) {
PDEBUG(DAMPS, DEBUG_NOTICE, "Paging reply, but call is already gone, rejecting call\n");
@@ -737,7 +739,7 @@ reject:
trans->chan = vc->sender.kanal;
}
} else
- PDEBUG(DAMPS, DEBUG_NOTICE, "Unsupported RECC messages: ORDER: %d ORDQ: %d MSG TYPE: %d (See Table 4 of specs.)\n", order, ordq, msg_type);
+ PDEBUG_CHAN(DAMPS, DEBUG_NOTICE, "Unsupported RECC messages: ORDER: %d ORDQ: %d MSG TYPE: %d (See Table 4 of specs.)\n", order, ordq, msg_type);
}
/*
@@ -803,7 +805,7 @@ inval:
return -CAUSE_NOCHANNEL;
}
- PDEBUG(DAMPS, DEBUG_INFO, "Call to mobile station, paging station id '%s'\n", dialing);
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Call to mobile station, paging station id '%s'\n", dialing);
/* 6. trying to page mobile station */
trans = create_transaction(amps, TRANS_PAGE, min1, min2, 0, 0, 0, 0);
@@ -849,12 +851,12 @@ void call_out_disconnect(int callref, int cause)
case DSP_MODE_AUDIO_RX_FRAME_TX:
if (trans->state == TRANS_CALL_MT_ALERT
|| trans->state == TRANS_CALL_MT_ALERT_SEND) {
- PDEBUG(DAMPS, DEBUG_INFO, "Call control disconnect on voice channel while alerting, releasing towards mobile station.\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Call control disconnect on voice channel while alerting, releasing towards mobile station.\n");
amps_release(trans, cause);
}
return;
default:
- PDEBUG(DAMPS, DEBUG_INFO, "Call control disconnects on control channel, removing transaction.\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Call control disconnects on control channel, removing transaction.\n");
call_in_release(callref, cause);
trans->callref = 0;
destroy_transaction(trans);
@@ -889,11 +891,11 @@ void call_out_release(int callref, int cause)
switch (amps->dsp_mode) {
case DSP_MODE_AUDIO_RX_AUDIO_TX:
case DSP_MODE_AUDIO_RX_FRAME_TX:
- PDEBUG(DAMPS, DEBUG_INFO, "Call control releases on voice channel, releasing towards mobile station.\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Call control releases on voice channel, releasing towards mobile station.\n");
amps_release(trans, cause);
break;
default:
- PDEBUG(DAMPS, DEBUG_INFO, "Call control releases on control channel, removing transaction.\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Call control releases on control channel, removing transaction.\n");
destroy_transaction(trans);
amps_go_idle(amps);
}
@@ -933,7 +935,7 @@ void transaction_timeout(struct timer *timer)
break;
case TRANS_CALL_RELEASE:
case TRANS_CALL_RELEASE_SEND:
- PDEBUG(DAMPS, DEBUG_NOTICE, "Release timeout, destroying transaction\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_NOTICE, "Release timeout, destroying transaction\n");
destroy_transaction(trans);
amps_go_idle(amps);
break;
@@ -941,20 +943,20 @@ void transaction_timeout(struct timer *timer)
amps_release(trans, CAUSE_TEMPFAIL);
break;
case TRANS_CALL_MT_ALERT_SEND:
- PDEBUG(DAMPS, DEBUG_NOTICE, "Alerting timeout, destroying transaction\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_NOTICE, "Alerting timeout, destroying transaction\n");
amps_release(trans, CAUSE_NOANSWER);
break;
case TRANS_PAGE_REPLY:
if (trans->page_retry++ == PAGE_TRIES) {
- PDEBUG(DAMPS, DEBUG_NOTICE, "Paging timeout, destroying transaction\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_NOTICE, "Paging timeout, destroying transaction\n");
amps_release(trans, CAUSE_OUTOFORDER);
} else {
- PDEBUG(DAMPS, DEBUG_NOTICE, "Paging timeout, retrying\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_NOTICE, "Paging timeout, retrying\n");
trans_new_state(trans, TRANS_PAGE);
}
break;
default:
- PDEBUG(DAMPS, DEBUG_ERROR, "Timeout unhandled in state %d\n", trans->state);
+ PDEBUG_CHAN(DAMPS, DEBUG_ERROR, "Timeout unhandled in state %d\n", trans->state);
}
}
@@ -1012,39 +1014,39 @@ again:
switch (trans->state) {
case TRANS_REGISTER_ACK:
- PDEBUG(DAMPS, DEBUG_INFO, "Sending Register acknowledge\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Sending Register acknowledge\n");
trans_new_state(trans, TRANS_REGISTER_ACK_SEND);
return trans;
case TRANS_REGISTER_ACK_SEND:
destroy_transaction(trans);
goto again;
case TRANS_CALL_REJECT:
- PDEBUG(DAMPS, DEBUG_INFO, "Rejecting call from mobile station\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Rejecting call from mobile station\n");
trans_new_state(trans, TRANS_CALL_REJECT_SEND);
return trans;
case TRANS_CALL_REJECT_SEND:
destroy_transaction(trans);
goto again;
case TRANS_CALL_MO_ASSIGN:
- PDEBUG(DAMPS, DEBUG_INFO, "Assigning channel to call from mobile station\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Assigning channel to call from mobile station\n");
trans_new_state(trans, TRANS_CALL_MO_ASSIGN_SEND);
return trans;
case TRANS_CALL_MO_ASSIGN_SEND:
vc = assign_voice_channel(trans);
if (vc) {
- PDEBUG(DAMPS, DEBUG_INFO, "Assignment complete, voice connected\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Assignment complete, voice connected\n");
trans_new_state(trans, TRANS_CALL);
amps_set_dsp_mode(vc, DSP_MODE_AUDIO_RX_AUDIO_TX, 0);
}
return NULL;
case TRANS_CALL_MT_ASSIGN:
- PDEBUG(DAMPS, DEBUG_INFO, "Assigning channel to call to mobile station\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Assigning channel to call to mobile station\n");
trans_new_state(trans, TRANS_CALL_MT_ASSIGN_SEND);
return trans;
case TRANS_CALL_MT_ASSIGN_SEND:
vc = assign_voice_channel(trans);
if (vc) {
- PDEBUG(DAMPS, DEBUG_INFO, "Assignment complete, next: sending altering on VC\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Assignment complete, next: sending altering on VC\n");
trans->chan = 0;
trans->msg_type = 0;
trans->ordq = 0;
@@ -1054,7 +1056,7 @@ again:
}
return NULL;
case TRANS_PAGE:
- PDEBUG(DAMPS, DEBUG_INFO, "Paging the phone\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Paging the phone\n");
trans_new_state(trans, TRANS_PAGE_SEND);
return trans;
case TRANS_PAGE_SEND:
@@ -1077,16 +1079,16 @@ again:
switch (trans->state) {
case TRANS_CALL_RELEASE:
- PDEBUG(DAMPS, DEBUG_INFO, "Releasing call towards mobile station\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Releasing call towards mobile station\n");
trans_new_state(trans, TRANS_CALL_RELEASE_SEND);
return trans;
case TRANS_CALL_RELEASE_SEND:
- PDEBUG(DAMPS, DEBUG_INFO, "Release call was sent, destroying call\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Release call was sent, destroying call\n");
destroy_transaction(trans);
amps_go_idle(amps);
goto again;
case TRANS_CALL_MT_ALERT:
- PDEBUG(DAMPS, DEBUG_INFO, "Sending altering\n");
+ PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Sending altering\n");
return trans;
default:
return NULL;
diff --git a/src/amps/dsp.c b/src/amps/dsp.c
index 20fc9fd..ae8b27b 100644
--- a/src/amps/dsp.c
+++ b/src/amps/dsp.c
@@ -189,7 +189,7 @@ int dsp_init_sender(amps_t *amps, int high_pass, int tolerant)
/* attack (3ms) and recovery time (13.5ms) according to amps specs */
init_compandor(&amps->cstate, 8000, 3.0, 13.5, COMPANDOR_0DB);
- PDEBUG(DDSP, DEBUG_DEBUG, "Init DSP for transceiver.\n");
+ PDEBUG_CHAN(DDSP, DEBUG_DEBUG, "Init DSP for transceiver.\n");
if (amps->sender.samplerate < 96000) {
PDEBUG(DDSP, DEBUG_ERROR, "Sample rate must be at least 96000 Hz to process FSK and SAT signals.\n");
@@ -275,7 +275,7 @@ error:
/* Cleanup transceiver instance. */
void dsp_cleanup_sender(amps_t *amps)
{
- PDEBUG(DDSP, DEBUG_DEBUG, "Cleanup DSP for treansceiver.\n");
+ PDEBUG_CHAN(DDSP, DEBUG_DEBUG, "Cleanup DSP for treansceiver.\n");
if (amps->fsk_tx_buffer)
free(amps->fsk_tx_buffer);
diff --git a/src/amps/frame.c b/src/amps/frame.c
index f7ce9a5..6cf00bb 100644
--- a/src/amps/frame.c
+++ b/src/amps/frame.c
@@ -17,6 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#define CHAN amps->sender.kanal
+
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
@@ -3025,7 +3027,7 @@ static void amps_decode_word_focc(amps_t *amps, uint64_t word)
/* control message */
if (t1t2 != 3) {
- PDEBUG(DFRAME, DEBUG_INFO, "Received Mobile Station Control Message (T1T2 = %d)\n", t1t2);
+ PDEBUG_CHAN(DFRAME, DEBUG_INFO, "Received Mobile Station Control Message (T1T2 = %d)\n", t1t2);
if (t1t2 == 1)
amps->rx_focc_word_count = 1;
if (t1t2 == 0 || t1t2 == 1) {
@@ -3042,7 +3044,7 @@ static void amps_decode_word_focc(amps_t *amps, uint64_t word)
w = &word2_extended_address_word_b;
goto decode;
}
- PDEBUG(DFRAME, DEBUG_INFO, "Decoding of more than 2 Control messages not supported\n");
+ PDEBUG_CHAN(DFRAME, DEBUG_INFO, "Decoding of more than 2 Control messages not supported\n");
}
return;
}
@@ -3107,14 +3109,14 @@ static void amps_decode_word_focc(amps_t *amps, uint64_t word)
decode:
if (!w) {
- PDEBUG(DFRAME, DEBUG_INFO, "Received Illegal Overhead Message\n");
+ PDEBUG_CHAN(DFRAME, DEBUG_INFO, "Received Illegal Overhead Message\n");
return;
}
frame = amps_decode_word(word, w);
/* show control filler delay */
if (amps->sender.loopback && ohd == 1)
- PDEBUG(DDSP, DEBUG_NOTICE, "Round trip delay is %.3f seconds\n", amps->when_received - amps->when_transmitted[frame->ie[AMPS_IE_1111]]);
+ PDEBUG_CHAN(DDSP, DEBUG_NOTICE, "Round trip delay is %.3f seconds\n", amps->when_received - amps->when_transmitted[frame->ie[AMPS_IE_1111]]);
}
/* get word from data bits and call decoder function
@@ -3132,12 +3134,12 @@ static int amps_decode_word_recc(amps_t *amps, uint64_t word, int first)
memset(amps->rx_recc_dialing, 0, sizeof(amps->rx_recc_dialing));
amps->rx_recc_word_count = 0;
if (f == 0) {
- PDEBUG(DFRAME, DEBUG_NOTICE, "Received first word, but F bit is not set.\n");
+ PDEBUG_CHAN(DFRAME, DEBUG_NOTICE, "Received first word, but F bit is not set.\n");
return 0;
}
} else {
if (f == 1) {
- PDEBUG(DFRAME, DEBUG_NOTICE, "Received additional word, but F bit is set.\n");
+ PDEBUG_CHAN(DFRAME, DEBUG_NOTICE, "Received additional word, but F bit is set.\n");
return 0;
}
}
@@ -3145,7 +3147,7 @@ static int amps_decode_word_recc(amps_t *amps, uint64_t word, int first)
msg_count = amps->rx_recc_word_count;
if (msg_count == 8) {
- PDEBUG(DFRAME, DEBUG_NOTICE, "Received too many words.\n");
+ PDEBUG_CHAN(DFRAME, DEBUG_NOTICE, "Received too many words.\n");
return 0;
}
@@ -3184,7 +3186,7 @@ static int amps_decode_word_recc(amps_t *amps, uint64_t word, int first)
if (!w) {
- PDEBUG(DFRAME, DEBUG_INFO, "Received Illegal RECC Message\n");
+ PDEBUG_CHAN(DFRAME, DEBUG_INFO, "Received Illegal RECC Message\n");
goto done;
}
@@ -3529,19 +3531,19 @@ static void amps_decode_bits_focc(amps_t *amps, const char *bits)
else
idle = 0;
- PDEBUG(DFRAME, DEBUG_INFO, "RX FOCC: B/I = %s\n", (idle) ? "idle" : "busy");
+ PDEBUG_CHAN(DFRAME, DEBUG_INFO, "RX FOCC: B/I = %s\n", (idle) ? "idle" : "busy");
if (debuglevel == DEBUG_DEBUG) {
char text[64];
for (i = 0; i < 5; i++) {
strncpy(text, bits + i * 44, 44);
text[44] = '\0';
- PDEBUG(DFRAME, DEBUG_DEBUG, " word a - %s%s\n", text, (crc_a_ok[i % 5]) ? " ok" : " BAD CRC!");
+ PDEBUG_CHAN(DFRAME, DEBUG_DEBUG, " word a - %s%s\n", text, (crc_a_ok[i % 5]) ? " ok" : " BAD CRC!");
}
for (i = 5; i < 10; i++) {
strncpy(text, bits + i * 44, 44);
text[44] = '\0';
- PDEBUG(DFRAME, DEBUG_DEBUG, " word b - %s%s\n", text, (crc_b_ok[i % 5]) ? " ok" : " BAD CRC!");
+ PDEBUG_CHAN(DFRAME, DEBUG_DEBUG, " word b - %s%s\n", text, (crc_b_ok[i % 5]) ? " ok" : " BAD CRC!");
}
}
@@ -3617,7 +3619,7 @@ static int amps_decode_bits_recc(amps_t *amps, const char *bits, int first)
crc_ok++;
}
if (crc_ok) {
- PDEBUG(DFRAME, DEBUG_NOTICE, "Seems we RX FOCC frame due to loopback, ignoring!\n");
+ PDEBUG_CHAN(DFRAME, DEBUG_NOTICE, "Seems we RX FOCC frame due to loopback, ignoring!\n");
return 0;
}
bits_ -= 221;
@@ -3630,7 +3632,7 @@ static int amps_decode_bits_recc(amps_t *amps, const char *bits, int first)
if (first) {
if (debuglevel == DEBUG_DEBUG || crc_ok_count > 0) {
- PDEBUG(DFRAME, DEBUG_INFO, "RX RECC: DCC=%d (%d of 5 CRCs are ok)\n", dcc, crc_ok_count);
+ PDEBUG_CHAN(DFRAME, DEBUG_INFO, "RX RECC: DCC=%d (%d of 5 CRCs are ok)\n", dcc, crc_ok_count);
if (dcc != amps->si.dcc) {
PDEBUG(DFRAME, DEBUG_INFO, "received DCC=%d missmatches the base station's DCC=%d\n", dcc, amps->si.dcc);
return 0;
@@ -3638,7 +3640,7 @@ static int amps_decode_bits_recc(amps_t *amps, const char *bits, int first)
}
} else {
if (debuglevel == DEBUG_DEBUG || crc_ok_count > 0)
- PDEBUG(DFRAME, DEBUG_INFO, "RX RECC: (%d of 5 CRCs are ok)\n", crc_ok_count);
+ PDEBUG_CHAN(DFRAME, DEBUG_INFO, "RX RECC: (%d of 5 CRCs are ok)\n", crc_ok_count);
}
if (debuglevel == DEBUG_DEBUG) {
char text[64];
@@ -3646,7 +3648,7 @@ static int amps_decode_bits_recc(amps_t *amps, const char *bits, int first)
for (i = 0; i < 5; i++) {
strncpy(text, bits + i * 48, 48);
text[48] = '\0';
- PDEBUG(DFRAME, DEBUG_DEBUG, " word - %s%s\n", text, (crc_a_ok[i % 5]) ? " ok" : " BAD CRC!");
+ PDEBUG_CHAN(DFRAME, DEBUG_DEBUG, " word - %s%s\n", text, (crc_a_ok[i % 5]) ? " ok" : " BAD CRC!");
}
}
@@ -3661,7 +3663,7 @@ int amps_decode_frame(amps_t *amps, const char *bits, int count, double level, d
/* not if additional words are received without sync */
if (count != 240) {
- PDEBUG(DDSP, DEBUG_INFO, "RX Level: %.0f%% Quality: %.0f%% Polarity: %s\n", level * 100.0, quality * 100.0, (negative) ? "NEGATIVE" : "POSITIVE");
+ PDEBUG_CHAN(DDSP, DEBUG_INFO, "RX Level: %.0f%% Quality: %.0f%% Polarity: %s\n", level * 100.0, quality * 100.0, (negative) ? "NEGATIVE" : "POSITIVE");
}
if (count == 441) {
amps_decode_bits_focc(amps, bits);
@@ -3670,7 +3672,7 @@ int amps_decode_frame(amps_t *amps, const char *bits, int count, double level, d
} else if (count == 240) {
more = amps_decode_bits_recc(amps, bits, 0);
} else {
- PDEBUG(DFRAME, DEBUG_ERROR, "Frame with unknown lenght = %d, please fix!\n", count);
+ PDEBUG_CHAN(DFRAME, DEBUG_ERROR, "Frame with unknown lenght = %d, please fix!\n", count);
}
return more;