Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 1 | /* gprs_rlcmac.h |
| 2 | * |
| 3 | * Copyright (C) 2012 Ivan Klyuchnikov |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License |
| 7 | * as published by the Free Software Foundation; either version 2 |
| 8 | * of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | */ |
| 19 | |
| 20 | #ifndef GPRS_RLCMAC_H |
| 21 | #define GPRS_RLCMAC_H |
| 22 | |
Ivan Kluchnikov | 835f91e | 2012-04-30 18:00:36 +0400 | [diff] [blame] | 23 | #include <bitvector.h> |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 24 | #include <gsm_rlcmac.h> |
Ivan Kluchnikov | 61a33f7 | 2012-04-12 15:22:06 +0400 | [diff] [blame] | 25 | #include <gsm_timer.h> |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 26 | |
| 27 | extern "C" { |
| 28 | #include <osmocom/core/linuxlist.h> |
Ivan Kluchnikov | 61a33f7 | 2012-04-12 15:22:06 +0400 | [diff] [blame] | 29 | #include <osmocom/core/timer.h> |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 30 | } |
| 31 | |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 32 | /* This special feature will delay assignment of downlink TBF by one second, |
| 33 | * in case there is already a TBF. |
| 34 | * This is usefull to debug downlink establishment during packet idle mode. |
| 35 | */ |
| 36 | //#define DEBUG_DL_ASS_IDLE |
Ivan Kluchnikov | c5d8c27 | 2012-06-04 21:55:02 +0400 | [diff] [blame] | 37 | |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 38 | /* |
| 39 | * PDCH instanc |
| 40 | */ |
| 41 | |
| 42 | struct gprs_rlcmac_tbf; |
| 43 | |
| 44 | struct gprs_rlcmac_pdch { |
| 45 | uint8_t enable; /* TS is enabled */ |
| 46 | uint8_t tsc; /* TSC of this slot */ |
| 47 | uint8_t next_ul_tfi; /* next uplink TBF/TFI to schedule (0..31) */ |
| 48 | uint8_t next_dl_tfi; /* next downlink TBF/TFI to schedule (0..31) */ |
Andreas Eversberg | b0c7ea7 | 2012-07-13 14:46:03 +0200 | [diff] [blame] | 49 | struct gprs_rlcmac_tbf *ul_tbf[32]; /* array of UL TBF, by UL TFI */ |
| 50 | struct gprs_rlcmac_tbf *dl_tbf[32]; /* array of DL TBF, by DL TFI */ |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 51 | uint32_t last_rts_fn; /* store last frame number of RTS */ |
Ivan Kluchnikov | a9e6dc5 | 2012-06-17 08:30:06 +0400 | [diff] [blame] | 52 | }; |
| 53 | |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 54 | struct gprs_rlcmac_trx { |
| 55 | uint16_t arfcn; |
| 56 | struct gprs_rlcmac_pdch pdch[8]; |
| 57 | }; |
| 58 | |
| 59 | struct gprs_rlcmac_bts { |
Andreas Eversberg | b3c6f6c | 2012-07-06 07:40:08 +0200 | [diff] [blame] | 60 | uint8_t cs1; |
| 61 | uint8_t cs2; |
| 62 | uint8_t cs3; |
| 63 | uint8_t cs4; |
| 64 | uint8_t initial_cs; |
| 65 | uint8_t t3142; |
| 66 | uint8_t t3169; |
| 67 | uint8_t t3191; |
| 68 | uint16_t t3193_msec; |
| 69 | uint8_t t3195; |
| 70 | uint8_t n3101; |
| 71 | uint8_t n3103; |
| 72 | uint8_t n3105; |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 73 | struct gprs_rlcmac_trx trx[8]; |
Andreas Eversberg | 592e04a | 2012-07-15 06:25:37 +0200 | [diff] [blame] | 74 | int (*alloc_algorithm)(struct gprs_rlcmac_tbf *old_tbf, |
| 75 | struct gprs_rlcmac_tbf *tbf, uint32_t cust); |
| 76 | uint32_t alloc_algorithm_curst; /* options to customize algorithm */ |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 77 | }; |
| 78 | |
| 79 | extern struct gprs_rlcmac_bts *gprs_rlcmac_bts; |
| 80 | |
| 81 | /* |
| 82 | * TBF instance |
| 83 | */ |
| 84 | |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 85 | #define LLC_MAX_LEN 1543 |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 86 | #define RLC_MAX_SNS 128 /* GPRS, must be power of 2 */ |
| 87 | #define RLC_MAX_WS 64 /* max window size */ |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 88 | #define RLC_MAX_LEN 54 /* CS-4 including spare bits */ |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 89 | |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 90 | #define Tassign_agch 0,500000/* wait for assignment, before transmitting DL */ |
| 91 | #define Tassign_pacch 0,100000/* wait for assignment, before transmitting DL */ |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 92 | |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 93 | enum gprs_rlcmac_tbf_state { |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 94 | GPRS_RLCMAC_NULL = 0, /* new created TBF */ |
| 95 | GPRS_RLCMAC_ASSIGN, /* wait for downlink assignment */ |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 96 | GPRS_RLCMAC_FLOW, /* RLC/MAC flow, ressource needed */ |
| 97 | GPRS_RLCMAC_FINISHED, /* flow finished, wait for release */ |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 98 | GPRS_RLCMAC_WAIT_RELEASE,/* wait for release or restart of DL TBF */ |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 99 | GPRS_RLCMAC_RELEASING, /* releasing, wait to free TBI/USF */ |
| 100 | }; |
| 101 | |
| 102 | enum gprs_rlcmac_tbf_poll_state { |
| 103 | GPRS_RLCMAC_POLL_NONE = 0, |
| 104 | GPRS_RLCMAC_POLL_SCHED, /* a polling was scheduled */ |
| 105 | }; |
| 106 | |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 107 | enum gprs_rlcmac_tbf_dl_ass_state { |
| 108 | GPRS_RLCMAC_DL_ASS_NONE = 0, |
| 109 | GPRS_RLCMAC_DL_ASS_SEND_ASS, /* send downlink assignment on next RTS */ |
| 110 | GPRS_RLCMAC_DL_ASS_WAIT_ACK, /* wait for PACKET CONTROL ACK */ |
| 111 | }; |
| 112 | |
| 113 | enum gprs_rlcmac_tbf_ul_ass_state { |
| 114 | GPRS_RLCMAC_UL_ASS_NONE = 0, |
| 115 | GPRS_RLCMAC_UL_ASS_SEND_ASS, /* send uplink assignment on next RTS */ |
| 116 | GPRS_RLCMAC_UL_ASS_WAIT_ACK, /* wait for PACKET CONTROL ACK */ |
| 117 | }; |
| 118 | |
| 119 | enum gprs_rlcmac_tbf_ul_ack_state { |
| 120 | GPRS_RLCMAC_UL_ACK_NONE = 0, |
| 121 | GPRS_RLCMAC_UL_ACK_SEND_ACK, /* send acknowledge on next RTS */ |
| 122 | GPRS_RLCMAC_UL_ACK_WAIT_ACK, /* wait for PACKET CONTROL ACK */ |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 123 | }; |
| 124 | |
| 125 | enum gprs_rlcmac_tbf_direction { |
| 126 | GPRS_RLCMAC_DL_TBF, |
| 127 | GPRS_RLCMAC_UL_TBF |
| 128 | }; |
| 129 | |
| 130 | struct gprs_rlcmac_tbf { |
| 131 | struct llist_head list; |
| 132 | enum gprs_rlcmac_tbf_state state; |
| 133 | enum gprs_rlcmac_tbf_direction direction; |
| 134 | uint8_t tfi; |
| 135 | uint32_t tlli; |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 136 | uint8_t tlli_valid; |
Andreas Eversberg | b0c7ea7 | 2012-07-13 14:46:03 +0200 | [diff] [blame] | 137 | uint8_t trx; |
| 138 | uint16_t arfcn; |
| 139 | uint8_t tsc; |
Andreas Eversberg | 592e04a | 2012-07-15 06:25:37 +0200 | [diff] [blame] | 140 | uint8_t first_ts; /* first TS used by TBF */ |
| 141 | uint8_t first_common_ts; /* first TS that the phone can send and |
| 142 | reveive simultaniously */ |
| 143 | uint8_t control_ts; /* timeslot control messages and polling */ |
Andreas Eversberg | f298fa8 | 2012-07-13 14:50:57 +0200 | [diff] [blame] | 144 | uint8_t ms_class; |
Andreas Eversberg | b0c7ea7 | 2012-07-13 14:46:03 +0200 | [diff] [blame] | 145 | struct gprs_rlcmac_pdch *pdch[8]; /* list of PDCHs allocated to TBF */ |
| 146 | uint16_t ta; |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 147 | uint8_t llc_frame[LLC_MAX_LEN]; /* current DL or UL frame */ |
| 148 | uint16_t llc_index; /* current write/read position of frame */ |
| 149 | uint16_t llc_length; /* len of current DL LLC_frame, 0 == no frame */ |
| 150 | llist_head llc_queue; /* queued LLC DL data */ |
| 151 | |
| 152 | enum gprs_rlcmac_tbf_dl_ass_state dl_ass_state; |
| 153 | enum gprs_rlcmac_tbf_ul_ass_state ul_ass_state; |
| 154 | enum gprs_rlcmac_tbf_ul_ack_state ul_ack_state; |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 155 | |
| 156 | enum gprs_rlcmac_tbf_poll_state poll_state; |
Andreas Eversberg | b0c7ea7 | 2012-07-13 14:46:03 +0200 | [diff] [blame] | 157 | uint32_t poll_fn; /* frame number to poll */ |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 158 | |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 159 | uint16_t ws; /* window size */ |
| 160 | uint16_t sns; /* sequence number space */ |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 161 | |
| 162 | /* Please note that all variables here will be reset when changing |
| 163 | * from WAIT RELEASE back to FLOW state (re-use of TBF). |
| 164 | * All states that need reset must be in this struct, so this is why |
| 165 | * variables are in both (dl and ul) structs and not outside union. |
| 166 | */ |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 167 | union { |
| 168 | struct { |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 169 | uint16_t bsn; /* block sequence number */ |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 170 | uint16_t v_s; /* send state */ |
| 171 | uint16_t v_a; /* ack state */ |
| 172 | char v_b[RLC_MAX_SNS/2]; /* acknowledge state array */ |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 173 | int32_t tx_counter; /* count all transmitted blocks */ |
| 174 | uint8_t n3105; /* N3105 counter */ |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 175 | } dl; |
| 176 | struct { |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 177 | uint16_t bsn; /* block sequence number */ |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 178 | uint16_t v_r; /* receive state */ |
| 179 | uint16_t v_q; /* receive window state */ |
| 180 | char v_n[RLC_MAX_SNS/2]; /* receive state array */ |
| 181 | int32_t rx_counter; /* count all received blocks */ |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 182 | uint8_t n3103; /* N3103 counter */ |
Andreas Eversberg | b0c7ea7 | 2012-07-13 14:46:03 +0200 | [diff] [blame] | 183 | uint8_t usf[8]; /* list USFs per PDCH (timeslot) */ |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 184 | } ul; |
| 185 | } dir; |
| 186 | uint8_t rlc_block[RLC_MAX_SNS/2][RLC_MAX_LEN]; /* block history */ |
| 187 | uint8_t rlc_block_len[RLC_MAX_SNS/2]; /* block len of history */ |
Ivan Kluchnikov | 61a33f7 | 2012-04-12 15:22:06 +0400 | [diff] [blame] | 188 | |
| 189 | struct osmo_timer_list timer; |
| 190 | unsigned int T; /* Txxxx number */ |
| 191 | unsigned int num_T_exp; /* number of consecutive T expirations */ |
| 192 | |
| 193 | struct osmo_gsm_timer_list gsm_timer; |
| 194 | unsigned int fT; /* fTxxxx number */ |
| 195 | unsigned int num_fT_exp; /* number of consecutive fT expirations */ |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 196 | }; |
| 197 | |
Andreas Eversberg | b0c7ea7 | 2012-07-13 14:46:03 +0200 | [diff] [blame] | 198 | extern struct llist_head gprs_rlcmac_ul_tbfs; /* list of uplink TBFs */ |
| 199 | extern struct llist_head gprs_rlcmac_dl_tbfs; /* list of downlink TBFs */ |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 200 | |
Andreas Eversberg | b0c7ea7 | 2012-07-13 14:46:03 +0200 | [diff] [blame] | 201 | int tfi_alloc(enum gprs_rlcmac_tbf_direction dir, uint8_t *_trx, uint8_t *_ts, |
| 202 | uint8_t use_trx, uint8_t first_ts); |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 203 | |
Andreas Eversberg | 592e04a | 2012-07-15 06:25:37 +0200 | [diff] [blame] | 204 | struct gprs_rlcmac_tbf *tbf_alloc(struct gprs_rlcmac_tbf *old_tbf, |
| 205 | enum gprs_rlcmac_tbf_direction dir, uint8_t tfi, uint8_t trx, |
| 206 | uint8_t first_ts, uint8_t ms_class, uint8_t single_slot); |
Andreas Eversberg | f298fa8 | 2012-07-13 14:50:57 +0200 | [diff] [blame] | 207 | |
Andreas Eversberg | 592e04a | 2012-07-15 06:25:37 +0200 | [diff] [blame] | 208 | int alloc_algorithm_a(struct gprs_rlcmac_tbf *old_tbf, |
| 209 | struct gprs_rlcmac_tbf *tbf, uint32_t cust); |
| 210 | |
| 211 | int alloc_algorithm_b(struct gprs_rlcmac_tbf *old_tbf, |
| 212 | struct gprs_rlcmac_tbf *tbf, uint32_t cust); |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 213 | |
Andreas Eversberg | b0c7ea7 | 2012-07-13 14:46:03 +0200 | [diff] [blame] | 214 | struct gprs_rlcmac_tbf *tbf_by_tfi(uint8_t tfi, uint8_t trx, uint8_t ts, |
| 215 | enum gprs_rlcmac_tbf_direction dir); |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 216 | |
Andreas Eversberg | b0c7ea7 | 2012-07-13 14:46:03 +0200 | [diff] [blame] | 217 | struct gprs_rlcmac_tbf *tbf_by_tlli(uint32_t tlli, |
| 218 | enum gprs_rlcmac_tbf_direction dir); |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 219 | |
Andreas Eversberg | b0c7ea7 | 2012-07-13 14:46:03 +0200 | [diff] [blame] | 220 | struct gprs_rlcmac_tbf *tbf_by_poll_fn(uint32_t fn, uint8_t trx, uint8_t ts); |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 221 | |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 222 | void tbf_free(struct gprs_rlcmac_tbf *tbf); |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 223 | |
Andreas Eversberg | 592e04a | 2012-07-15 06:25:37 +0200 | [diff] [blame] | 224 | int tbf_update(struct gprs_rlcmac_tbf *tbf); |
| 225 | |
| 226 | int tbf_assign_control_ts(struct gprs_rlcmac_tbf *tbf); |
| 227 | |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 228 | void tbf_new_state(struct gprs_rlcmac_tbf *tbf, |
| 229 | enum gprs_rlcmac_tbf_state state); |
| 230 | |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 231 | void tbf_timer_start(struct gprs_rlcmac_tbf *tbf, unsigned int T, |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 232 | unsigned int seconds, unsigned int microseconds); |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 233 | |
| 234 | void tbf_timer_stop(struct gprs_rlcmac_tbf *tbf); |
| 235 | |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 236 | /* TS 44.060 Section 10.4.7 Table 10.4.7.1: Payload Type field */ |
| 237 | enum gprs_rlcmac_block_type { |
| 238 | GPRS_RLCMAC_DATA_BLOCK = 0x0, |
| 239 | GPRS_RLCMAC_CONTROL_BLOCK = 0x1, |
| 240 | GPRS_RLCMAC_CONTROL_BLOCK_OPT = 0x2, |
| 241 | GPRS_RLCMAC_RESERVED = 0x3 |
| 242 | }; |
| 243 | |
Andreas Eversberg | b0c7ea7 | 2012-07-13 14:46:03 +0200 | [diff] [blame] | 244 | int gprs_rlcmac_rcv_block(uint8_t trx, uint8_t ts, uint8_t *data, uint8_t len, |
| 245 | uint32_t fn); |
Ivan Kluchnikov | a9e6dc5 | 2012-06-17 08:30:06 +0400 | [diff] [blame] | 246 | |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 247 | int write_immediate_assignment(bitvec * dest, uint8_t downlink, uint8_t ra, |
| 248 | uint32_t fn, uint8_t ta, uint16_t arfcn, uint8_t ts, uint8_t tsc, |
| 249 | uint8_t tfi, uint8_t usf, uint32_t tlli, uint8_t polling, |
| 250 | uint32_t poll_fn); |
Ivan Kluchnikov | cf7b3a5 | 2012-06-26 16:54:22 +0400 | [diff] [blame] | 251 | |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 252 | void write_packet_uplink_assignment(bitvec * dest, uint8_t old_tfi, |
Andreas Eversberg | b0c7ea7 | 2012-07-13 14:46:03 +0200 | [diff] [blame] | 253 | uint8_t old_downlink, uint32_t tlli, uint8_t use_tlli, |
| 254 | struct gprs_rlcmac_tbf *tbf, uint8_t poll); |
Ivan Kluchnikov | a9e6dc5 | 2012-06-17 08:30:06 +0400 | [diff] [blame] | 255 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 256 | void write_packet_downlink_assignment(RlcMacDownlink_t * block, uint8_t old_tfi, |
Andreas Eversberg | b0c7ea7 | 2012-07-13 14:46:03 +0200 | [diff] [blame] | 257 | uint8_t old_downlink, struct gprs_rlcmac_tbf *tbf, uint8_t poll); |
| 258 | |
| 259 | |
Ivan Kluchnikov | a9e6dc5 | 2012-06-17 08:30:06 +0400 | [diff] [blame] | 260 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 261 | void write_packet_uplink_ack(RlcMacDownlink_t * block, struct gprs_rlcmac_tbf *tbf, |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 262 | uint8_t final); |
Ivan Kluchnikov | a9e6dc5 | 2012-06-17 08:30:06 +0400 | [diff] [blame] | 263 | |
Andreas Eversberg | 3e372d5 | 2012-07-06 09:28:15 +0200 | [diff] [blame] | 264 | int gprs_rlcmac_tx_ul_ud(gprs_rlcmac_tbf *tbf); |
Ivan Kluchnikov | a9e6dc5 | 2012-06-17 08:30:06 +0400 | [diff] [blame] | 265 | |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 266 | void tbf_timer_cb(void *_tbf); |
Ivan Kluchnikov | a9e6dc5 | 2012-06-17 08:30:06 +0400 | [diff] [blame] | 267 | |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 268 | int gprs_rlcmac_poll_timeout(struct gprs_rlcmac_tbf *tbf); |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 269 | |
| 270 | int gprs_rlcmac_rcv_rach(uint8_t ra, uint32_t Fn, int16_t qta); |
Ivan Kluchnikov | 5310d45 | 2012-04-17 22:00:31 +0400 | [diff] [blame] | 271 | |
Andreas Eversberg | b0c7ea7 | 2012-07-13 14:46:03 +0200 | [diff] [blame] | 272 | int gprs_rlcmac_rcv_control_block(bitvec *rlc_block, uint8_t trx, uint8_t ts, |
| 273 | uint32_t fn); |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 274 | |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 275 | struct msgb *gprs_rlcmac_send_packet_uplink_assignment( |
| 276 | struct gprs_rlcmac_tbf *tbf, uint32_t fn); |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 277 | |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 278 | struct msgb *gprs_rlcmac_send_packet_downlink_assignment( |
| 279 | struct gprs_rlcmac_tbf *tbf, uint32_t fn); |
Ivan Kluchnikov | c320d86 | 2012-03-18 15:04:48 +0400 | [diff] [blame] | 280 | |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 281 | void gprs_rlcmac_trigger_downlink_assignment(gprs_rlcmac_tbf *tbf, |
Andreas Eversberg | e13fa2d | 2012-07-09 17:10:44 +0200 | [diff] [blame] | 282 | uint8_t old_downlink, char *imsi); |
Ivan Kluchnikov | c7e7f68 | 2012-06-29 22:53:15 +0400 | [diff] [blame] | 283 | |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 284 | int gprs_rlcmac_downlink_ack(struct gprs_rlcmac_tbf *tbf, uint8_t final, |
| 285 | uint8_t ssn, uint8_t *rbb); |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 286 | |
Andreas Eversberg | b0c7ea7 | 2012-07-13 14:46:03 +0200 | [diff] [blame] | 287 | int gprs_rlcmac_rcv_data_block_acknowledged(uint8_t trx, uint8_t ts, |
| 288 | uint8_t *data, uint8_t len); |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 289 | |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 290 | struct msgb *gprs_rlcmac_send_data_block_acknowledged( |
Andreas Eversberg | 592e04a | 2012-07-15 06:25:37 +0200 | [diff] [blame] | 291 | struct gprs_rlcmac_tbf *tbf, uint32_t fn, uint8_t ts); |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 292 | |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 293 | struct msgb *gprs_rlcmac_send_uplink_ack(struct gprs_rlcmac_tbf *tbf, |
| 294 | uint32_t fn); |
Ivan Kluchnikov | 9c795ab | 2012-05-24 23:12:59 +0400 | [diff] [blame] | 295 | |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 296 | int gprs_rlcmac_rcv_rts_block(uint8_t trx, uint8_t ts, uint16_t arfcn, |
| 297 | uint32_t fn, uint8_t block_nr); |
| 298 | |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 299 | #endif // GPRS_RLCMAC_H |