7 #include <osmocom/core/linuxlist.h>
12 struct l1gprs_tbf_pending_req
{
13 /*! Item in l1gprs_state->tbf_list_pending */
14 struct llist_head list
;
15 /*! Uplink or Downlink */
17 /*! TBF reference number (not index) */
19 /*! PDCH timeslots used by this TBF */
21 /*! (Downlink only) DL TFI (Temporary Flow Indentity): 0..31 */
23 /*! TBF starting time (absolute TDMA Fn) */
28 /*! Item in l1gprs_state->tbf_list */
29 struct llist_head list
;
30 /*! Uplink or Downlink */
32 /*! TBF reference number (not index) */
34 /*! PDCH timeslots used by this TBF */
36 /*! (Downlink only) DL TFI (Temporary Flow Indentity): 0..31 */
41 /*! Timeslot number */
43 /*! Backpointer to l1gprs_state we belong to */
44 struct l1gprs_state
*gprs
;
51 /*! Pending UL TBF count */
52 uint8_t pending_ul_tbf_count
;
53 /*! Pending DL TBF count */
54 uint8_t pending_dl_tbf_count
;
57 static inline size_t l1gprs_pdch_use_count(const struct l1gprs_pdch
*pdch
)
59 return pdch
->ul_tbf_count
+ pdch
->dl_tbf_count
+
60 pdch
->pending_ul_tbf_count
+ pdch
->pending_dl_tbf_count
;
64 typedef void (*l1gprs_pdch_changed_t
)(struct l1gprs_pdch
*pdch
, bool active
);
67 /*! PDCH state for each timeslot */
68 struct l1gprs_pdch pdch
[8];
69 /*! Uplink and Downlink TBFs (active), struct l1gprs_pending_tbf */
70 struct llist_head tbf_list
;
71 /*! Uplink and Downlink TBFs (pending), struct l1gprs_tbf_pending_req */
72 struct llist_head tbf_list_pending
;
73 /*! Logging context (used as prefix for messages) */
75 /*! Some private data for API user */
77 /*! Callback triggered to signal lower layers when a PDCH TS has to be activated/deactivated */
78 l1gprs_pdch_changed_t pdch_changed_cb
;
81 void l1gprs_logging_init(int logc
);
82 struct l1gprs_state
*l1gprs_state_alloc(void *ctx
, const char *log_prefix
, void *priv
);
83 void l1gprs_state_free(struct l1gprs_state
*gprs
);
84 void l1gprs_state_set_pdch_changed_cb(struct l1gprs_state
*gprs
, l1gprs_pdch_changed_t pdch_changed_cb
);
86 int l1gprs_handle_ul_tbf_cfg_req(struct l1gprs_state
*gprs
, const struct msgb
*msg
);
87 int l1gprs_handle_dl_tbf_cfg_req(struct l1gprs_state
*gprs
, const struct msgb
*msg
);
89 struct l1gprs_prim_block_hdr
{
94 struct l1gprs_prim_ul_block_req
{
95 struct l1gprs_prim_block_hdr hdr
;
100 struct l1gprs_prim_dl_block_ind
{
101 struct l1gprs_prim_block_hdr hdr
;
111 int l1gprs_handle_ul_block_req(struct l1gprs_state
*gprs
,
112 struct l1gprs_prim_ul_block_req
*req
,
113 const struct msgb
*msg
);
114 struct msgb
*l1gprs_handle_ul_block_cnf(struct l1gprs_state
*gprs
,
115 uint32_t fn
, uint8_t tn
,
118 struct msgb
*l1gprs_handle_dl_block_ind(struct l1gprs_state
*gprs
,
119 const struct l1gprs_prim_dl_block_ind
*ind
, uint8_t *usf
);
120 struct msgb
*l1gprs_handle_rts_ind(struct l1gprs_state
*gprs
, uint32_t fn
, uint8_t tn
, uint8_t usf
);