1a9080876c63fa7deeab4685078c447254703718
[osmocom-bb.git] / src / target / firmware / include / rf / trf6151.h
1 #ifndef _TRF6151_H
2 #define _TRF6151_H
3
4 #include <osmocore/gsm_utils.h>
5
6 /* initialize (reset + power up) */
7 void trf6151_init(uint8_t tsp_uid, uint16_t tsp_reset_id);
8
9 /* switch power off or on */
10 void trf6151_power(int on);
11
12 /* set the VGA and RF gain */
13 int trf6151_set_gain(uint8_t dbm, int high);
14
15 /* obtain the current total gain of the TRF6151 */
16 uint8_t trf6151_get_gain(void);
17
18 /* Request the PLL to be tuned to the given frequency */
19 void trf6151_set_arfcn(uint16_t arfcn, int uplink);
20
21 enum trf6151_mode {
22         TRF6151_IDLE,
23         TRF6151_RX,
24         TRF6151_TX,
25 };
26
27 /* Set the operational mode of the TRF6151 chip */
28 void trf6151_set_mode(enum trf6151_mode mode);
29
30 void trf6151_test(uint16_t arfcn);
31 void trf6151_tx_test(uint16_t arfcn);
32
33 /* prepare a Rx window with the TRF6151 finished at time 'start' (in qbits) */
34 void trf6151_rx_window(int16_t start_qbits, uint16_t arfcn);
35
36 /* prepare a Tx window with the TRF6151 finished at time 'start' (in qbits) */
37 void trf6151_tx_window(int16_t start_qbits, uint16_t arfcn);
38
39 /* Given the expected input level of exp_inp dBm and the target of target_bb
40  * dBm, configure the RF Frontend with the respective gain */
41 void trf6151_compute_gain(int16_t exp_inp, int16_t target_bb);
42
43 #endif /* TRF6151_H */