layer1/tpu_window.c support for Uplink/Tx
authorHarald Welte <laforge@gnumonks.org>
Sun, 21 Feb 2010 10:12:52 +0000 (11:12 +0100)
committerHarald Welte <laforge@gnumonks.org>
Mon, 1 Mar 2010 22:48:44 +0000 (23:48 +0100)
* introduce l1s_tx_win_ctrl() function

This only controls the ABB window, and not the TRF and RFFE window yet

src/target/firmware/include/layer1/tpu_window.h
src/target/firmware/layer1/tpu_window.c

index 01fab91..fffe3b0 100644 (file)
@@ -9,8 +9,14 @@ enum l1_rxwin_type {
        _NUM_L1_RXWIN
 };
 
+enum l1_txwin_type {
+       L1_TXWIN_NB,    /* Normal burst sending */
+       L1_TXWIN_AB,    /* RACH burst sending */
+       _NUM_L1_TXWIN
+};
 
 void l1s_rx_win_ctrl(uint16_t arfcn, enum l1_rxwin_type wtype);
+void l1s_tx_win_ctrl(uint16_t arfcn, enum l1_txwin_type wtype, uint8_t pwr);
 
 void tpu_end_scenario(void);
 
index faa6afb..b6cbf1f 100644 (file)
@@ -56,6 +56,14 @@ static const uint16_t rx_burst_duration[_NUM_L1_RXWIN] = {
        [L1_RXWIN_NB]   = L1_NB_DURATION_Q,
 };
 
+#define L1_TX_NB_DURATION_Q    626
+#define L1_TX_AB_DURATION_Q    386
+
+static const uint16_t tx_burst_duration[_NUM_L1_TXWIN] = {
+       [L1_TXWIN_NB]   = L1_TX_NB_DURATION_Q,
+       [L1_TXWIN_AB]   = L1_TX_AB_DURATION_Q,
+};
+
 void l1s_rx_win_ctrl(uint16_t arfcn, enum l1_rxwin_type wtype)
 {
        int16_t start = DSP_SETUP_TIME;
@@ -88,6 +96,22 @@ void l1s_rx_win_ctrl(uint16_t arfcn, enum l1_rxwin_type wtype)
        trf6151_set_mode(TRF6151_IDLE);
 }
 
+void l1s_tx_win_ctrl(uint16_t arfcn, enum l1_txwin_type wtype, uint8_t pwr)
+{
+       /* uplink is three TS after downlink ( "+ 32" gives a TA of 1) */
+       uint16_t offset = (L1_BURST_LENGTH_Q * 3) + 28;
+
+       /* FIXME: window open for TRF6151 and RFFE */
+
+       /* Window open for ABB */
+       twl3025_uplink(1, offset);
+
+       /* Window close for ABB */
+       twl3025_uplink(0, tx_burst_duration[wtype] + offset + 2); // TODO: "+ 2"
+
+       /* FIXME: window close for TRF6151 and RFFE */
+}
+
 void tpu_end_scenario(void)
 {
        tpu_enq_sleep();