pdch: Introduce APIs to print PDCH name
This will allow printing PDCH with same formatting outside of LOGPDCH. Change-Id: If18cb4a48237751e0dddede6793191b36dfe386d
This commit is contained in:
parent
ff7c581011
commit
23ae0e3d23
14
src/pdch.cpp
14
src/pdch.cpp
|
@ -1336,3 +1336,17 @@ bool pdch_is_full(const struct gprs_rlcmac_pdch *pdch)
|
||||||
pdch->assigned_tfi(GPRS_RLCMAC_DL_TBF) == NO_FREE_TFI ||
|
pdch->assigned_tfi(GPRS_RLCMAC_DL_TBF) == NO_FREE_TFI ||
|
||||||
find_free_usf(pdch->assigned_usf()) < 0;
|
find_free_usf(pdch->assigned_usf()) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *pdch_name(const struct gprs_rlcmac_pdch *pdch)
|
||||||
|
{
|
||||||
|
static char _pdch_name_buf[128];
|
||||||
|
return pdch_name_buf(pdch, _pdch_name_buf, sizeof(_pdch_name_buf));
|
||||||
|
}
|
||||||
|
|
||||||
|
char *pdch_name_buf(const struct gprs_rlcmac_pdch *pdch, char *buf, size_t buf_size)
|
||||||
|
{
|
||||||
|
struct osmo_strbuf sb = { .buf = buf, .len = buf_size };
|
||||||
|
OSMO_STRBUF_PRINTF(sb, "PDCH(bts=%" PRIu8 ",trx=%" PRIu8 ",ts=%" PRIu8 ")",
|
||||||
|
pdch->trx->bts->nr, pdch->trx->trx_no, pdch->ts_no);
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
|
@ -191,11 +191,11 @@ void pdch_free_all_tbf(struct gprs_rlcmac_pdch *pdch);
|
||||||
void pdch_disable(struct gprs_rlcmac_pdch *pdch);
|
void pdch_disable(struct gprs_rlcmac_pdch *pdch);
|
||||||
bool pdch_is_enabled(const struct gprs_rlcmac_pdch *pdch);
|
bool pdch_is_enabled(const struct gprs_rlcmac_pdch *pdch);
|
||||||
bool pdch_is_full(const struct gprs_rlcmac_pdch *pdch);
|
bool pdch_is_full(const struct gprs_rlcmac_pdch *pdch);
|
||||||
|
const char *pdch_name(const struct gprs_rlcmac_pdch *pdch);
|
||||||
|
char *pdch_name_buf(const struct gprs_rlcmac_pdch *pdch, char *buf, size_t buf_size);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LOGPDCH(pdch, category, level, fmt, args...) \
|
#define LOGPDCH(pdch, category, level, fmt, args...) \
|
||||||
LOGP(category, level, "PDCH(bts=%" PRIu8 ",trx=%" PRIu8 ",ts=%" PRIu8 ") " fmt, \
|
LOGP(category, level, "%s " fmt, pdch_name(pdch), ## args)
|
||||||
(pdch)->trx->bts->nr, (pdch)->trx->trx_no, (pdch)->ts_no, \
|
|
||||||
## args)
|
|
||||||
|
|
Loading…
Reference in New Issue