utility functions to convert RXLEV into dBm and vice versa
This commit is contained in:
parent
854b9b33af
commit
4bb4738d21
|
@ -33,5 +33,9 @@ int gsm_7bit_encode(u_int8_t *result, const char *data);
|
|||
int ms_pwr_ctl_lvl(enum gsm_band band, unsigned int dbm);
|
||||
int ms_pwr_dbm(enum gsm_band band, u_int8_t lvl);
|
||||
|
||||
/* According to TS 08.05 Chapter 8.1.4 */
|
||||
int rxlev2dbm(u_int8_t rxlev);
|
||||
u_int8_t dbm2rxlev(int dbm);
|
||||
|
||||
void generate_backtrace();
|
||||
#endif
|
||||
|
|
|
@ -160,6 +160,28 @@ int ms_pwr_dbm(enum gsm_band band, u_int8_t lvl)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* According to TS 08.05 Chapter 8.1.4 */
|
||||
int rxlev2dbm(u_int8_t rxlev)
|
||||
{
|
||||
if (rxlev > 63)
|
||||
rxlev = 63;
|
||||
|
||||
return -110 + rxlev;
|
||||
}
|
||||
|
||||
/* According to TS 08.05 Chapter 8.1.4 */
|
||||
u_int8_t dbm2rxlev(int dbm)
|
||||
{
|
||||
int rxlev = dbm + 110;
|
||||
|
||||
if (rxlev > 63)
|
||||
rxlev = 63;
|
||||
else if (rxlev < 0)
|
||||
rxlev = 0;
|
||||
|
||||
return rxlev;
|
||||
}
|
||||
|
||||
void generate_backtrace()
|
||||
{
|
||||
int i, nptrs;
|
||||
|
|
Loading…
Reference in New Issue