diff options
Diffstat (limited to 'src/tbf_ul.h')
-rw-r--r-- | src/tbf_ul.h | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/src/tbf_ul.h b/src/tbf_ul.h index 0dc2336d..7a4c70c7 100644 --- a/src/tbf_ul.h +++ b/src/tbf_ul.h @@ -11,10 +11,6 @@ * 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. */ #pragma once @@ -24,10 +20,12 @@ #include <stdbool.h> #include "tbf.h" +#include "rlc_window_ul.h" #ifdef __cplusplus extern "C" { #endif +#include <tbf_fsm.h> #include <tbf_ul_ack_fsm.h> #ifdef __cplusplus } @@ -61,8 +59,9 @@ enum tbf_egprs_ul_counters { struct gprs_rlcmac_ul_tbf : public gprs_rlcmac_tbf { gprs_rlcmac_ul_tbf(struct gprs_rlcmac_bts *bts, GprsMs *ms); - ~gprs_rlcmac_ul_tbf(); - gprs_rlc_window *window(); + ~gprs_rlcmac_ul_tbf(void); + gprs_rlc_window *window(void); + void apply_allocated_resources(const struct alloc_resources_res *res); /* blocks were acked */ int rcv_data_block_acknowledged( const struct gprs_rlc_data_info *rlc, @@ -71,7 +70,7 @@ struct gprs_rlcmac_ul_tbf : public gprs_rlcmac_tbf { /* TODO: extract LLC class? */ int assemble_forward_llc(const gprs_rlc_data *data); - int snd_ul_ud(); + int snd_ul_ud(void); egprs_rlc_ul_reseg_bsn_state handle_egprs_ul_spb( const struct gprs_rlc_data_info *rlc, @@ -88,12 +87,12 @@ struct gprs_rlcmac_ul_tbf : public gprs_rlcmac_tbf { struct gprs_rlc_data *block, uint8_t *data, const uint8_t block_idx); - uint16_t window_size() const; - void set_window_size(); + uint16_t window_size(void) const; + void set_window_size(void); void update_coding_scheme_counter_ul(enum CodingScheme cs); - void usf_timeout(); - void contention_resolution_start(); - void contention_resolution_success(); + void usf_timeout(void); + void contention_resolution_start(void); + void contention_resolution_success(void); /* Please note that all variables here will be reset when changing * from WAIT RELEASE back to FLOW state (re-use of TBF). @@ -102,12 +101,13 @@ struct gprs_rlcmac_ul_tbf : public gprs_rlcmac_tbf { */ int32_t m_rx_counter; /* count all received blocks */ uint8_t m_usf[8]; /* list USFs per PDCH (timeslot), initialized to USF_INVALID */ - uint8_t m_contention_resolution_done; /* set after done */ + bool m_contention_resolution_done; /* set after done */ struct rate_ctr_group *m_ul_gprs_ctrs; struct rate_ctr_group *m_ul_egprs_ctrs; - struct tbf_ul_ass_fsm_ctx ul_ack_fsm; + struct tbf_ul_fsm_ctx state_fsm; + struct tbf_ul_ack_fsm_ctx ul_ack_fsm; protected: void maybe_schedule_uplink_acknack(const gprs_rlc_data_info *rlc, bool countdown_finished); @@ -125,11 +125,6 @@ inline uint16_t gprs_rlcmac_ul_tbf::window_size() const return m_window.ws(); } -struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_tbf(struct gprs_rlcmac_bts *bts, GprsMs *ms, int8_t use_trx, bool single_slot); -struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_pacch(struct gprs_rlcmac_bts *bts, GprsMs *ms, int8_t use_trx); -struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_ccch(struct gprs_rlcmac_bts *bts, struct GprsMs *ms); -struct gprs_rlcmac_ul_tbf *handle_tbf_reject(struct gprs_rlcmac_bts *bts, - GprsMs *ms, uint8_t trx_no, uint8_t ts_no); #else /* ifdef __cplusplus */ struct gprs_rlcmac_ul_tbf; @@ -139,15 +134,29 @@ struct gprs_rlcmac_ul_tbf; #ifdef __cplusplus extern "C" { #endif +struct gprs_rlcmac_ul_tbf *ul_tbf_alloc(struct gprs_rlcmac_bts *bts, struct GprsMs *ms); void update_tbf_ta(struct gprs_rlcmac_ul_tbf *tbf, int8_t ta_delta); void set_tbf_ta(struct gprs_rlcmac_ul_tbf *tbf, uint8_t ta); -struct gprs_rlcmac_ul_tbf *as_ul_tbf(struct gprs_rlcmac_tbf *tbf); +struct gprs_rlcmac_ul_tbf *tbf_as_ul_tbf(struct gprs_rlcmac_tbf *tbf); +const struct gprs_rlcmac_ul_tbf *tbf_as_ul_tbf_const(const struct gprs_rlcmac_tbf *tbf); void tbf_usf_timeout(struct gprs_rlcmac_ul_tbf *tbf); +void ul_tbf_apply_allocated_resources(struct gprs_rlcmac_ul_tbf *ul_tbf, const struct alloc_resources_res *res); +void ul_tbf_contention_resolution_start(struct gprs_rlcmac_ul_tbf *tbf); +void ul_tbf_contention_resolution_success(struct gprs_rlcmac_ul_tbf *tbf); bool ul_tbf_contention_resolution_done(const struct gprs_rlcmac_ul_tbf *tbf); struct osmo_fsm_inst *tbf_ul_ack_fi(const struct gprs_rlcmac_ul_tbf *tbf); -void ul_tbf_contention_resolution_success(struct gprs_rlcmac_ul_tbf *tbf); -#define LOGPTBFUL(tbf, level, fmt, args...) LOGP(DTBFUL, level, "%s " fmt, tbf_name(tbf), ## args) +static inline struct gprs_rlcmac_tbf *ul_tbf_as_tbf(struct gprs_rlcmac_ul_tbf *ul_tbf) +{ + return (struct gprs_rlcmac_tbf *)ul_tbf; +} + +static inline const struct gprs_rlcmac_tbf *ul_tbf_as_tbf_const(const struct gprs_rlcmac_ul_tbf *ul_tbf) +{ + return (const struct gprs_rlcmac_tbf *)ul_tbf; +} + +#define LOGPTBFUL(ul_tbf, level, fmt, args...) LOGP(DTBFUL, level, "%s " fmt, tbf_name(ul_tbf_as_tbf_const(ul_tbf)), ## args) #ifdef __cplusplus } #endif |