aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs_rlcmac.h
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-06-14 20:48:19 +0800
committerHarald Welte <laforge@gnumonks.org>2012-06-14 20:48:42 +0800
commitc5187a1824b61add1cd216ef5c432d8abaab1222 (patch)
treec197bc24e9eae4f8d66a8c65d5102be9aca6b4ef /src/gprs_rlcmac.h
parent634771173648acd39c44280e673563a53381b2f7 (diff)
move everything to src/ subdirectory
The code corresponds to commit a9aa4777cc1144897a77dfb6c5c3d7325705251e in openbts-p2.8.git (Tue Jun 12 18:14:49 2012 +0400)
Diffstat (limited to 'src/gprs_rlcmac.h')
-rw-r--r--src/gprs_rlcmac.h108
1 files changed, 108 insertions, 0 deletions
diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h
new file mode 100644
index 00000000..eb651c61
--- /dev/null
+++ b/src/gprs_rlcmac.h
@@ -0,0 +1,108 @@
+/* gprs_rlcmac.h
+ *
+ * Copyright (C) 2012 Ivan Klyuchnikov
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef GPRS_RLCMAC_H
+#define GPRS_RLCMAC_H
+
+#include <bitvector.h>
+#include <gsm_rlcmac.h>
+#include <gsm_timer.h>
+
+extern "C" {
+#include <osmocom/core/linuxlist.h>
+#include <osmocom/core/timer.h>
+}
+
+#define LLC_MAX_LEN 1543
+#define UL_RLC_DATA_BLOCK_LEN 23
+
+enum gprs_rlcmac_tbf_state {
+ GPRS_RLCMAC_WAIT_DATA_SEQ_START,
+ GPRS_RLCMAC_WAIT_NEXT_DATA_BLOCK,
+ GPRS_RLCMAC_WAIT_NEXT_DATA_SEQ
+};
+
+enum gprs_rlcmac_tbf_direction {
+ GPRS_RLCMAC_DL_TBF,
+ GPRS_RLCMAC_UL_TBF
+};
+
+struct gprs_rlcmac_tbf {
+ struct llist_head list;
+ enum gprs_rlcmac_tbf_state state;
+ enum gprs_rlcmac_tbf_direction direction;
+ uint8_t tfi;
+ uint32_t tlli;
+ uint8_t rlc_data[LLC_MAX_LEN];
+ uint16_t data_index;
+ uint8_t bsn;
+
+ struct osmo_timer_list timer;
+ unsigned int T; /* Txxxx number */
+ unsigned int num_T_exp; /* number of consecutive T expirations */
+
+ struct osmo_gsm_timer_list gsm_timer;
+ unsigned int fT; /* fTxxxx number */
+ unsigned int num_fT_exp; /* number of consecutive fT expirations */
+};
+
+extern struct llist_head gprs_rlcmac_tbfs;
+
+int tfi_alloc();
+
+struct gprs_rlcmac_tbf *tbf_alloc(uint8_t tfi);
+
+static struct gprs_rlcmac_tbf *tbf_by_tfi(uint8_t tfi);
+
+static struct gprs_rlcmac_tbf *tbf_by_tlli(uint8_t tlli);
+
+static void tbf_free(struct gprs_rlcmac_tbf *tbf);
+
+/* TS 44.060 Section 10.4.7 Table 10.4.7.1: Payload Type field */
+enum gprs_rlcmac_block_type {
+ GPRS_RLCMAC_DATA_BLOCK = 0x0,
+ GPRS_RLCMAC_CONTROL_BLOCK = 0x1,
+ GPRS_RLCMAC_CONTROL_BLOCK_OPT = 0x2,
+ GPRS_RLCMAC_RESERVED = 0x3
+};
+
+void gprs_rlcmac_tx_ul_ack(uint8_t tfi, uint32_t tlli, RlcMacUplinkDataBlock_t * ul_data_block);
+
+void gprs_rlcmac_data_block_parse(gprs_rlcmac_tbf* tbf, RlcMacUplinkDataBlock_t * ul_data_block);
+
+int gprs_rlcmac_rcv_data_block(bitvec *rlc_block);
+
+int gprs_rlcmac_rcv_control_block(bitvec *rlc_block);
+
+void gprs_rlcmac_rcv_block(bitvec *rlc_block);
+
+int gprs_rlcmac_rcv_rach(uint8_t ra, uint32_t Fn, uint16_t ta);
+
+void gprs_rlcmac_tx_dl_data_block(uint32_t tlli, uint8_t tfi, uint8_t *pdu, int start_index, int end_index, uint8_t bsn, uint8_t fbi);
+
+int gprs_rlcmac_segment_llc_pdu(struct gprs_rlcmac_tbf *tbf);
+
+void gprs_rlcmac_tx_ul_ud(gprs_rlcmac_tbf *tbf);
+
+void gprs_rlcmac_downlink_assignment(gprs_rlcmac_tbf *tbf);
+
+void gprs_rlcmac_packet_downlink_assignment(gprs_rlcmac_tbf *tbf);
+
+
+#endif // GPRS_RLCMAC_H