Holger Hans Peter Freyther | cedf890 | 2013-10-19 20:47:12 +0200 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Copyright (C) 2012 Ivan Klyuchnikov |
| 4 | * Copyright (C) 2012 Andreas Eversberg <jolly@eversberg.eu> |
| 5 | * Copyright (C) 2013 by Holger Hans Peter Freyther |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License |
| 9 | * as published by the Free Software Foundation; either version 2 |
| 10 | * of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 20 | */ |
| 21 | #pragma once |
| 22 | |
| 23 | #include <stdint.h> |
| 24 | |
| 25 | extern "C" { |
| 26 | #include <osmocom/core/linuxlist.h> |
| 27 | } |
| 28 | |
Holger Hans Peter Freyther | 35cc1c0 | 2014-07-02 14:48:44 +0200 | [diff] [blame] | 29 | struct BTS; |
Holger Hans Peter Freyther | dea63b9 | 2013-10-26 18:56:43 +0200 | [diff] [blame] | 30 | struct gprs_rlcmac_pdch; |
Holger Hans Peter Freyther | cedf890 | 2013-10-19 20:47:12 +0200 | [diff] [blame] | 31 | |
| 32 | /* |
| 33 | * single block allocation entry |
| 34 | */ |
| 35 | struct gprs_rlcmac_sba { |
| 36 | struct llist_head list; |
Holger Hans Peter Freyther | 09ef27a | 2013-10-20 16:37:05 +0200 | [diff] [blame] | 37 | uint8_t trx_no; |
| 38 | uint8_t ts_no; |
Holger Hans Peter Freyther | cedf890 | 2013-10-19 20:47:12 +0200 | [diff] [blame] | 39 | uint32_t fn; |
| 40 | uint8_t ta; |
| 41 | }; |
| 42 | |
| 43 | /** |
| 44 | * I help to manage SingleBlockAssignment (SBA). |
| 45 | * |
| 46 | * TODO: Add a flush method.. |
| 47 | */ |
| 48 | class SBAController { |
| 49 | friend class PollController; |
| 50 | public: |
| 51 | SBAController(BTS &bts); |
| 52 | |
| 53 | int alloc(uint8_t *_trx, uint8_t *_ts, uint32_t *_fn, uint8_t ta); |
| 54 | gprs_rlcmac_sba *find(uint8_t trx, uint8_t ts, uint32_t fn); |
Holger Hans Peter Freyther | dea63b9 | 2013-10-26 18:56:43 +0200 | [diff] [blame] | 55 | gprs_rlcmac_sba *find(const gprs_rlcmac_pdch *pdch, uint32_t fn); |
Holger Hans Peter Freyther | cedf890 | 2013-10-19 20:47:12 +0200 | [diff] [blame] | 56 | |
| 57 | uint32_t sched(uint8_t trx, uint8_t ts, uint32_t fn, uint8_t block_nr); |
| 58 | |
| 59 | int timeout(struct gprs_rlcmac_sba *sba); |
Holger Hans Peter Freyther | 09ef27a | 2013-10-20 16:37:05 +0200 | [diff] [blame] | 60 | void free_resources(struct gprs_rlcmac_pdch *pdch); |
Holger Hans Peter Freyther | cedf890 | 2013-10-19 20:47:12 +0200 | [diff] [blame] | 61 | |
Holger Hans Peter Freyther | b98dd9e | 2013-10-27 10:20:37 +0100 | [diff] [blame] | 62 | void free_sba(gprs_rlcmac_sba *sba); |
| 63 | |
Holger Hans Peter Freyther | cedf890 | 2013-10-19 20:47:12 +0200 | [diff] [blame] | 64 | private: |
| 65 | BTS &m_bts; |
| 66 | llist_head m_sbas; |
| 67 | }; |