AMPS: Show debugging for filler/system frames

Show them only once when FOCC is enabled.
This commit is contained in:
Andreas Eversberg 2022-06-12 09:44:00 +02:00
parent 253dfcc8bb
commit 6f84314b93
6 changed files with 62 additions and 55 deletions

View File

@ -133,6 +133,7 @@ struct amps {
uint8_t tx_focc_order; uint8_t tx_focc_order;
int tx_focc_word_count; /* counts transmitted words in a multi word message */ int tx_focc_word_count; /* counts transmitted words in a multi word message */
int tx_focc_word_repeat; /* counts repeats of multi word message */ int tx_focc_word_repeat; /* counts repeats of multi word message */
int tx_focc_debugged; /* indicator to prevent debugging all SI/filler frames */
/* FVC frame states */ /* FVC frame states */
int tx_fvc_send; /* if set, send message words */ int tx_fvc_send; /* if set, send message words */
int tx_fvc_chan; /* channel to assign for voice call */ int tx_fvc_chan; /* channel to assign for voice call */

View File

@ -920,6 +920,7 @@ void amps_set_dsp_mode(amps_t *amps, enum dsp_mode mode, int frame_length)
/* reset SAT detection */ /* reset SAT detection */
sat_reset(amps, "Change to FOCC"); sat_reset(amps, "Change to FOCC");
PDEBUG_CHAN(DDSP, DEBUG_INFO, "Change mode to FOCC\n"); PDEBUG_CHAN(DDSP, DEBUG_INFO, "Change mode to FOCC\n");
amps->tx_focc_debugged = 0;
} }
if (amps->dsp_mode == DSP_MODE_FRAME_RX_FRAME_TX if (amps->dsp_mode == DSP_MODE_FRAME_RX_FRAME_TX
&& (mode == DSP_MODE_AUDIO_RX_AUDIO_TX || mode == DSP_MODE_AUDIO_RX_FRAME_TX)) { && (mode == DSP_MODE_AUDIO_RX_AUDIO_TX || mode == DSP_MODE_AUDIO_RX_FRAME_TX)) {

View File

@ -2707,7 +2707,7 @@ static uint64_t amps_encode_word(frame_t *frame, struct def_word *w, int debug)
int i, t4 = 0; int i, t4 = 0;
#ifdef DEBUG_ALL_MESSAGES #ifdef DEBUG_ALL_MESSAGES
debug=1; debug = 1;
#endif #endif
memset(spaces, ' ', ie_desc_max_len); memset(spaces, ' ', ie_desc_max_len);
@ -2718,7 +2718,8 @@ static uint64_t amps_encode_word(frame_t *frame, struct def_word *w, int debug)
for (i = 0; w->ie[i].name; i++) for (i = 0; w->ie[i].name; i++)
sum_bits += w->ie[i].bits; sum_bits += w->ie[i].bits;
PDEBUG(DFRAME, (debug >= 0) ? DEBUG_INFO : DEBUG_DEBUG, "Transmit: %s\n", w->name); if (debug)
PDEBUG(DFRAME, DEBUG_INFO, "Transmit: %s\n", w->name);
word = 0; word = 0;
for (i = 0; w->ie[i].name; i++) { for (i = 0; w->ie[i].name; i++) {
bits = w->ie[i].bits; bits = w->ie[i].bits;
@ -2727,7 +2728,7 @@ static uint64_t amps_encode_word(frame_t *frame, struct def_word *w, int debug)
else else
value = frame->ie[w->ie[i].ie]; value = frame->ie[w->ie[i].ie];
word = (word << bits) | (value & cut_bits[bits]); word = (word << bits) | (value & cut_bits[bits]);
if (debug >= 0) { if (debug) {
if (amps_ie_desc[w->ie[i].ie].decoder) if (amps_ie_desc[w->ie[i].ie].decoder)
PDEBUG(DFRAME, DEBUG_DEBUG, " %s%s: %" PRIu64 " = %s (%s)\n", spaces + strlen(w->ie[i].name), w->ie[i].name, value, amps_ie_desc[w->ie[i].ie].decoder(value), amps_ie_desc[w->ie[i].ie].desc); PDEBUG(DFRAME, DEBUG_DEBUG, " %s%s: %" PRIu64 " = %s (%s)\n", spaces + strlen(w->ie[i].name), w->ie[i].name, value, amps_ie_desc[w->ie[i].ie].decoder(value), amps_ie_desc[w->ie[i].ie].desc);
else else
@ -2738,7 +2739,7 @@ static uint64_t amps_encode_word(frame_t *frame, struct def_word *w, int debug)
t4++; t4++;
if (t4 == 3) { if (t4 == 3) {
t4 = 0; t4 = 0;
if (debug >= 0) if (debug)
PDEBUG(DFRAME, DEBUG_DEBUG, " %s--> %s\n", spaces, amps_table4_name(frame->ie[AMPS_IE_LOCAL_MSG_TYPE], frame->ie[AMPS_IE_ORDQ], frame->ie[AMPS_IE_ORDER])); PDEBUG(DFRAME, DEBUG_DEBUG, " %s--> %s\n", spaces, amps_table4_name(frame->ie[AMPS_IE_LOCAL_MSG_TYPE], frame->ie[AMPS_IE_ORDQ], frame->ie[AMPS_IE_ORDER]));
} }
} }
@ -2746,7 +2747,7 @@ static uint64_t amps_encode_word(frame_t *frame, struct def_word *w, int debug)
return word; return word;
} }
static uint64_t amps_encode_control_filler(amps_t *amps, uint8_t dcc, uint8_t cmac, uint8_t sdcc1, uint8_t sdcc2, uint8_t wfom) static uint64_t amps_encode_control_filler(amps_t *amps, uint8_t dcc, uint8_t cmac, uint8_t sdcc1, uint8_t sdcc2, uint8_t wfom, int debug)
{ {
frame_t frame; frame_t frame;
@ -2767,10 +2768,10 @@ static uint64_t amps_encode_control_filler(amps_t *amps, uint8_t dcc, uint8_t cm
} else } else
frame.ie[AMPS_IE_1111] = 15; frame.ie[AMPS_IE_1111] = 15;
frame.ie[AMPS_IE_OHD] = 1; frame.ie[AMPS_IE_OHD] = 1;
return amps_encode_word(&frame, &control_filler, -1); return amps_encode_word(&frame, &control_filler, debug);
} }
uint64_t amps_encode_word1_system(uint8_t dcc, uint16_t sid1, uint8_t ep, uint8_t auth, uint8_t pci, uint8_t nawc) uint64_t amps_encode_word1_system(uint8_t dcc, uint16_t sid1, uint8_t ep, uint8_t auth, uint8_t pci, uint8_t nawc, int debug)
{ {
frame_t frame; frame_t frame;
@ -2783,10 +2784,10 @@ uint64_t amps_encode_word1_system(uint8_t dcc, uint16_t sid1, uint8_t ep, uint8_
frame.ie[AMPS_IE_PCI] = pci; frame.ie[AMPS_IE_PCI] = pci;
frame.ie[AMPS_IE_NAWC] = nawc; frame.ie[AMPS_IE_NAWC] = nawc;
frame.ie[AMPS_IE_OHD] = 6; frame.ie[AMPS_IE_OHD] = 6;
return amps_encode_word(&frame, &amps_word1_system_parameter_overhead, -1); return amps_encode_word(&frame, &amps_word1_system_parameter_overhead, debug);
} }
uint64_t tacs_encode_word1_system(uint8_t dcc, uint16_t aid1, uint8_t ep, uint8_t auth, uint8_t pci, uint8_t nawc) uint64_t tacs_encode_word1_system(uint8_t dcc, uint16_t aid1, uint8_t ep, uint8_t auth, uint8_t pci, uint8_t nawc, int debug)
{ {
frame_t frame; frame_t frame;
@ -2799,10 +2800,10 @@ uint64_t tacs_encode_word1_system(uint8_t dcc, uint16_t aid1, uint8_t ep, uint8_
frame.ie[AMPS_IE_PCI] = pci; frame.ie[AMPS_IE_PCI] = pci;
frame.ie[AMPS_IE_NAWC] = nawc; frame.ie[AMPS_IE_NAWC] = nawc;
frame.ie[AMPS_IE_OHD] = 6; frame.ie[AMPS_IE_OHD] = 6;
return amps_encode_word(&frame, &tacs_word1_system_parameter_overhead, -1); return amps_encode_word(&frame, &tacs_word1_system_parameter_overhead, debug);
} }
uint64_t amps_encode_word2_system(uint8_t dcc, uint8_t s, uint8_t e, uint8_t regh, uint8_t regr, uint8_t dtx, uint8_t n_1, uint8_t rcf, uint8_t cpa, uint8_t cmax_1, uint8_t end) uint64_t amps_encode_word2_system(uint8_t dcc, uint8_t s, uint8_t e, uint8_t regh, uint8_t regr, uint8_t dtx, uint8_t n_1, uint8_t rcf, uint8_t cpa, uint8_t cmax_1, uint8_t end, int debug)
{ {
frame_t frame; frame_t frame;
@ -2820,10 +2821,10 @@ uint64_t amps_encode_word2_system(uint8_t dcc, uint8_t s, uint8_t e, uint8_t reg
frame.ie[AMPS_IE_CMAX_1] = cmax_1; frame.ie[AMPS_IE_CMAX_1] = cmax_1;
frame.ie[AMPS_IE_END] = end; frame.ie[AMPS_IE_END] = end;
frame.ie[AMPS_IE_OHD] = 7; frame.ie[AMPS_IE_OHD] = 7;
return amps_encode_word(&frame, &word2_system_parameter_overhead, -1); return amps_encode_word(&frame, &word2_system_parameter_overhead, debug);
} }
uint64_t amps_encode_registration_id(uint8_t dcc, uint32_t regid, uint8_t end) uint64_t amps_encode_registration_id(uint8_t dcc, uint32_t regid, uint8_t end, int debug)
{ {
frame_t frame; frame_t frame;
@ -2833,10 +2834,10 @@ uint64_t amps_encode_registration_id(uint8_t dcc, uint32_t regid, uint8_t end)
frame.ie[AMPS_IE_REGID] = regid; frame.ie[AMPS_IE_REGID] = regid;
frame.ie[AMPS_IE_END] = end; frame.ie[AMPS_IE_END] = end;
frame.ie[AMPS_IE_OHD] = 0; frame.ie[AMPS_IE_OHD] = 0;
return amps_encode_word(&frame, &registration_id, -1); return amps_encode_word(&frame, &registration_id, debug);
} }
uint64_t amps_encode_registration_increment(uint8_t dcc, uint16_t regincr, uint8_t end) uint64_t amps_encode_registration_increment(uint8_t dcc, uint16_t regincr, uint8_t end, int debug)
{ {
frame_t frame; frame_t frame;
@ -2847,10 +2848,10 @@ uint64_t amps_encode_registration_increment(uint8_t dcc, uint16_t regincr, uint8
frame.ie[AMPS_IE_REGINCR] = regincr; frame.ie[AMPS_IE_REGINCR] = regincr;
frame.ie[AMPS_IE_END] = end; frame.ie[AMPS_IE_END] = end;
frame.ie[AMPS_IE_OHD] = 4; frame.ie[AMPS_IE_OHD] = 4;
return amps_encode_word(&frame, &registration_increment_global_action, -1); return amps_encode_word(&frame, &registration_increment_global_action, debug);
} }
uint64_t amps_encode_location_area(uint8_t dcc, uint8_t pureg, uint8_t pdreg, uint8_t lreg, uint16_t locaid, uint8_t end) uint64_t amps_encode_location_area(uint8_t dcc, uint8_t pureg, uint8_t pdreg, uint8_t lreg, uint16_t locaid, uint8_t end, int debug)
{ {
frame_t frame; frame_t frame;
@ -2864,10 +2865,10 @@ uint64_t amps_encode_location_area(uint8_t dcc, uint8_t pureg, uint8_t pdreg, ui
frame.ie[AMPS_IE_LOCAID] = locaid; frame.ie[AMPS_IE_LOCAID] = locaid;
frame.ie[AMPS_IE_END] = end; frame.ie[AMPS_IE_END] = end;
frame.ie[AMPS_IE_OHD] = 4; frame.ie[AMPS_IE_OHD] = 4;
return amps_encode_word(&frame, &location_area_global_action, -1); return amps_encode_word(&frame, &location_area_global_action, debug);
} }
uint64_t amps_encode_new_access_channel_set(uint8_t dcc, uint16_t newacc, uint8_t end) uint64_t amps_encode_new_access_channel_set(uint8_t dcc, uint16_t newacc, uint8_t end, int debug)
{ {
frame_t frame; frame_t frame;
@ -2878,10 +2879,10 @@ uint64_t amps_encode_new_access_channel_set(uint8_t dcc, uint16_t newacc, uint8_
frame.ie[AMPS_IE_NEWACC] = newacc; frame.ie[AMPS_IE_NEWACC] = newacc;
frame.ie[AMPS_IE_END] = end; frame.ie[AMPS_IE_END] = end;
frame.ie[AMPS_IE_OHD] = 4; frame.ie[AMPS_IE_OHD] = 4;
return amps_encode_word(&frame, &new_access_channel_set_global_action, -1); return amps_encode_word(&frame, &new_access_channel_set_global_action, debug);
} }
uint64_t amps_encode_overload_control(uint8_t dcc, uint8_t *olc, uint8_t end) uint64_t amps_encode_overload_control(uint8_t dcc, uint8_t *olc, uint8_t end, int debug)
{ {
frame_t frame; frame_t frame;
@ -2907,10 +2908,10 @@ uint64_t amps_encode_overload_control(uint8_t dcc, uint8_t *olc, uint8_t end)
frame.ie[AMPS_IE_OLC_15] = olc[15]; frame.ie[AMPS_IE_OLC_15] = olc[15];
frame.ie[AMPS_IE_END] = end; frame.ie[AMPS_IE_END] = end;
frame.ie[AMPS_IE_OHD] = 4; frame.ie[AMPS_IE_OHD] = 4;
return amps_encode_word(&frame, &overload_control_global_action, -1); return amps_encode_word(&frame, &overload_control_global_action, debug);
} }
uint64_t amps_encode_access_type(uint8_t dcc, uint8_t bis, uint8_t pci_home, uint8_t pci_roam, uint8_t bspc, uint8_t bscap, uint8_t end) uint64_t amps_encode_access_type(uint8_t dcc, uint8_t bis, uint8_t pci_home, uint8_t pci_roam, uint8_t bspc, uint8_t bscap, uint8_t end, int debug)
{ {
frame_t frame; frame_t frame;
@ -2925,10 +2926,10 @@ uint64_t amps_encode_access_type(uint8_t dcc, uint8_t bis, uint8_t pci_home, uin
frame.ie[AMPS_IE_BSCAP] = bscap; frame.ie[AMPS_IE_BSCAP] = bscap;
frame.ie[AMPS_IE_END] = end; frame.ie[AMPS_IE_END] = end;
frame.ie[AMPS_IE_OHD] = 4; frame.ie[AMPS_IE_OHD] = 4;
return amps_encode_word(&frame, &access_type_parameters_global_action, -1); return amps_encode_word(&frame, &access_type_parameters_global_action, debug);
} }
uint64_t amps_encode_access_attempt(uint8_t dcc, uint8_t maxbusy_pgr, uint8_t maxsztr_pgr, uint8_t maxbusy_other, uint8_t maxsztr_other, uint8_t end) uint64_t amps_encode_access_attempt(uint8_t dcc, uint8_t maxbusy_pgr, uint8_t maxsztr_pgr, uint8_t maxbusy_other, uint8_t maxsztr_other, uint8_t end, int debug)
{ {
frame_t frame; frame_t frame;
@ -2942,7 +2943,7 @@ uint64_t amps_encode_access_attempt(uint8_t dcc, uint8_t maxbusy_pgr, uint8_t ma
frame.ie[AMPS_IE_MAXSZTR_OTHER] = maxsztr_other; frame.ie[AMPS_IE_MAXSZTR_OTHER] = maxsztr_other;
frame.ie[AMPS_IE_END] = end; frame.ie[AMPS_IE_END] = end;
frame.ie[AMPS_IE_OHD] = 4; frame.ie[AMPS_IE_OHD] = 4;
return amps_encode_word(&frame, &access_attempt_parameters_global_action, -1); return amps_encode_word(&frame, &access_attempt_parameters_global_action, debug);
} }
static uint64_t amps_encode_word1_abbreviated_address_word(uint8_t dcc, uint32_t min1, int multiple) static uint64_t amps_encode_word1_abbreviated_address_word(uint8_t dcc, uint32_t min1, int multiple)
@ -2956,7 +2957,7 @@ static uint64_t amps_encode_word1_abbreviated_address_word(uint8_t dcc, uint32_t
frame.ie[AMPS_IE_T1T2] = 0; frame.ie[AMPS_IE_T1T2] = 0;
frame.ie[AMPS_IE_DCC] = dcc; frame.ie[AMPS_IE_DCC] = dcc;
frame.ie[AMPS_IE_MIN1] = min1; frame.ie[AMPS_IE_MIN1] = min1;
return amps_encode_word(&frame, &word1_abbreviated_address_word, DEBUG_INFO); return amps_encode_word(&frame, &word1_abbreviated_address_word, 1);
} }
static uint64_t amps_encode_word2_extended_address_word_a(uint16_t min2, uint8_t msg_type, uint8_t ordq, uint8_t order) static uint64_t amps_encode_word2_extended_address_word_a(uint16_t min2, uint8_t msg_type, uint8_t ordq, uint8_t order)
@ -2971,7 +2972,7 @@ static uint64_t amps_encode_word2_extended_address_word_a(uint16_t min2, uint8_t
frame.ie[AMPS_IE_LOCAL_MSG_TYPE] = msg_type; frame.ie[AMPS_IE_LOCAL_MSG_TYPE] = msg_type;
frame.ie[AMPS_IE_ORDQ] = ordq; frame.ie[AMPS_IE_ORDQ] = ordq;
frame.ie[AMPS_IE_ORDER] = order; frame.ie[AMPS_IE_ORDER] = order;
return amps_encode_word(&frame, &word2_extended_address_word_a, DEBUG_INFO); return amps_encode_word(&frame, &word2_extended_address_word_a, 1);
} }
static uint64_t amps_encode_word2_extended_address_word_b(uint8_t scc, uint16_t min2, uint8_t vmac, uint16_t chan) static uint64_t amps_encode_word2_extended_address_word_b(uint8_t scc, uint16_t min2, uint8_t vmac, uint16_t chan)
@ -2984,7 +2985,7 @@ static uint64_t amps_encode_word2_extended_address_word_b(uint8_t scc, uint16_t
frame.ie[AMPS_IE_MIN2] = min2; frame.ie[AMPS_IE_MIN2] = min2;
frame.ie[AMPS_IE_VMAC] = vmac; frame.ie[AMPS_IE_VMAC] = vmac;
frame.ie[AMPS_IE_CHAN] = chan; frame.ie[AMPS_IE_CHAN] = chan;
return amps_encode_word(&frame, &word2_extended_address_word_b, DEBUG_INFO); return amps_encode_word(&frame, &word2_extended_address_word_b, 1);
} }
static uint64_t amps_encode_mobile_station_control_message_word1_a(uint8_t pscc, uint8_t msg_type, uint8_t ordq, uint8_t order) static uint64_t amps_encode_mobile_station_control_message_word1_a(uint8_t pscc, uint8_t msg_type, uint8_t ordq, uint8_t order)
@ -2999,7 +3000,7 @@ static uint64_t amps_encode_mobile_station_control_message_word1_a(uint8_t pscc,
frame.ie[AMPS_IE_LOCAL_MSG_TYPE] = msg_type; frame.ie[AMPS_IE_LOCAL_MSG_TYPE] = msg_type;
frame.ie[AMPS_IE_ORDQ] = ordq; frame.ie[AMPS_IE_ORDQ] = ordq;
frame.ie[AMPS_IE_ORDER] = order; frame.ie[AMPS_IE_ORDER] = order;
return amps_encode_word(&frame, &mobile_station_control_message_word1_a, DEBUG_INFO); return amps_encode_word(&frame, &mobile_station_control_message_word1_a, 1);
} }
static uint64_t amps_encode_mobile_station_control_message_word1_b(uint8_t scc, uint8_t pscc, uint8_t dtx, uint8_t pvi, uint8_t mem, uint8_t vmac, uint16_t chan) static uint64_t amps_encode_mobile_station_control_message_word1_b(uint8_t scc, uint8_t pscc, uint8_t dtx, uint8_t pvi, uint8_t mem, uint8_t vmac, uint16_t chan)
@ -3016,7 +3017,7 @@ static uint64_t amps_encode_mobile_station_control_message_word1_b(uint8_t scc,
frame.ie[AMPS_IE_MEM] = mem; frame.ie[AMPS_IE_MEM] = mem;
frame.ie[AMPS_IE_VMAC] = vmac; frame.ie[AMPS_IE_VMAC] = vmac;
frame.ie[AMPS_IE_CHAN] = chan; frame.ie[AMPS_IE_CHAN] = chan;
return amps_encode_word(&frame, &mobile_station_control_message_word1_b, DEBUG_INFO); return amps_encode_word(&frame, &mobile_station_control_message_word1_b, 1);
} }
/* decoder function of a word */ /* decoder function of a word */
@ -3417,13 +3418,14 @@ static void amps_encode_fvc_bits(uint64_t word_a, char *bits)
int amps_encode_frame_focc(amps_t *amps, char *bits) int amps_encode_frame_focc(amps_t *amps, char *bits)
{ {
uint64_t word; uint64_t word;
int debug = !amps->tx_focc_debugged;
/* init overhead train */ /* init overhead train */
if (amps->tx_focc_frame_count == 0) if (amps->tx_focc_frame_count == 0)
prepare_sysinfo(&amps->si); prepare_sysinfo(&amps->si);
/* send overhead train */ /* send overhead train */
if (amps->si.num) { if (amps->si.num) {
word = get_sysinfo(&amps->si); word = get_sysinfo(&amps->si, debug);
if (++amps->tx_focc_frame_count >= amps->si.overhead_repeat) if (++amps->tx_focc_frame_count >= amps->si.overhead_repeat)
amps->tx_focc_frame_count = 0; amps->tx_focc_frame_count = 0;
goto send; goto send;
@ -3474,9 +3476,12 @@ int amps_encode_frame_focc(amps_t *amps, char *bits)
} }
/* send filler */ /* send filler */
word = amps_encode_control_filler(amps, amps->si.dcc, amps->si.filler.cmac, amps->si.filler.sdcc1, amps->si.filler.sdcc2, amps->si.filler.wfom); word = amps_encode_control_filler(amps, amps->si.dcc, amps->si.filler.cmac, amps->si.filler.sdcc1, amps->si.filler.sdcc2, amps->si.filler.wfom, debug);
if (++amps->tx_focc_frame_count >= amps->si.overhead_repeat) if (++amps->tx_focc_frame_count >= amps->si.overhead_repeat)
amps->tx_focc_frame_count = 0; amps->tx_focc_frame_count = 0;
if (debug)
PDEBUG_CHAN(DFRAME, DEBUG_INFO, "Subsequent system/filler frames are not show, to prevent flooding the output.\n");
amps->tx_focc_debugged = 1;
send: send:
amps_encode_focc_bits(word, word, bits); amps_encode_focc_bits(word, word, bits);

View File

@ -211,16 +211,16 @@ typedef struct amps_frame {
} frame_t; } frame_t;
void init_frame(void); void init_frame(void);
uint64_t amps_encode_word1_system(uint8_t dcc, uint16_t sid1, uint8_t ep, uint8_t auth, uint8_t pci, uint8_t nawc); uint64_t amps_encode_word1_system(uint8_t dcc, uint16_t sid1, uint8_t ep, uint8_t auth, uint8_t pci, uint8_t nawc, int debug);
uint64_t tacs_encode_word1_system(uint8_t dcc, uint16_t aid1, uint8_t ep, uint8_t auth, uint8_t pci, uint8_t nawc); uint64_t tacs_encode_word1_system(uint8_t dcc, uint16_t aid1, uint8_t ep, uint8_t auth, uint8_t pci, uint8_t nawc, int debug);
uint64_t amps_encode_word2_system(uint8_t dcc, uint8_t s, uint8_t e, uint8_t regh, uint8_t regr, uint8_t dtx, uint8_t n_1, uint8_t rcf, uint8_t cpa, uint8_t cmax_1, uint8_t end); uint64_t amps_encode_word2_system(uint8_t dcc, uint8_t s, uint8_t e, uint8_t regh, uint8_t regr, uint8_t dtx, uint8_t n_1, uint8_t rcf, uint8_t cpa, uint8_t cmax_1, uint8_t end, int debug);
uint64_t amps_encode_registration_id(uint8_t dcc, uint32_t regid, uint8_t end); uint64_t amps_encode_registration_id(uint8_t dcc, uint32_t regid, uint8_t end, int debug);
uint64_t amps_encode_registration_increment(uint8_t dcc, uint16_t regincr, uint8_t end); uint64_t amps_encode_registration_increment(uint8_t dcc, uint16_t regincr, uint8_t end, int debug);
uint64_t amps_encode_location_area(uint8_t dcc, uint8_t pureg, uint8_t pdreg, uint8_t lreg, uint16_t locaid, uint8_t end); uint64_t amps_encode_location_area(uint8_t dcc, uint8_t pureg, uint8_t pdreg, uint8_t lreg, uint16_t locaid, uint8_t end, int debug);
uint64_t amps_encode_new_access_channel_set(uint8_t dcc, uint16_t newacc, uint8_t end); uint64_t amps_encode_new_access_channel_set(uint8_t dcc, uint16_t newacc, uint8_t end, int debug);
uint64_t amps_encode_overload_control(uint8_t dcc, uint8_t *olc, uint8_t end); uint64_t amps_encode_overload_control(uint8_t dcc, uint8_t *olc, uint8_t end, int debug);
uint64_t amps_encode_access_type(uint8_t dcc, uint8_t bis, uint8_t pci_home, uint8_t pci_roam, uint8_t bspc, uint8_t bscap, uint8_t end); uint64_t amps_encode_access_type(uint8_t dcc, uint8_t bis, uint8_t pci_home, uint8_t pci_roam, uint8_t bspc, uint8_t bscap, uint8_t end, int debug);
uint64_t amps_encode_access_attempt(uint8_t dcc, uint8_t maxbusy_pgr, uint8_t maxsztr_pgr, uint8_t maxbusy_other, uint8_t maxsztr_other, uint8_t end); uint64_t amps_encode_access_attempt(uint8_t dcc, uint8_t maxbusy_pgr, uint8_t maxsztr_pgr, uint8_t maxbusy_other, uint8_t maxsztr_other, uint8_t end, int debug);
int amps_encode_frame_focc(amps_t *amps, char *bits); int amps_encode_frame_focc(amps_t *amps, char *bits);
int amps_encode_frame_fvc(amps_t *amps, char *bits); int amps_encode_frame_fvc(amps_t *amps, char *bits);
int amps_decode_frame(amps_t *amps, const char *bits, int count, double level, double quality, int negative); int amps_decode_frame(amps_t *amps, const char *bits, int count, double level, double quality, int negative);

View File

@ -150,7 +150,7 @@ void prepare_sysinfo(amps_si *si)
} }
} }
uint64_t get_sysinfo(amps_si *si) uint64_t get_sysinfo(amps_si *si, int debug)
{ {
int count, nawc, end = 0; int count, nawc, end = 0;
time_t ti = time(NULL); time_t ti = time(NULL);
@ -166,27 +166,27 @@ uint64_t get_sysinfo(amps_si *si)
case SYSINFO_WORD1: case SYSINFO_WORD1:
nawc = si->num - 1; nawc = si->num - 1;
if (!tacs) if (!tacs)
return amps_encode_word1_system(si->dcc, si->word1.sid1, si->word1.ep, si->word1.auth, si->word1.pci, nawc); return amps_encode_word1_system(si->dcc, si->word1.sid1, si->word1.ep, si->word1.auth, si->word1.pci, nawc, debug);
else else
return tacs_encode_word1_system(si->dcc, si->word1.sid1, si->word1.ep, si->word1.auth, si->word1.pci, nawc); return tacs_encode_word1_system(si->dcc, si->word1.sid1, si->word1.ep, si->word1.auth, si->word1.pci, nawc, debug);
case SYSINFO_WORD2: case SYSINFO_WORD2:
return amps_encode_word2_system(si->dcc, si->word2.s, si->word2.e, si->word2.regh, si->word2.regr, si->word2.dtx, si->word2.n_1, si->word2.rcf, si->word2.cpa, si->word2.cmax_1, end); return amps_encode_word2_system(si->dcc, si->word2.s, si->word2.e, si->word2.regh, si->word2.regr, si->word2.dtx, si->word2.n_1, si->word2.rcf, si->word2.cpa, si->word2.cmax_1, end, debug);
case SYSINFO_REG_ID: case SYSINFO_REG_ID:
/* use time stamp to generate regid */ /* use time stamp to generate regid */
si->reg_id.regid = ti & 0xfffff; si->reg_id.regid = ti & 0xfffff;
return amps_encode_registration_id(si->dcc, si->reg_id.regid, end); return amps_encode_registration_id(si->dcc, si->reg_id.regid, end, debug);
case SYSINFO_REG_INCR: case SYSINFO_REG_INCR:
return amps_encode_registration_increment(si->dcc, si->reg_incr.regincr, end); return amps_encode_registration_increment(si->dcc, si->reg_incr.regincr, end, debug);
case SYSINFO_LOC_AREA: case SYSINFO_LOC_AREA:
return amps_encode_location_area(si->dcc, si->loc_area.pureg, si->loc_area.pdreg, si->loc_area.lreg, si->loc_area.locaid, end); return amps_encode_location_area(si->dcc, si->loc_area.pureg, si->loc_area.pdreg, si->loc_area.lreg, si->loc_area.locaid, end, debug);
case SYSINFO_NEW_ACC: case SYSINFO_NEW_ACC:
return amps_encode_new_access_channel_set(si->dcc, si->new_acc.newacc, end); return amps_encode_new_access_channel_set(si->dcc, si->new_acc.newacc, end, debug);
case SYSINFO_OVERLOAD: case SYSINFO_OVERLOAD:
return amps_encode_overload_control(si->dcc, si->overload.olc, end); return amps_encode_overload_control(si->dcc, si->overload.olc, end, debug);
case SYSINFO_ACC_TYPE: case SYSINFO_ACC_TYPE:
return amps_encode_access_type(si->dcc, si->acc_type.bis, si->acc_type.pci_home, si->acc_type.pci_roam, si->acc_type.bspc, si->acc_type.bscap, end); return amps_encode_access_type(si->dcc, si->acc_type.bis, si->acc_type.pci_home, si->acc_type.pci_roam, si->acc_type.bspc, si->acc_type.bscap, end, debug);
case SYSINFO_ACC_ATTEMPT: case SYSINFO_ACC_ATTEMPT:
return amps_encode_access_attempt(si->dcc, si->acc_attempt.maxbusy_pgr, si->acc_attempt.maxsztr_pgr, si->acc_attempt.maxbusy_other, si->acc_attempt.maxsztr_other, end); return amps_encode_access_attempt(si->dcc, si->acc_attempt.maxbusy_pgr, si->acc_attempt.maxsztr_pgr, si->acc_attempt.maxbusy_other, si->acc_attempt.maxsztr_other, end, debug);
} }
fprintf(stderr, "get_sysinfo unknown type, please fix!\n"); fprintf(stderr, "get_sysinfo unknown type, please fix!\n");

View File

@ -112,5 +112,5 @@ typedef struct system_information {
void init_sysinfo(amps_si *si, int cmac, int vmac, int dtx, int dcc, int sid1, int regh, int regr, int pureg, int pdreg, int locaid, int regincr, int bis); void init_sysinfo(amps_si *si, int cmac, int vmac, int dtx, int dcc, int sid1, int regh, int regr, int pureg, int pdreg, int locaid, int regincr, int bis);
void prepare_sysinfo(amps_si *si); void prepare_sysinfo(amps_si *si);
uint64_t get_sysinfo(amps_si *si); uint64_t get_sysinfo(amps_si *si, int debug);