osmo-tetra/src/tetra_common.h

53 lines
1.1 KiB
C

#ifndef TETRA_COMMON_H
#define TETRA_COMMON_H
#include <stdint.h>
#ifdef DEBUG
#define DEBUGP(x, args...) printf(x, ## args)
#else
#define DEBUGP(x, args...) do { } while(0)
#endif
#define TETRA_SYM_PER_TS 255
#define TETRA_BITS_PER_TS (TETRA_SYM_PER_TS*2)
/* Chapter 22.2.x */
enum tetra_log_chan {
TETRA_LC_UNKNOWN,
/* TMA SAP */
TETRA_LC_SCH_F,
TETRA_LC_SCH_HD,
TETRA_LC_SCH_HU,
TETRA_LC_STCH,
TETRA_LC_SCH_P8_F,
TETRA_LC_SCH_P8_HD,
TETRA_LC_SCH_P8_HU,
TETRA_LC_AACH,
TETRA_LC_TCH,
TETRA_LC_BSCH,
TETRA_LC_BNCH,
/* FIXME: QAM */
};
const char *bitdump(const uint8_t *bits, unsigned int len);
uint32_t bits_to_uint(const uint8_t *bits, unsigned int len);
#include "tetra_tdma.h"
struct tetra_phy_state {
struct tetra_tdma_time time;
};
extern struct tetra_phy_state t_phy_state;
#define TETRA_CRC_OK 0x1d0f
uint32_t tetra_dl_carrier_hz(uint8_t band, uint16_t carrier, uint8_t offset);
uint32_t tetra_ul_carrier_hz(uint8_t band, uint16_t carrier, uint8_t offset,
uint8_t duplex, uint8_t reverse);
const char *tetra_get_lchan_name(enum tetra_log_chan lchan);
const char *tetra_get_sap_name(uint8_t sap);
#endif