Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 1 | /* gprs_rlcmac.h |
| 2 | * |
| 3 | * Copyright (C) 2012 Ivan Klyuchnikov |
Holger Hans Peter Freyther | d6bd91e | 2013-08-24 21:16:55 +0200 | [diff] [blame] | 4 | * Copyright (C) 2013 by Holger Hans Peter Freyther |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * as published by the Free Software Foundation; either version 2 |
| 9 | * of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 | */ |
| 20 | |
| 21 | #ifndef GPRS_RLCMAC_H |
| 22 | #define GPRS_RLCMAC_H |
| 23 | |
Andreas Eversberg | 8b761a3 | 2012-07-20 21:50:31 +0200 | [diff] [blame] | 24 | #ifdef __cplusplus |
Ivan Kluchnikov | 835f91e | 2012-04-30 18:00:36 +0400 | [diff] [blame] | 25 | #include <bitvector.h> |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 26 | #include <gsm_rlcmac.h> |
Ivan Kluchnikov | 61a33f7 | 2012-04-12 15:22:06 +0400 | [diff] [blame] | 27 | #include <gsm_timer.h> |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 28 | |
| 29 | extern "C" { |
| 30 | #include <osmocom/core/linuxlist.h> |
Ivan Kluchnikov | 61a33f7 | 2012-04-12 15:22:06 +0400 | [diff] [blame] | 31 | #include <osmocom/core/timer.h> |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 32 | } |
Andreas Eversberg | 8b761a3 | 2012-07-20 21:50:31 +0200 | [diff] [blame] | 33 | #endif |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 34 | |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 35 | /* This special feature will delay assignment of downlink TBF by one second, |
| 36 | * in case there is already a TBF. |
| 37 | * This is usefull to debug downlink establishment during packet idle mode. |
| 38 | */ |
| 39 | //#define DEBUG_DL_ASS_IDLE |
Ivan Kluchnikov | c5d8c27 | 2012-06-04 21:55:02 +0400 | [diff] [blame] | 40 | |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 41 | |
| 42 | struct gprs_rlcmac_tbf; |
Holger Hans Peter Freyther | b6acfda | 2013-10-17 19:41:11 +0200 | [diff] [blame] | 43 | struct gprs_rlcmac_bts; |
Holger Hans Peter Freyther | 34bd8bd | 2013-10-19 21:10:38 +0200 | [diff] [blame] | 44 | struct BTS; |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 45 | |
Andreas Eversberg | 8b761a3 | 2012-07-20 21:50:31 +0200 | [diff] [blame] | 46 | #ifdef __cplusplus |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 47 | /* |
Andreas Eversberg | 2b91464 | 2012-07-19 13:06:26 +0200 | [diff] [blame] | 48 | * paging entry |
| 49 | */ |
| 50 | struct gprs_rlcmac_paging { |
| 51 | struct llist_head list; |
| 52 | uint8_t chan_needed; |
| 53 | uint8_t identity_lv[9]; |
| 54 | }; |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 55 | |
Andreas Eversberg | 07e97cf | 2012-08-07 16:00:56 +0200 | [diff] [blame] | 56 | /* |
Andreas Eversberg | 3b1332c | 2012-10-03 14:20:53 +0200 | [diff] [blame] | 57 | * coding scheme info |
| 58 | */ |
| 59 | struct gprs_rlcmac_cs { |
| 60 | uint8_t block_length; |
| 61 | uint8_t block_data; |
| 62 | uint8_t block_payload; |
| 63 | }; |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 64 | |
Andreas Eversberg | 050ace2 | 2013-03-16 16:22:02 +0100 | [diff] [blame] | 65 | int gprs_rlcmac_received_lost(struct gprs_rlcmac_tbf *tbf, uint16_t received, |
| 66 | uint16_t lost); |
| 67 | |
| 68 | int gprs_rlcmac_lost_rep(struct gprs_rlcmac_tbf *tbf); |
| 69 | |
| 70 | int gprs_rlcmac_meas_rep(Packet_Measurement_Report_t *pmr); |
| 71 | |
| 72 | int gprs_rlcmac_rssi(struct gprs_rlcmac_tbf *tbf, int8_t rssi); |
| 73 | |
| 74 | int gprs_rlcmac_rssi_rep(struct gprs_rlcmac_tbf *tbf); |
| 75 | |
| 76 | int gprs_rlcmac_dl_bw(struct gprs_rlcmac_tbf *tbf, uint16_t octets); |
| 77 | |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 78 | /* TS 44.060 Section 10.4.7 Table 10.4.7.1: Payload Type field */ |
| 79 | enum gprs_rlcmac_block_type { |
| 80 | GPRS_RLCMAC_DATA_BLOCK = 0x0, |
| 81 | GPRS_RLCMAC_CONTROL_BLOCK = 0x1, |
| 82 | GPRS_RLCMAC_CONTROL_BLOCK_OPT = 0x2, |
| 83 | GPRS_RLCMAC_RESERVED = 0x3 |
| 84 | }; |
| 85 | |
Andreas Eversberg | 3e372d5 | 2012-07-06 09:28:15 +0200 | [diff] [blame] | 86 | int gprs_rlcmac_tx_ul_ud(gprs_rlcmac_tbf *tbf); |
Ivan Kluchnikov | a9e6dc5 | 2012-06-17 08:30:06 +0400 | [diff] [blame] | 87 | |
Andreas Eversberg | 8c3680d | 2012-10-08 12:30:56 +0200 | [diff] [blame] | 88 | int gprs_rlcmac_paging_request(uint8_t *ptmsi, uint16_t ptmsi_len, |
| 89 | const char *imsi); |
| 90 | |
Holger Hans Peter Freyther | b19d726 | 2013-10-17 18:12:18 +0200 | [diff] [blame] | 91 | int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_bts *bts, |
| 92 | uint8_t trx, uint8_t ts, uint16_t arfcn, |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 93 | uint32_t fn, uint8_t block_nr); |
| 94 | |
Andreas Eversberg | a1503fa | 2012-07-22 08:58:09 +0200 | [diff] [blame] | 95 | extern "C" { |
| 96 | #endif |
Holger Hans Peter Freyther | b67a8a3 | 2013-07-28 18:55:14 +0200 | [diff] [blame] | 97 | int alloc_algorithm_a(struct gprs_rlcmac_bts *bts, |
| 98 | struct gprs_rlcmac_tbf *old_tbf, |
Andreas Eversberg | f01929b | 2012-10-08 12:40:49 +0200 | [diff] [blame] | 99 | struct gprs_rlcmac_tbf *tbf, uint32_t cust, uint8_t single); |
Andreas Eversberg | a1503fa | 2012-07-22 08:58:09 +0200 | [diff] [blame] | 100 | |
Holger Hans Peter Freyther | b67a8a3 | 2013-07-28 18:55:14 +0200 | [diff] [blame] | 101 | int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, |
| 102 | struct gprs_rlcmac_tbf *old_tbf, |
Andreas Eversberg | f01929b | 2012-10-08 12:40:49 +0200 | [diff] [blame] | 103 | struct gprs_rlcmac_tbf *tbf, uint32_t cust, uint8_t single); |
Andreas Eversberg | a1503fa | 2012-07-22 08:58:09 +0200 | [diff] [blame] | 104 | #ifdef __cplusplus |
| 105 | } |
Andreas Eversberg | 8b761a3 | 2012-07-20 21:50:31 +0200 | [diff] [blame] | 106 | #endif |
Andreas Eversberg | 2b91464 | 2012-07-19 13:06:26 +0200 | [diff] [blame] | 107 | |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 108 | #endif // GPRS_RLCMAC_H |