trxcon: use 'l1sched_' prefix for scheduler API

Change-Id: I370aa5084a4e3eb94168b96df94dbbee606adaab
Related: OS#5599, OS#3761
This commit is contained in:
Vadim Yanitskiy 2022-07-02 01:42:26 +07:00
parent f73db50f6b
commit 38373ee20f
18 changed files with 563 additions and 563 deletions

View File

@ -21,32 +21,32 @@
#define GPRS_L2_MAX_LEN 54 #define GPRS_L2_MAX_LEN 54
#define EDGE_L2_MAX_LEN 155 #define EDGE_L2_MAX_LEN 155
#define TRX_CH_LID_DEDIC 0x00 #define L1SCHED_CH_LID_DEDIC 0x00
#define TRX_CH_LID_SACCH 0x40 #define L1SCHED_CH_LID_SACCH 0x40
/* Osmocom-specific extension for PTCCH (see 3GPP TS 45.002, section 3.3.4.2). /* Osmocom-specific extension for PTCCH (see 3GPP TS 45.002, section 3.3.4.2).
* Shall be used to distinguish PTCCH and PDTCH channels on a PDCH time-slot. */ * Shall be used to distinguish PTCCH and PDTCH channels on a PDCH time-slot. */
#define TRX_CH_LID_PTCCH 0x80 #define L1SCHED_CH_LID_PTCCH 0x80
/* Is a channel related to PDCH (GPRS) */ /* Is a channel related to PDCH (GPRS) */
#define TRX_CH_FLAG_PDCH (1 << 0) #define L1SCHED_CH_FLAG_PDCH (1 << 0)
/* Should a channel be activated automatically */ /* Should a channel be activated automatically */
#define TRX_CH_FLAG_AUTO (1 << 1) #define L1SCHED_CH_FLAG_AUTO (1 << 1)
/* Is continuous burst transmission assumed */ /* Is continuous burst transmission assumed */
#define TRX_CH_FLAG_CBTX (1 << 2) #define L1SCHED_CH_FLAG_CBTX (1 << 2)
#define MAX_A5_KEY_LEN (128 / 8) #define MAX_A5_KEY_LEN (128 / 8)
#define TRX_TS_COUNT 8 #define TRX_TS_COUNT 8
/* Forward declaration to avoid mutual include */ /* Forward declaration to avoid mutual include */
struct trx_lchan_state; struct l1sched_lchan_state;
struct trx_meas_set; struct l1sched_meas_set;
struct trx_instance; struct trx_instance;
struct trx_ts; struct l1sched_ts;
enum trx_burst_type { enum l1sched_burst_type {
TRX_BURST_GMSK, L1SCHED_BURST_GMSK,
TRX_BURST_8PSK, L1SCHED_BURST_8PSK,
}; };
/** /**
@ -98,7 +98,7 @@ enum l1sched_lchan_type {
}; };
/* Represents a burst to be transmitted */ /* Represents a burst to be transmitted */
struct sched_burst_req { struct l1sched_burst_req {
uint32_t fn; uint32_t fn;
uint8_t tn; uint8_t tn;
uint8_t pwr; uint8_t pwr;
@ -110,16 +110,16 @@ struct sched_burst_req {
size_t burst_len; size_t burst_len;
}; };
typedef int trx_lchan_rx_func(struct trx_instance *trx, typedef int l1sched_lchan_rx_func(struct trx_instance *trx,
struct trx_ts *ts, struct trx_lchan_state *lchan, struct l1sched_ts *ts, struct l1sched_lchan_state *lchan,
uint32_t fn, uint8_t bid, const sbit_t *bits, uint32_t fn, uint8_t bid, const sbit_t *bits,
const struct trx_meas_set *meas); const struct l1sched_meas_set *meas);
typedef int trx_lchan_tx_func(struct trx_instance *trx, struct trx_ts *ts, typedef int l1sched_lchan_tx_func(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, struct l1sched_lchan_state *lchan,
struct sched_burst_req *br); struct l1sched_burst_req *br);
struct trx_lchan_desc { struct l1sched_lchan_desc {
/*! Human-readable name */ /*! Human-readable name */
const char *name; const char *name;
/*! Human-readable description */ /*! Human-readable description */
@ -140,12 +140,12 @@ struct trx_lchan_desc {
uint8_t flags; uint8_t flags;
/*! Function to call when burst received from PHY */ /*! Function to call when burst received from PHY */
trx_lchan_rx_func *rx_fn; l1sched_lchan_rx_func *rx_fn;
/*! Function to call when data received from L2 */ /*! Function to call when data received from L2 */
trx_lchan_tx_func *tx_fn; l1sched_lchan_tx_func *tx_fn;
}; };
struct trx_frame { struct l1sched_tdma_frame {
/*! Downlink channel (slot) type */ /*! Downlink channel (slot) type */
enum l1sched_lchan_type dl_chan; enum l1sched_lchan_type dl_chan;
/*! Downlink block ID */ /*! Downlink block ID */
@ -156,7 +156,7 @@ struct trx_frame {
uint8_t ul_bid; uint8_t ul_bid;
}; };
struct trx_multiframe { struct l1sched_tdma_multiframe {
/*! Channel combination */ /*! Channel combination */
enum gsm_phys_chan_config chan_config; enum gsm_phys_chan_config chan_config;
/*! Human-readable name */ /*! Human-readable name */
@ -168,10 +168,10 @@ struct trx_multiframe {
/*! Contains which lchans */ /*! Contains which lchans */
uint64_t lchan_mask; uint64_t lchan_mask;
/*! Pointer to scheduling structure */ /*! Pointer to scheduling structure */
const struct trx_frame *frames; const struct l1sched_tdma_frame *frames;
}; };
struct trx_meas_set { struct l1sched_meas_set {
/*! TDMA frame number of the first burst this set belongs to */ /*! TDMA frame number of the first burst this set belongs to */
uint32_t fn; uint32_t fn;
/*! ToA256 (Timing of Arrival, 1/256 of a symbol) */ /*! ToA256 (Timing of Arrival, 1/256 of a symbol) */
@ -181,13 +181,13 @@ struct trx_meas_set {
}; };
/* Simple ring buffer (up to 8 unique measurements) */ /* Simple ring buffer (up to 8 unique measurements) */
struct trx_lchan_meas_hist { struct l1sched_lchan_meas_hist {
struct trx_meas_set buf[8]; struct l1sched_meas_set buf[8];
struct trx_meas_set *head; struct l1sched_meas_set *head;
}; };
/* States each channel on a multiframe */ /* States each channel on a multiframe */
struct trx_lchan_state { struct l1sched_lchan_state {
/*! Channel type */ /*! Channel type */
enum l1sched_lchan_type type; enum l1sched_lchan_type type;
/*! Channel status */ /*! Channel status */
@ -196,7 +196,7 @@ struct trx_lchan_state {
struct llist_head list; struct llist_head list;
/*! Burst type: GMSK or 8PSK */ /*! Burst type: GMSK or 8PSK */
enum trx_burst_type burst_type; enum l1sched_burst_type burst_type;
/*! Mask of received bursts */ /*! Mask of received bursts */
uint8_t rx_burst_mask; uint8_t rx_burst_mask;
/*! Mask of transmitted bursts */ /*! Mask of transmitted bursts */
@ -207,7 +207,7 @@ struct trx_lchan_state {
ubit_t *tx_bursts; ubit_t *tx_bursts;
/*! A primitive being sent */ /*! A primitive being sent */
struct trx_ts_prim *prim; struct l1sched_ts_prim *prim;
/*! Mode for TCH channels (see GSM48_CMODE_*) */ /*! Mode for TCH channels (see GSM48_CMODE_*) */
uint8_t tch_mode; uint8_t tch_mode;
@ -218,9 +218,9 @@ struct trx_lchan_state {
uint8_t ul_facch_blocks; uint8_t ul_facch_blocks;
/*! Downlink measurements history */ /*! Downlink measurements history */
struct trx_lchan_meas_hist meas_hist; struct l1sched_lchan_meas_hist meas_hist;
/*! AVG measurements of the last received block */ /*! AVG measurements of the last received block */
struct trx_meas_set meas_avg; struct l1sched_meas_set meas_avg;
/*! TDMA loss detection state */ /*! TDMA loss detection state */
struct { struct {
@ -272,15 +272,15 @@ struct trx_lchan_state {
} a5; } a5;
/* TS that this lchan belongs to */ /* TS that this lchan belongs to */
struct trx_ts *ts; struct l1sched_ts *ts;
}; };
struct trx_ts { struct l1sched_ts {
/*! Timeslot index within a frame (0..7) */ /*! Timeslot index within a frame (0..7) */
uint8_t index; uint8_t index;
/*! Pointer to multiframe layout */ /*! Pointer to multiframe layout */
const struct trx_multiframe *mf_layout; const struct l1sched_tdma_multiframe *mf_layout;
/*! Channel states for logical channels */ /*! Channel states for logical channels */
struct llist_head lchans; struct llist_head lchans;
/*! Queue primitives for TX */ /*! Queue primitives for TX */
@ -289,8 +289,8 @@ struct trx_ts {
struct trx_instance *trx; struct trx_instance *trx;
}; };
/* Represents one TX primitive in the queue of trx_ts */ /* Represents one TX primitive in the queue of l1sched_ts */
struct trx_ts_prim { struct l1sched_ts_prim {
/*! Link to queue of TS */ /*! Link to queue of TS */
struct llist_head list; struct llist_head list;
/*! Logical channel type */ /*! Logical channel type */
@ -301,115 +301,115 @@ struct trx_ts_prim {
uint8_t payload[0]; uint8_t payload[0];
}; };
extern const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX]; extern const struct l1sched_lchan_desc l1sched_lchan_desc[_L1SCHED_CHAN_MAX];
const struct trx_multiframe *sched_mframe_layout( const struct l1sched_tdma_multiframe *l1sched_mframe_layout(
enum gsm_phys_chan_config config, int tn); enum gsm_phys_chan_config config, int tn);
/* Scheduler management functions */ /* Scheduler management functions */
int sched_trx_init(struct trx_instance *trx, uint32_t fn_advance); int l1sched_init(struct trx_instance *trx, uint32_t fn_advance);
int sched_trx_reset(struct trx_instance *trx, bool reset_clock); int l1sched_reset(struct trx_instance *trx, bool reset_clock);
int sched_trx_shutdown(struct trx_instance *trx); int l1sched_shutdown(struct trx_instance *trx);
/* Timeslot management functions */ /* Timeslot management functions */
struct trx_ts *sched_trx_add_ts(struct trx_instance *trx, int tn); struct l1sched_ts *l1sched_add_ts(struct trx_instance *trx, int tn);
void sched_trx_del_ts(struct trx_instance *trx, int tn); void l1sched_del_ts(struct trx_instance *trx, int tn);
int sched_trx_reset_ts(struct trx_instance *trx, int tn); int l1sched_reset_ts(struct trx_instance *trx, int tn);
int sched_trx_configure_ts(struct trx_instance *trx, int tn, int l1sched_configure_ts(struct trx_instance *trx, int tn,
enum gsm_phys_chan_config config); enum gsm_phys_chan_config config);
int sched_trx_start_ciphering(struct trx_ts *ts, uint8_t algo, int l1sched_start_ciphering(struct l1sched_ts *ts, uint8_t algo,
uint8_t *key, uint8_t key_len); uint8_t *key, uint8_t key_len);
/* Logical channel management functions */ /* Logical channel management functions */
enum gsm_phys_chan_config sched_trx_chan_nr2pchan_config(uint8_t chan_nr); enum gsm_phys_chan_config l1sched_chan_nr2pchan_config(uint8_t chan_nr);
enum l1sched_lchan_type sched_trx_chan_nr2lchan_type(uint8_t chan_nr, enum l1sched_lchan_type l1sched_chan_nr2lchan_type(uint8_t chan_nr,
uint8_t link_id); uint8_t link_id);
void sched_trx_deactivate_all_lchans(struct trx_ts *ts); void l1sched_deactivate_all_lchans(struct l1sched_ts *ts);
int sched_trx_set_lchans(struct trx_ts *ts, uint8_t chan_nr, int active, uint8_t tch_mode); int l1sched_set_lchans(struct l1sched_ts *ts, uint8_t chan_nr, int active, uint8_t tch_mode);
int sched_trx_activate_lchan(struct trx_ts *ts, enum l1sched_lchan_type chan); int l1sched_activate_lchan(struct l1sched_ts *ts, enum l1sched_lchan_type chan);
int sched_trx_deactivate_lchan(struct trx_ts *ts, enum l1sched_lchan_type chan); int l1sched_deactivate_lchan(struct l1sched_ts *ts, enum l1sched_lchan_type chan);
struct trx_lchan_state *sched_trx_find_lchan(struct trx_ts *ts, struct l1sched_lchan_state *l1sched_find_lchan(struct l1sched_ts *ts,
enum l1sched_lchan_type chan); enum l1sched_lchan_type chan);
/* Primitive management functions */ /* Primitive management functions */
int sched_prim_init(void *ctx, struct trx_ts_prim **prim, int l1sched_prim_init(void *ctx, struct l1sched_ts_prim **prim,
size_t pl_len, uint8_t chan_nr, uint8_t link_id); size_t pl_len, uint8_t chan_nr, uint8_t link_id);
int sched_prim_push(struct trx_instance *trx, int l1sched_prim_push(struct trx_instance *trx,
struct trx_ts_prim *prim, uint8_t chan_nr); struct l1sched_ts_prim *prim, uint8_t chan_nr);
#define TCH_MODE_IS_SPEECH(mode) \ #define L1SCHED_TCH_MODE_IS_SPEECH(mode) \
(mode == GSM48_CMODE_SPEECH_V1 \ (mode == GSM48_CMODE_SPEECH_V1 \
|| mode == GSM48_CMODE_SPEECH_EFR \ || mode == GSM48_CMODE_SPEECH_EFR \
|| mode == GSM48_CMODE_SPEECH_AMR) || mode == GSM48_CMODE_SPEECH_AMR)
#define TCH_MODE_IS_DATA(mode) \ #define L1SCHED_TCH_MODE_IS_DATA(mode) \
(mode == GSM48_CMODE_DATA_14k5 \ (mode == GSM48_CMODE_DATA_14k5 \
|| mode == GSM48_CMODE_DATA_12k0 \ || mode == GSM48_CMODE_DATA_12k0 \
|| mode == GSM48_CMODE_DATA_6k0 \ || mode == GSM48_CMODE_DATA_6k0 \
|| mode == GSM48_CMODE_DATA_3k6) || mode == GSM48_CMODE_DATA_3k6)
#define CHAN_IS_TCH(chan) \ #define L1SCHED_CHAN_IS_TCH(chan) \
(chan == L1SCHED_TCHF || chan == L1SCHED_TCHH_0 || chan == L1SCHED_TCHH_1) (chan == L1SCHED_TCHF || chan == L1SCHED_TCHH_0 || chan == L1SCHED_TCHH_1)
#define CHAN_IS_SACCH(chan) \ #define L1SCHED_CHAN_IS_SACCH(chan) \
(trx_lchan_desc[chan].link_id & TRX_CH_LID_SACCH) (l1sched_lchan_desc[chan].link_id & L1SCHED_CH_LID_SACCH)
/* FIXME: we need a better way to identify / distinguish primitives */ /* FIXME: we need a better way to identify / distinguish primitives */
#define PRIM_IS_RACH11(prim) \ #define L1SCHED_PRIM_IS_RACH11(prim) \
(prim->payload_len == sizeof(struct l1ctl_ext_rach_req)) (prim->payload_len == sizeof(struct l1ctl_ext_rach_req))
#define PRIM_IS_RACH8(prim) \ #define L1SCHED_PRIM_IS_RACH8(prim) \
(prim->payload_len == sizeof(struct l1ctl_rach_req)) (prim->payload_len == sizeof(struct l1ctl_rach_req))
#define PRIM_IS_RACH(prim) \ #define L1SCHED_PRIM_IS_RACH(prim) \
(PRIM_IS_RACH8(prim) || PRIM_IS_RACH11(prim)) (L1SCHED_PRIM_IS_RACH8(prim) || L1SCHED_PRIM_IS_RACH11(prim))
#define PRIM_IS_TCH(prim) \ #define L1SCHED_PRIM_IS_TCH(prim) \
(CHAN_IS_TCH(prim->chan) && prim->payload_len != GSM_MACBLOCK_LEN) (L1SCHED_CHAN_IS_TCH(prim->chan) && prim->payload_len != GSM_MACBLOCK_LEN)
#define PRIM_IS_FACCH(prim) \ #define L1SCHED_PRIM_IS_FACCH(prim) \
(CHAN_IS_TCH(prim->chan) && prim->payload_len == GSM_MACBLOCK_LEN) (L1SCHED_CHAN_IS_TCH(prim->chan) && prim->payload_len == GSM_MACBLOCK_LEN)
struct trx_ts_prim *sched_prim_dequeue(struct llist_head *queue, struct l1sched_ts_prim *l1sched_prim_dequeue(struct llist_head *queue,
uint32_t fn, struct trx_lchan_state *lchan); uint32_t fn, struct l1sched_lchan_state *lchan);
int sched_prim_dummy(struct trx_lchan_state *lchan); int l1sched_prim_dummy(struct l1sched_lchan_state *lchan);
void sched_prim_drop(struct trx_lchan_state *lchan); void l1sched_prim_drop(struct l1sched_lchan_state *lchan);
void sched_prim_flush_queue(struct llist_head *list); void l1sched_prim_flush_queue(struct llist_head *list);
int sched_trx_handle_rx_burst(struct trx_instance *trx, uint8_t tn, int l1sched_handle_rx_burst(struct trx_instance *trx, uint8_t tn,
uint32_t fn, sbit_t *bits, uint16_t nbits, uint32_t fn, sbit_t *bits, uint16_t nbits,
const struct trx_meas_set *meas); const struct l1sched_meas_set *meas);
/* Shared declarations for lchan handlers */ /* Shared declarations for lchan handlers */
extern const uint8_t sched_nb_training_bits[8][26]; extern const uint8_t l1sched_nb_training_bits[8][26];
const char *burst_mask2str(const uint8_t *mask, int bits); const char *l1sched_burst_mask2str(const uint8_t *mask, int bits);
size_t sched_bad_frame_ind(uint8_t *l2, struct trx_lchan_state *lchan); size_t l1sched_bad_frame_ind(uint8_t *l2, struct l1sched_lchan_state *lchan);
int sched_send_dt_ind(struct trx_instance *trx, struct trx_ts *ts, int l1sched_send_dt_ind(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, uint8_t *l2, size_t l2_len, struct l1sched_lchan_state *lchan, uint8_t *l2, size_t l2_len,
int bit_error_count, bool dec_failed, bool traffic); int bit_error_count, bool dec_failed, bool traffic);
int sched_send_dt_conf(struct trx_instance *trx, struct trx_ts *ts, int l1sched_send_dt_conf(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, uint32_t fn, bool traffic); struct l1sched_lchan_state *lchan, uint32_t fn, bool traffic);
int sched_gsmtap_send(enum l1sched_lchan_type lchan_type, uint32_t fn, uint8_t tn, int l1sched_gsmtap_send(enum l1sched_lchan_type lchan_type, uint32_t fn, uint8_t tn,
uint16_t band_arfcn, int8_t signal_dbm, uint8_t snr, uint16_t band_arfcn, int8_t signal_dbm, uint8_t snr,
const uint8_t *data, size_t data_len); const uint8_t *data, size_t data_len);
/* Interleaved TCH/H block TDMA frame mapping */ /* Interleaved TCH/H block TDMA frame mapping */
uint32_t sched_tchh_block_dl_first_fn(enum l1sched_lchan_type chan, uint32_t l1sched_tchh_block_dl_first_fn(enum l1sched_lchan_type chan,
uint32_t last_fn, bool facch); uint32_t last_fn, bool facch);
bool sched_tchh_block_map_fn(enum l1sched_lchan_type chan, bool l1sched_tchh_block_map_fn(enum l1sched_lchan_type chan,
uint32_t fn, bool ul, bool facch, bool start); uint32_t fn, bool ul, bool facch, bool start);
#define sched_tchh_traffic_start(chan, fn, ul) \ #define l1sched_tchh_traffic_start(chan, fn, ul) \
sched_tchh_block_map_fn(chan, fn, ul, 0, 1) l1sched_tchh_block_map_fn(chan, fn, ul, 0, 1)
#define sched_tchh_traffic_end(chan, fn, ul) \ #define l1sched_tchh_traffic_end(chan, fn, ul) \
sched_tchh_block_map_fn(chan, fn, ul, 0, 0) l1sched_tchh_block_map_fn(chan, fn, ul, 0, 0)
#define sched_tchh_facch_start(chan, fn, ul) \ #define l1sched_tchh_facch_start(chan, fn, ul) \
sched_tchh_block_map_fn(chan, fn, ul, 1, 1) l1sched_tchh_block_map_fn(chan, fn, ul, 1, 1)
#define sched_tchh_facch_end(chan, fn, ul) \ #define l1sched_tchh_facch_end(chan, fn, ul) \
sched_tchh_block_map_fn(chan, fn, ul, 1, 0) l1sched_tchh_block_map_fn(chan, fn, ul, 1, 0)
/* Measurement history */ /* Measurement history */
void sched_trx_meas_push(struct trx_lchan_state *lchan, const struct trx_meas_set *meas); void l1sched_lchan_meas_push(struct l1sched_lchan_state *lchan, const struct l1sched_meas_set *meas);
void sched_trx_meas_avg(struct trx_lchan_state *lchan, unsigned int n); void l1sched_lchan_meas_avg(struct l1sched_lchan_state *lchan, unsigned int n);

View File

@ -6,18 +6,18 @@
#include <osmocom/core/timer.h> #include <osmocom/core/timer.h>
#include <osmocom/gsm/gsm0502.h> #include <osmocom/gsm/gsm0502.h>
enum tdma_sched_clck_state { enum l1sched_clck_state {
SCH_CLCK_STATE_WAIT, L1SCHED_CLCK_ST_WAIT,
SCH_CLCK_STATE_OK, L1SCHED_CLCK_ST_OK,
}; };
/* Forward structure declaration */ /* Forward structure declaration */
struct trx_sched; struct l1sched_state;
/*! One scheduler instance */ /*! One scheduler instance */
struct trx_sched { struct l1sched_state {
/*! Clock state */ /*! Clock state */
enum tdma_sched_clck_state state; enum l1sched_clck_state state;
/*! Local clock source */ /*! Local clock source */
struct timespec clock; struct timespec clock;
/*! Count of processed frames */ /*! Count of processed frames */
@ -29,10 +29,10 @@ struct trx_sched {
/*! Frame callback timer */ /*! Frame callback timer */
struct osmo_timer_list clock_timer; struct osmo_timer_list clock_timer;
/*! Frame callback */ /*! Frame callback */
void (*clock_cb)(struct trx_sched *sched); void (*clock_cb)(struct l1sched_state *sched);
/*! Private data (e.g. pointer to trx instance) */ /*! Private data (e.g. pointer to trx instance) */
void *data; void *data;
}; };
int sched_clck_handle(struct trx_sched *sched, uint32_t fn); int l1sched_clck_handle(struct l1sched_state *sched, uint32_t fn);
void sched_clck_reset(struct trx_sched *sched); void l1sched_clck_reset(struct l1sched_state *sched);

View File

@ -43,8 +43,8 @@ struct trx_instance {
int8_t ta; int8_t ta;
/* Scheduler stuff */ /* Scheduler stuff */
struct trx_sched sched; struct l1sched_state sched;
struct trx_ts *ts_list[TRX_TS_COUNT]; struct l1sched_ts *ts_list[TRX_TS_COUNT];
/* Bind L1CTL link */ /* Bind L1CTL link */
struct l1ctl_link *l1l; struct l1ctl_link *l1l;
@ -80,4 +80,4 @@ int trx_if_cmd_measure(struct trx_instance *trx,
uint16_t band_arfcn_start, uint16_t band_arfcn_stop); uint16_t band_arfcn_start, uint16_t band_arfcn_stop);
int trx_if_tx_burst(struct trx_instance *trx, int trx_if_tx_burst(struct trx_instance *trx,
const struct sched_burst_req *br); const struct l1sched_burst_req *br);

View File

@ -340,10 +340,10 @@ static int l1ctl_rx_fbsb_req(struct l1ctl_link *l1l, struct msgb *msg)
band_arfcn &~ ARFCN_FLAG_MASK); band_arfcn &~ ARFCN_FLAG_MASK);
/* Reset scheduler and clock counter */ /* Reset scheduler and clock counter */
sched_trx_reset(l1l->trx, true); l1sched_reset(l1l->trx, true);
/* Configure a single timeslot */ /* Configure a single timeslot */
sched_trx_configure_ts(l1l->trx, 0, ch_config); l1sched_configure_ts(l1l->trx, 0, ch_config);
/* Ask SCH handler to send L1CTL_FBSB_CONF */ /* Ask SCH handler to send L1CTL_FBSB_CONF */
l1l->fbsb_conf_sent = false; l1l->fbsb_conf_sent = false;
@ -430,7 +430,7 @@ static int l1ctl_rx_reset_req(struct l1ctl_link *l1l, struct msgb *msg)
/* Fall through */ /* Fall through */
case L1CTL_RES_T_SCHED: case L1CTL_RES_T_SCHED:
sched_trx_reset(l1l->trx, true); l1sched_reset(l1l->trx, true);
break; break;
default: default:
LOGP(DL1C, LOGL_ERROR, "Unknown L1CTL_RESET_REQ type\n"); LOGP(DL1C, LOGL_ERROR, "Unknown L1CTL_RESET_REQ type\n");
@ -464,7 +464,7 @@ static int l1ctl_rx_ccch_mode_req(struct l1ctl_link *l1l, struct msgb *msg)
{ {
enum gsm_phys_chan_config ch_config; enum gsm_phys_chan_config ch_config;
struct l1ctl_ccch_mode_req *req; struct l1ctl_ccch_mode_req *req;
struct trx_ts *ts; struct l1sched_ts *ts;
int rc = 0; int rc = 0;
req = (struct l1ctl_ccch_mode_req *) msg->l1h; req = (struct l1ctl_ccch_mode_req *) msg->l1h;
@ -491,7 +491,7 @@ static int l1ctl_rx_ccch_mode_req(struct l1ctl_link *l1l, struct msgb *msg)
/* Do nothing if the current mode matches required */ /* Do nothing if the current mode matches required */
if (ts->mf_layout->chan_config != ch_config) if (ts->mf_layout->chan_config != ch_config)
rc = sched_trx_configure_ts(l1l->trx, 0, ch_config); rc = l1sched_configure_ts(l1l->trx, 0, ch_config);
/* Confirm reconfiguration */ /* Confirm reconfiguration */
if (!rc) if (!rc)
@ -507,7 +507,7 @@ static int l1ctl_rx_rach_req(struct l1ctl_link *l1l, struct msgb *msg, bool ext)
struct l1ctl_ext_rach_req *ext_req; struct l1ctl_ext_rach_req *ext_req;
struct l1ctl_rach_req *req; struct l1ctl_rach_req *req;
struct l1ctl_info_ul *ul; struct l1ctl_info_ul *ul;
struct trx_ts_prim *prim; struct l1sched_ts_prim *prim;
size_t len; size_t len;
int rc; int rc;
@ -541,7 +541,7 @@ static int l1ctl_rx_rach_req(struct l1ctl_link *l1l, struct msgb *msg, bool ext)
} }
/* Init a new primitive */ /* Init a new primitive */
rc = sched_prim_init(l1l->trx, &prim, len, ul->chan_nr, ul->link_id); rc = l1sched_prim_init(l1l->trx, &prim, len, ul->chan_nr, ul->link_id);
if (rc) if (rc)
goto exit; goto exit;
@ -549,7 +549,7 @@ static int l1ctl_rx_rach_req(struct l1ctl_link *l1l, struct msgb *msg, bool ext)
* Push this primitive to the transmit queue. * Push this primitive to the transmit queue.
* Indicated timeslot needs to be configured. * Indicated timeslot needs to be configured.
*/ */
rc = sched_prim_push(l1l->trx, prim, ul->chan_nr); rc = l1sched_prim_push(l1l->trx, prim, ul->chan_nr);
if (rc) { if (rc) {
talloc_free(prim); talloc_free(prim);
goto exit; goto exit;
@ -628,7 +628,7 @@ static int l1ctl_rx_dm_est_req(struct l1ctl_link *l1l, struct msgb *msg)
enum gsm_phys_chan_config config; enum gsm_phys_chan_config config;
struct l1ctl_dm_est_req *est_req; struct l1ctl_dm_est_req *est_req;
struct l1ctl_info_ul *ul; struct l1ctl_info_ul *ul;
struct trx_ts *ts; struct l1sched_ts *ts;
uint8_t chan_nr, tn; uint8_t chan_nr, tn;
int rc; int rc;
@ -643,7 +643,7 @@ static int l1ctl_rx_dm_est_req(struct l1ctl_link *l1l, struct msgb *msg)
tn, chan_nr, est_req->tsc, est_req->tch_mode); tn, chan_nr, est_req->tsc, est_req->tch_mode);
/* Determine channel config */ /* Determine channel config */
config = sched_trx_chan_nr2pchan_config(chan_nr); config = l1sched_chan_nr2pchan_config(chan_nr);
if (config == GSM_PCHAN_NONE) { if (config == GSM_PCHAN_NONE) {
LOGP(DL1C, LOGL_ERROR, "Couldn't determine channel config\n"); LOGP(DL1C, LOGL_ERROR, "Couldn't determine channel config\n");
rc = -EINVAL; rc = -EINVAL;
@ -662,7 +662,7 @@ static int l1ctl_rx_dm_est_req(struct l1ctl_link *l1l, struct msgb *msg)
l1l->trx->tsc = est_req->tsc; l1l->trx->tsc = est_req->tsc;
/* Configure requested TS */ /* Configure requested TS */
rc = sched_trx_configure_ts(l1l->trx, tn, config); rc = l1sched_configure_ts(l1l->trx, tn, config);
ts = l1l->trx->ts_list[tn]; ts = l1l->trx->ts_list[tn];
if (rc) { if (rc) {
rc = -EINVAL; rc = -EINVAL;
@ -670,10 +670,10 @@ static int l1ctl_rx_dm_est_req(struct l1ctl_link *l1l, struct msgb *msg)
} }
/* Deactivate all lchans */ /* Deactivate all lchans */
sched_trx_deactivate_all_lchans(ts); l1sched_deactivate_all_lchans(ts);
/* Activate only requested lchans */ /* Activate only requested lchans */
rc = sched_trx_set_lchans(ts, chan_nr, 1, est_req->tch_mode); rc = l1sched_set_lchans(ts, chan_nr, 1, est_req->tch_mode);
if (rc) { if (rc) {
LOGP(DL1C, LOGL_ERROR, "Couldn't activate requested lchans\n"); LOGP(DL1C, LOGL_ERROR, "Couldn't activate requested lchans\n");
rc = -EINVAL; rc = -EINVAL;
@ -690,7 +690,7 @@ static int l1ctl_rx_dm_rel_req(struct l1ctl_link *l1l, struct msgb *msg)
LOGP(DL1C, LOGL_NOTICE, "Received L1CTL_DM_REL_REQ, resetting scheduler\n"); LOGP(DL1C, LOGL_NOTICE, "Received L1CTL_DM_REL_REQ, resetting scheduler\n");
/* Reset scheduler */ /* Reset scheduler */
sched_trx_reset(l1l->trx, false); l1sched_reset(l1l->trx, false);
msgb_free(msg); msgb_free(msg);
return 0; return 0;
@ -703,7 +703,7 @@ static int l1ctl_rx_dt_req(struct l1ctl_link *l1l,
struct msgb *msg, bool traffic) struct msgb *msg, bool traffic)
{ {
struct l1ctl_info_ul *ul; struct l1ctl_info_ul *ul;
struct trx_ts_prim *prim; struct l1sched_ts_prim *prim;
uint8_t chan_nr, link_id; uint8_t chan_nr, link_id;
size_t payload_len; size_t payload_len;
int rc; int rc;
@ -724,13 +724,13 @@ static int l1ctl_rx_dt_req(struct l1ctl_link *l1l,
chan_nr, link_id, payload_len); chan_nr, link_id, payload_len);
/* Init a new primitive */ /* Init a new primitive */
rc = sched_prim_init(l1l->trx, &prim, payload_len, rc = l1sched_prim_init(l1l->trx, &prim, payload_len,
chan_nr, link_id); chan_nr, link_id);
if (rc) if (rc)
goto exit; goto exit;
/* Push this primitive to transmit queue */ /* Push this primitive to transmit queue */
rc = sched_prim_push(l1l->trx, prim, chan_nr); rc = l1sched_prim_push(l1l->trx, prim, chan_nr);
if (rc) { if (rc) {
talloc_free(prim); talloc_free(prim);
goto exit; goto exit;
@ -770,8 +770,8 @@ static int l1ctl_rx_param_req(struct l1ctl_link *l1l, struct msgb *msg)
static int l1ctl_rx_tch_mode_req(struct l1ctl_link *l1l, struct msgb *msg) static int l1ctl_rx_tch_mode_req(struct l1ctl_link *l1l, struct msgb *msg)
{ {
struct l1ctl_tch_mode_req *req; struct l1ctl_tch_mode_req *req;
struct trx_lchan_state *lchan; struct l1sched_lchan_state *lchan;
struct trx_ts *ts; struct l1sched_ts *ts;
int i; int i;
req = (struct l1ctl_tch_mode_req *) msg->l1h; req = (struct l1ctl_tch_mode_req *) msg->l1h;
@ -814,7 +814,7 @@ static int l1ctl_rx_crypto_req(struct l1ctl_link *l1l, struct msgb *msg)
{ {
struct l1ctl_crypto_req *req; struct l1ctl_crypto_req *req;
struct l1ctl_info_ul *ul; struct l1ctl_info_ul *ul;
struct trx_ts *ts; struct l1sched_ts *ts;
uint8_t tn; uint8_t tn;
int rc = 0; int rc = 0;
@ -836,7 +836,7 @@ static int l1ctl_rx_crypto_req(struct l1ctl_link *l1l, struct msgb *msg)
} }
/* Poke scheduler */ /* Poke scheduler */
rc = sched_trx_start_ciphering(ts, req->algo, req->key, req->key_len); rc = l1sched_start_ciphering(ts, req->algo, req->key, req->key_len);
if (rc) { if (rc) {
LOGP(DL1C, LOGL_ERROR, "Couldn't configure ciphering\n"); LOGP(DL1C, LOGL_ERROR, "Couldn't configure ciphering\n");
rc = -EINVAL; rc = -EINVAL;

View File

@ -45,9 +45,9 @@
#define MAX_FN_SKEW 50 #define MAX_FN_SKEW 50
#define TRX_LOSS_FRAMES 400 #define TRX_LOSS_FRAMES 400
static void sched_clck_tick(void *data) static void l1sched_clck_tick(void *data)
{ {
struct trx_sched *sched = (struct trx_sched *) data; struct l1sched_state *sched = (struct l1sched_state *) data;
struct timespec tv_now, *tv_clock, elapsed; struct timespec tv_now, *tv_clock, elapsed;
int64_t elapsed_us; int64_t elapsed_us;
const struct timespec frame_duration = { .tv_sec = 0, .tv_nsec = GSM_TDMA_FN_DURATION_nS }; const struct timespec frame_duration = { .tv_sec = 0, .tv_nsec = GSM_TDMA_FN_DURATION_nS };
@ -55,7 +55,7 @@ static void sched_clck_tick(void *data)
/* Check if transceiver is still alive */ /* Check if transceiver is still alive */
if (sched->fn_counter_lost++ == TRX_LOSS_FRAMES) { if (sched->fn_counter_lost++ == TRX_LOSS_FRAMES) {
LOGP(DSCH, LOGL_DEBUG, "No more clock from transceiver\n"); LOGP(DSCH, LOGL_DEBUG, "No more clock from transceiver\n");
sched->state = SCH_CLCK_STATE_WAIT; sched->state = L1SCHED_CLCK_ST_WAIT;
return; return;
} }
@ -72,7 +72,7 @@ static void sched_clck_tick(void *data)
LOGP(DSCH, LOGL_NOTICE, "PC clock skew: " LOGP(DSCH, LOGL_NOTICE, "PC clock skew: "
"elapsed uS %" PRId64 "\n", elapsed_us); "elapsed uS %" PRId64 "\n", elapsed_us);
sched->state = SCH_CLCK_STATE_WAIT; sched->state = L1SCHED_CLCK_ST_WAIT;
return; return;
} }
@ -93,7 +93,7 @@ static void sched_clck_tick(void *data)
GSM_TDMA_FN_DURATION_uS - elapsed_us); GSM_TDMA_FN_DURATION_uS - elapsed_us);
} }
static void sched_clck_correct(struct trx_sched *sched, static void l1sched_clck_correct(struct l1sched_state *sched,
struct timespec *tv_now, uint32_t fn) struct timespec *tv_now, uint32_t fn)
{ {
sched->fn_counter_proc = fn; sched->fn_counter_proc = fn;
@ -106,12 +106,12 @@ static void sched_clck_correct(struct trx_sched *sched,
sched->clock = *tv_now; sched->clock = *tv_now;
memset(&sched->clock_timer, 0, sizeof(sched->clock_timer)); memset(&sched->clock_timer, 0, sizeof(sched->clock_timer));
sched->clock_timer.cb = sched_clck_tick; sched->clock_timer.cb = l1sched_clck_tick;
sched->clock_timer.data = sched; sched->clock_timer.data = sched;
osmo_timer_schedule(&sched->clock_timer, 0, GSM_TDMA_FN_DURATION_uS); osmo_timer_schedule(&sched->clock_timer, 0, GSM_TDMA_FN_DURATION_uS);
} }
int sched_clck_handle(struct trx_sched *sched, uint32_t fn) int l1sched_clck_handle(struct l1sched_state *sched, uint32_t fn)
{ {
struct timespec tv_now, *tv_clock, elapsed; struct timespec tv_now, *tv_clock, elapsed;
int64_t elapsed_us, elapsed_fn; int64_t elapsed_us, elapsed_fn;
@ -124,11 +124,11 @@ int sched_clck_handle(struct trx_sched *sched, uint32_t fn)
tv_clock = &sched->clock; tv_clock = &sched->clock;
/* If this is the first CLCK IND */ /* If this is the first CLCK IND */
if (sched->state == SCH_CLCK_STATE_WAIT) { if (sched->state == L1SCHED_CLCK_ST_WAIT) {
sched_clck_correct(sched, &tv_now, fn); l1sched_clck_correct(sched, &tv_now, fn);
LOGP(DSCH, LOGL_DEBUG, "Initial clock received: fn=%u\n", fn); LOGP(DSCH, LOGL_DEBUG, "Initial clock received: fn=%u\n", fn);
sched->state = SCH_CLCK_STATE_OK; sched->state = L1SCHED_CLCK_ST_OK;
return 0; return 0;
} }
@ -150,7 +150,7 @@ int sched_clck_handle(struct trx_sched *sched, uint32_t fn)
LOGP(DSCH, LOGL_NOTICE, "GSM clock skew: old fn=%u, " LOGP(DSCH, LOGL_NOTICE, "GSM clock skew: old fn=%u, "
"new fn=%u\n", sched->fn_counter_proc, fn); "new fn=%u\n", sched->fn_counter_proc, fn);
sched_clck_correct(sched, &tv_now, fn); l1sched_clck_correct(sched, &tv_now, fn);
return 0; return 0;
} }
@ -192,10 +192,10 @@ int sched_clck_handle(struct trx_sched *sched, uint32_t fn)
return 0; return 0;
} }
void sched_clck_reset(struct trx_sched *sched) void l1sched_clck_reset(struct l1sched_state *sched)
{ {
/* Reset internal state */ /* Reset internal state */
sched->state = SCH_CLCK_STATE_WAIT; sched->state = L1SCHED_CLCK_ST_WAIT;
/* Stop clock timer */ /* Stop clock timer */
osmo_timer_del(&sched->clock_timer); osmo_timer_del(&sched->clock_timer);

View File

@ -45,7 +45,7 @@
#include <osmocom/bb/trxcon/l1ctl.h> #include <osmocom/bb/trxcon/l1ctl.h>
/* GSM 05.02 Chapter 5.2.3 Normal Burst (NB) */ /* GSM 05.02 Chapter 5.2.3 Normal Burst (NB) */
const uint8_t sched_nb_training_bits[8][26] = { const uint8_t l1sched_nb_training_bits[8][26] = {
{ {
0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0,
0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1,
@ -84,7 +84,7 @@ const uint8_t sched_nb_training_bits[8][26] = {
* Examples: " ****.." (incomplete, 4/6 bursts) * Examples: " ****.." (incomplete, 4/6 bursts)
* " ****" (complete, all 4 bursts) * " ****" (complete, all 4 bursts)
* "**.***.." (incomplete, 5/8 bursts) */ * "**.***.." (incomplete, 5/8 bursts) */
const char *burst_mask2str(const uint8_t *mask, int bits) const char *l1sched_burst_mask2str(const uint8_t *mask, int bits)
{ {
/* TODO: CSD is interleaved over 22 bursts, so the mask needs to be extended */ /* TODO: CSD is interleaved over 22 bursts, so the mask needs to be extended */
static char buf[8 + 1]; static char buf[8 + 1];
@ -99,11 +99,11 @@ const char *burst_mask2str(const uint8_t *mask, int bits)
return buf; return buf;
} }
int sched_gsmtap_send(enum l1sched_lchan_type lchan_type, uint32_t fn, uint8_t tn, int l1sched_gsmtap_send(enum l1sched_lchan_type lchan_type, uint32_t fn, uint8_t tn,
uint16_t band_arfcn, int8_t signal_dbm, uint8_t snr, uint16_t band_arfcn, int8_t signal_dbm, uint8_t snr,
const uint8_t *data, size_t data_len) const uint8_t *data, size_t data_len)
{ {
const struct trx_lchan_desc *lchan_desc = &trx_lchan_desc[lchan_type]; const struct l1sched_lchan_desc *lchan_desc = &l1sched_lchan_desc[lchan_type];
/* GSMTAP logging may not be enabled */ /* GSMTAP logging may not be enabled */
if (gsmtap == NULL) if (gsmtap == NULL)
@ -118,16 +118,16 @@ int sched_gsmtap_send(enum l1sched_lchan_type lchan_type, uint32_t fn, uint8_t t
lchan_desc->ss_nr, fn, signal_dbm, snr, data, data_len); lchan_desc->ss_nr, fn, signal_dbm, snr, data, data_len);
} }
int sched_send_dt_ind(struct trx_instance *trx, struct trx_ts *ts, int l1sched_send_dt_ind(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, uint8_t *l2, size_t l2_len, struct l1sched_lchan_state *lchan, uint8_t *l2, size_t l2_len,
int bit_error_count, bool dec_failed, bool traffic) int bit_error_count, bool dec_failed, bool traffic)
{ {
const struct trx_meas_set *meas = &lchan->meas_avg; const struct l1sched_meas_set *meas = &lchan->meas_avg;
const struct trx_lchan_desc *lchan_desc; const struct l1sched_lchan_desc *lchan_desc;
struct l1ctl_info_dl dl_hdr; struct l1ctl_info_dl dl_hdr;
/* Set up pointers */ /* Set up pointers */
lchan_desc = &trx_lchan_desc[lchan->type]; lchan_desc = &l1sched_lchan_desc[lchan->type];
/* Fill in known downlink info */ /* Fill in known downlink info */
dl_hdr.chan_nr = lchan_desc->chan_nr | ts->index; dl_hdr.chan_nr = lchan_desc->chan_nr | ts->index;
@ -135,7 +135,7 @@ int sched_send_dt_ind(struct trx_instance *trx, struct trx_ts *ts,
dl_hdr.band_arfcn = htons(trx->band_arfcn); dl_hdr.band_arfcn = htons(trx->band_arfcn);
dl_hdr.num_biterr = bit_error_count; dl_hdr.num_biterr = bit_error_count;
/* sched_trx_meas_avg() gives us TDMA frame number of the first burst */ /* l1sched_lchan_meas_avg() gives us TDMA frame number of the first burst */
dl_hdr.frame_nr = htonl(meas->fn); dl_hdr.frame_nr = htonl(meas->fn);
/* RX level: 0 .. 63 in typical GSM notation (dBm + 110) */ /* RX level: 0 .. 63 in typical GSM notation (dBm + 110) */
@ -152,21 +152,21 @@ int sched_send_dt_ind(struct trx_instance *trx, struct trx_ts *ts,
/* Optional GSMTAP logging */ /* Optional GSMTAP logging */
if (l2_len > 0 && (!traffic || lchan_desc->chan_nr == RSL_CHAN_OSMO_PDCH)) { if (l2_len > 0 && (!traffic || lchan_desc->chan_nr == RSL_CHAN_OSMO_PDCH)) {
sched_gsmtap_send(lchan->type, meas->fn, ts->index, l1sched_gsmtap_send(lchan->type, meas->fn, ts->index,
trx->band_arfcn, meas->rssi, 0, l2, l2_len); trx->band_arfcn, meas->rssi, 0, l2, l2_len);
} }
return 0; return 0;
} }
int sched_send_dt_conf(struct trx_instance *trx, struct trx_ts *ts, int l1sched_send_dt_conf(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, uint32_t fn, bool traffic) struct l1sched_lchan_state *lchan, uint32_t fn, bool traffic)
{ {
const struct trx_lchan_desc *lchan_desc; const struct l1sched_lchan_desc *lchan_desc;
struct l1ctl_info_dl dl_hdr; struct l1ctl_info_dl dl_hdr;
/* Set up pointers */ /* Set up pointers */
lchan_desc = &trx_lchan_desc[lchan->type]; lchan_desc = &l1sched_lchan_desc[lchan->type];
/* Zero-initialize DL header, because we don't set all fields */ /* Zero-initialize DL header, because we don't set all fields */
memset(&dl_hdr, 0x00, sizeof(struct l1ctl_info_dl)); memset(&dl_hdr, 0x00, sizeof(struct l1ctl_info_dl));
@ -181,7 +181,7 @@ int sched_send_dt_conf(struct trx_instance *trx, struct trx_ts *ts,
/* Optional GSMTAP logging */ /* Optional GSMTAP logging */
if (!traffic || lchan_desc->chan_nr == RSL_CHAN_OSMO_PDCH) { if (!traffic || lchan_desc->chan_nr == RSL_CHAN_OSMO_PDCH) {
sched_gsmtap_send(lchan->type, fn, ts->index, l1sched_gsmtap_send(lchan->type, fn, ts->index,
trx->band_arfcn | ARFCN_UPLINK, trx->band_arfcn | ARFCN_UPLINK,
0, 0, lchan->prim->payload, 0, 0, lchan->prim->payload,
lchan->prim->payload_len); lchan->prim->payload_len);
@ -198,7 +198,7 @@ int sched_send_dt_conf(struct trx_instance *trx, struct trx_ts *ts,
* @param lchan Logical channel to generate BFI for * @param lchan Logical channel to generate BFI for
* @return How much bytes were written * @return How much bytes were written
*/ */
size_t sched_bad_frame_ind(uint8_t *l2, struct trx_lchan_state *lchan) size_t l1sched_bad_frame_ind(uint8_t *l2, struct l1sched_lchan_state *lchan)
{ {
switch (lchan->tch_mode) { switch (lchan->tch_mode) {
case GSM48_CMODE_SPEECH_V1: case GSM48_CMODE_SPEECH_V1:

View File

@ -29,47 +29,47 @@
#include <osmocom/bb/trxcon/sched_trx.h> #include <osmocom/bb/trxcon/sched_trx.h>
/* Forward declaration of handlers */ /* Forward declaration of handlers */
int rx_data_fn(struct trx_instance *trx, struct trx_ts *ts, int rx_data_fn(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid, struct l1sched_lchan_state *lchan, uint32_t fn, uint8_t bid,
const sbit_t *bits, const struct trx_meas_set *meas); const sbit_t *bits, const struct l1sched_meas_set *meas);
int tx_data_fn(struct trx_instance *trx, struct trx_ts *ts, int tx_data_fn(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, struct l1sched_lchan_state *lchan,
struct sched_burst_req *br); struct l1sched_burst_req *br);
int rx_sch_fn(struct trx_instance *trx, struct trx_ts *ts, int rx_sch_fn(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid, struct l1sched_lchan_state *lchan, uint32_t fn, uint8_t bid,
const sbit_t *bits, const struct trx_meas_set *meas); const sbit_t *bits, const struct l1sched_meas_set *meas);
int tx_rach_fn(struct trx_instance *trx, struct trx_ts *ts, int tx_rach_fn(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, struct l1sched_lchan_state *lchan,
struct sched_burst_req *br); struct l1sched_burst_req *br);
int rx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts, int rx_tchf_fn(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid, struct l1sched_lchan_state *lchan, uint32_t fn, uint8_t bid,
const sbit_t *bits, const struct trx_meas_set *meas); const sbit_t *bits, const struct l1sched_meas_set *meas);
int tx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts, int tx_tchf_fn(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, struct l1sched_lchan_state *lchan,
struct sched_burst_req *br); struct l1sched_burst_req *br);
int rx_tchh_fn(struct trx_instance *trx, struct trx_ts *ts, int rx_tchh_fn(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid, struct l1sched_lchan_state *lchan, uint32_t fn, uint8_t bid,
const sbit_t *bits, const struct trx_meas_set *meas); const sbit_t *bits, const struct l1sched_meas_set *meas);
int tx_tchh_fn(struct trx_instance *trx, struct trx_ts *ts, int tx_tchh_fn(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, struct l1sched_lchan_state *lchan,
struct sched_burst_req *br); struct l1sched_burst_req *br);
int rx_pdtch_fn(struct trx_instance *trx, struct trx_ts *ts, int rx_pdtch_fn(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid, struct l1sched_lchan_state *lchan, uint32_t fn, uint8_t bid,
const sbit_t *bits, const struct trx_meas_set *meas); const sbit_t *bits, const struct l1sched_meas_set *meas);
int tx_pdtch_fn(struct trx_instance *trx, struct trx_ts *ts, int tx_pdtch_fn(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, struct l1sched_lchan_state *lchan,
struct sched_burst_req *br); struct l1sched_burst_req *br);
const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = { const struct l1sched_lchan_desc l1sched_lchan_desc[_L1SCHED_CHAN_MAX] = {
[L1SCHED_IDLE] = { [L1SCHED_IDLE] = {
.name = "IDLE", .name = "IDLE",
.desc = "Idle channel", .desc = "Idle channel",
@ -87,7 +87,7 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
/* 3GPP TS 05.03, section 4.7. Handled by transceiver, /* 3GPP TS 05.03, section 4.7. Handled by transceiver,
* however we still need to parse BSIC (BCC / NCC). */ * however we still need to parse BSIC (BCC / NCC). */
.flags = TRX_CH_FLAG_AUTO, .flags = L1SCHED_CH_FLAG_AUTO,
.rx_fn = rx_sch_fn, .rx_fn = rx_sch_fn,
}, },
[L1SCHED_BCCH] = { [L1SCHED_BCCH] = {
@ -100,7 +100,7 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
* regular interleaving (3GPP TS 05.02, clause 7, table 3): * regular interleaving (3GPP TS 05.02, clause 7, table 3):
* a L2 frame is interleaved over 4 consecutive bursts. */ * a L2 frame is interleaved over 4 consecutive bursts. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_AUTO, .flags = L1SCHED_CH_FLAG_AUTO,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
}, },
[L1SCHED_RACH] = { [L1SCHED_RACH] = {
@ -110,7 +110,7 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.chan_nr = RSL_CHAN_RACH, .chan_nr = RSL_CHAN_RACH,
/* Tx only, RACH convolutional coding (3GPP TS 05.03, section 4.6). */ /* Tx only, RACH convolutional coding (3GPP TS 05.03, section 4.6). */
.flags = TRX_CH_FLAG_AUTO, .flags = L1SCHED_CH_FLAG_AUTO,
.tx_fn = tx_rach_fn, .tx_fn = tx_rach_fn,
}, },
[L1SCHED_CCCH] = { [L1SCHED_CCCH] = {
@ -123,7 +123,7 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
* regular interleaving (3GPP TS 05.02, clause 7, table 3): * regular interleaving (3GPP TS 05.02, clause 7, table 3):
* a L2 frame is interleaved over 4 consecutive bursts. */ * a L2 frame is interleaved over 4 consecutive bursts. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_AUTO, .flags = L1SCHED_CH_FLAG_AUTO,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
}, },
[L1SCHED_TCHF] = { [L1SCHED_TCHF] = {
@ -131,7 +131,7 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Full Rate traffic channel", .desc = "Full Rate traffic channel",
.gsmtap_chan_type = GSMTAP_CHANNEL_TCH_F, .gsmtap_chan_type = GSMTAP_CHANNEL_TCH_F,
.chan_nr = RSL_CHAN_Bm_ACCHs, .chan_nr = RSL_CHAN_Bm_ACCHs,
.link_id = TRX_CH_LID_DEDIC, .link_id = L1SCHED_CH_LID_DEDIC,
/* Rx and Tx, multiple convolutional coding types (3GPP TS 05.03, /* Rx and Tx, multiple convolutional coding types (3GPP TS 05.03,
* chapter 3), block diagonal interleaving (3GPP TS 05.02, clause 7): * chapter 3), block diagonal interleaving (3GPP TS 05.02, clause 7):
@ -145,7 +145,7 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
* The MS shall continuously transmit bursts, even if there is nothing * The MS shall continuously transmit bursts, even if there is nothing
* to send, unless DTX (Discontinuous Transmission) is used. */ * to send, unless DTX (Discontinuous Transmission) is used. */
.burst_buf_size = 8 * GSM_BURST_PL_LEN, .burst_buf_size = 8 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_tchf_fn, .rx_fn = rx_tchf_fn,
.tx_fn = tx_tchf_fn, .tx_fn = tx_tchf_fn,
}, },
@ -154,7 +154,7 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Half Rate traffic channel (sub-channel 0)", .desc = "Half Rate traffic channel (sub-channel 0)",
.gsmtap_chan_type = GSMTAP_CHANNEL_TCH_H, .gsmtap_chan_type = GSMTAP_CHANNEL_TCH_H,
.chan_nr = RSL_CHAN_Lm_ACCHs + (0 << 3), .chan_nr = RSL_CHAN_Lm_ACCHs + (0 << 3),
.link_id = TRX_CH_LID_DEDIC, .link_id = L1SCHED_CH_LID_DEDIC,
.ss_nr = 0, .ss_nr = 0,
/* Rx and Tx, multiple convolutional coding types (3GPP TS 05.03, /* Rx and Tx, multiple convolutional coding types (3GPP TS 05.03,
@ -174,7 +174,7 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
* The MS shall continuously transmit bursts, even if there is nothing * The MS shall continuously transmit bursts, even if there is nothing
* to send, unless DTX (Discontinuous Transmission) is used. */ * to send, unless DTX (Discontinuous Transmission) is used. */
.burst_buf_size = 6 * GSM_BURST_PL_LEN, .burst_buf_size = 6 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_tchh_fn, .rx_fn = rx_tchh_fn,
.tx_fn = tx_tchh_fn, .tx_fn = tx_tchh_fn,
}, },
@ -183,12 +183,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Half Rate traffic channel (sub-channel 1)", .desc = "Half Rate traffic channel (sub-channel 1)",
.gsmtap_chan_type = GSMTAP_CHANNEL_TCH_H, .gsmtap_chan_type = GSMTAP_CHANNEL_TCH_H,
.chan_nr = RSL_CHAN_Lm_ACCHs + (1 << 3), .chan_nr = RSL_CHAN_Lm_ACCHs + (1 << 3),
.link_id = TRX_CH_LID_DEDIC, .link_id = L1SCHED_CH_LID_DEDIC,
.ss_nr = 1, .ss_nr = 1,
/* Same as for L1SCHED_TCHH_0, see above. */ /* Same as for L1SCHED_TCHH_0, see above. */
.burst_buf_size = 6 * GSM_BURST_PL_LEN, .burst_buf_size = 6 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_tchh_fn, .rx_fn = rx_tchh_fn,
.tx_fn = tx_tchh_fn, .tx_fn = tx_tchh_fn,
}, },
@ -197,12 +197,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Stand-alone dedicated control channel (sub-channel 0)", .desc = "Stand-alone dedicated control channel (sub-channel 0)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH4, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH4,
.chan_nr = RSL_CHAN_SDCCH4_ACCH + (0 << 3), .chan_nr = RSL_CHAN_SDCCH4_ACCH + (0 << 3),
.link_id = TRX_CH_LID_DEDIC, .link_id = L1SCHED_CH_LID_DEDIC,
.ss_nr = 0, .ss_nr = 0,
/* Same as for L1SCHED_BCCH (xCCH), see above. */ /* Same as for L1SCHED_BCCH (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -211,12 +211,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Stand-alone dedicated control channel (sub-channel 1)", .desc = "Stand-alone dedicated control channel (sub-channel 1)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH4, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH4,
.chan_nr = RSL_CHAN_SDCCH4_ACCH + (1 << 3), .chan_nr = RSL_CHAN_SDCCH4_ACCH + (1 << 3),
.link_id = TRX_CH_LID_DEDIC, .link_id = L1SCHED_CH_LID_DEDIC,
.ss_nr = 1, .ss_nr = 1,
/* Same as for L1SCHED_BCCH (xCCH), see above. */ /* Same as for L1SCHED_BCCH (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -225,12 +225,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Stand-alone dedicated control channel (sub-channel 2)", .desc = "Stand-alone dedicated control channel (sub-channel 2)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH4, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH4,
.chan_nr = RSL_CHAN_SDCCH4_ACCH + (2 << 3), .chan_nr = RSL_CHAN_SDCCH4_ACCH + (2 << 3),
.link_id = TRX_CH_LID_DEDIC, .link_id = L1SCHED_CH_LID_DEDIC,
.ss_nr = 2, .ss_nr = 2,
/* Same as for L1SCHED_BCCH (xCCH), see above. */ /* Same as for L1SCHED_BCCH (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -239,12 +239,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Stand-alone dedicated control channel (sub-channel 3)", .desc = "Stand-alone dedicated control channel (sub-channel 3)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH4, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH4,
.chan_nr = RSL_CHAN_SDCCH4_ACCH + (3 << 3), .chan_nr = RSL_CHAN_SDCCH4_ACCH + (3 << 3),
.link_id = TRX_CH_LID_DEDIC, .link_id = L1SCHED_CH_LID_DEDIC,
.ss_nr = 3, .ss_nr = 3,
/* Same as for L1SCHED_BCCH (xCCH), see above. */ /* Same as for L1SCHED_BCCH (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -253,12 +253,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Stand-alone dedicated control channel (sub-channel 0)", .desc = "Stand-alone dedicated control channel (sub-channel 0)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8,
.chan_nr = RSL_CHAN_SDCCH8_ACCH + (0 << 3), .chan_nr = RSL_CHAN_SDCCH8_ACCH + (0 << 3),
.link_id = TRX_CH_LID_DEDIC, .link_id = L1SCHED_CH_LID_DEDIC,
.ss_nr = 0, .ss_nr = 0,
/* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */ /* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -267,12 +267,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Stand-alone dedicated control channel (sub-channel 1)", .desc = "Stand-alone dedicated control channel (sub-channel 1)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8,
.chan_nr = RSL_CHAN_SDCCH8_ACCH + (1 << 3), .chan_nr = RSL_CHAN_SDCCH8_ACCH + (1 << 3),
.link_id = TRX_CH_LID_DEDIC, .link_id = L1SCHED_CH_LID_DEDIC,
.ss_nr = 1, .ss_nr = 1,
/* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */ /* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -281,12 +281,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Stand-alone dedicated control channel (sub-channel 2)", .desc = "Stand-alone dedicated control channel (sub-channel 2)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8,
.chan_nr = RSL_CHAN_SDCCH8_ACCH + (2 << 3), .chan_nr = RSL_CHAN_SDCCH8_ACCH + (2 << 3),
.link_id = TRX_CH_LID_DEDIC, .link_id = L1SCHED_CH_LID_DEDIC,
.ss_nr = 2, .ss_nr = 2,
/* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */ /* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -295,12 +295,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Stand-alone dedicated control channel (sub-channel 3)", .desc = "Stand-alone dedicated control channel (sub-channel 3)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8,
.chan_nr = RSL_CHAN_SDCCH8_ACCH + (3 << 3), .chan_nr = RSL_CHAN_SDCCH8_ACCH + (3 << 3),
.link_id = TRX_CH_LID_DEDIC, .link_id = L1SCHED_CH_LID_DEDIC,
.ss_nr = 3, .ss_nr = 3,
/* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */ /* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -309,12 +309,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Stand-alone dedicated control channel (sub-channel 4)", .desc = "Stand-alone dedicated control channel (sub-channel 4)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8,
.chan_nr = RSL_CHAN_SDCCH8_ACCH + (4 << 3), .chan_nr = RSL_CHAN_SDCCH8_ACCH + (4 << 3),
.link_id = TRX_CH_LID_DEDIC, .link_id = L1SCHED_CH_LID_DEDIC,
.ss_nr = 4, .ss_nr = 4,
/* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */ /* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -323,12 +323,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Stand-alone dedicated control channel (sub-channel 5)", .desc = "Stand-alone dedicated control channel (sub-channel 5)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8,
.chan_nr = RSL_CHAN_SDCCH8_ACCH + (5 << 3), .chan_nr = RSL_CHAN_SDCCH8_ACCH + (5 << 3),
.link_id = TRX_CH_LID_DEDIC, .link_id = L1SCHED_CH_LID_DEDIC,
.ss_nr = 5, .ss_nr = 5,
/* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */ /* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -337,12 +337,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Stand-alone dedicated control channel (sub-channel 6)", .desc = "Stand-alone dedicated control channel (sub-channel 6)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8,
.chan_nr = RSL_CHAN_SDCCH8_ACCH + (6 << 3), .chan_nr = RSL_CHAN_SDCCH8_ACCH + (6 << 3),
.link_id = TRX_CH_LID_DEDIC, .link_id = L1SCHED_CH_LID_DEDIC,
.ss_nr = 6, .ss_nr = 6,
/* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */ /* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -351,12 +351,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Stand-alone dedicated control channel (sub-channel 7)", .desc = "Stand-alone dedicated control channel (sub-channel 7)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8,
.chan_nr = RSL_CHAN_SDCCH8_ACCH + (7 << 3), .chan_nr = RSL_CHAN_SDCCH8_ACCH + (7 << 3),
.link_id = TRX_CH_LID_DEDIC, .link_id = L1SCHED_CH_LID_DEDIC,
.ss_nr = 7, .ss_nr = 7,
/* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */ /* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -365,11 +365,11 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Slow TCH/F associated control channel", .desc = "Slow TCH/F associated control channel",
.gsmtap_chan_type = GSMTAP_CHANNEL_TCH_F | GSMTAP_CHANNEL_ACCH, .gsmtap_chan_type = GSMTAP_CHANNEL_TCH_F | GSMTAP_CHANNEL_ACCH,
.chan_nr = RSL_CHAN_Bm_ACCHs, .chan_nr = RSL_CHAN_Bm_ACCHs,
.link_id = TRX_CH_LID_SACCH, .link_id = L1SCHED_CH_LID_SACCH,
/* Same as for L1SCHED_BCCH (xCCH), see above. */ /* Same as for L1SCHED_BCCH (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -378,12 +378,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Slow TCH/H associated control channel (sub-channel 0)", .desc = "Slow TCH/H associated control channel (sub-channel 0)",
.gsmtap_chan_type = GSMTAP_CHANNEL_TCH_H | GSMTAP_CHANNEL_ACCH, .gsmtap_chan_type = GSMTAP_CHANNEL_TCH_H | GSMTAP_CHANNEL_ACCH,
.chan_nr = RSL_CHAN_Lm_ACCHs + (0 << 3), .chan_nr = RSL_CHAN_Lm_ACCHs + (0 << 3),
.link_id = TRX_CH_LID_SACCH, .link_id = L1SCHED_CH_LID_SACCH,
.ss_nr = 0, .ss_nr = 0,
/* Same as for L1SCHED_BCCH (xCCH), see above. */ /* Same as for L1SCHED_BCCH (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -392,12 +392,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Slow TCH/H associated control channel (sub-channel 1)", .desc = "Slow TCH/H associated control channel (sub-channel 1)",
.gsmtap_chan_type = GSMTAP_CHANNEL_TCH_H | GSMTAP_CHANNEL_ACCH, .gsmtap_chan_type = GSMTAP_CHANNEL_TCH_H | GSMTAP_CHANNEL_ACCH,
.chan_nr = RSL_CHAN_Lm_ACCHs + (1 << 3), .chan_nr = RSL_CHAN_Lm_ACCHs + (1 << 3),
.link_id = TRX_CH_LID_SACCH, .link_id = L1SCHED_CH_LID_SACCH,
.ss_nr = 1, .ss_nr = 1,
/* Same as for L1SCHED_BCCH (xCCH), see above. */ /* Same as for L1SCHED_BCCH (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -406,12 +406,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Slow SDCCH/4 associated control channel (sub-channel 0)", .desc = "Slow SDCCH/4 associated control channel (sub-channel 0)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH4 | GSMTAP_CHANNEL_ACCH, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH4 | GSMTAP_CHANNEL_ACCH,
.chan_nr = RSL_CHAN_SDCCH4_ACCH + (0 << 3), .chan_nr = RSL_CHAN_SDCCH4_ACCH + (0 << 3),
.link_id = TRX_CH_LID_SACCH, .link_id = L1SCHED_CH_LID_SACCH,
.ss_nr = 0, .ss_nr = 0,
/* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */ /* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -420,12 +420,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Slow SDCCH/4 associated control channel (sub-channel 1)", .desc = "Slow SDCCH/4 associated control channel (sub-channel 1)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH4 | GSMTAP_CHANNEL_ACCH, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH4 | GSMTAP_CHANNEL_ACCH,
.chan_nr = RSL_CHAN_SDCCH4_ACCH + (1 << 3), .chan_nr = RSL_CHAN_SDCCH4_ACCH + (1 << 3),
.link_id = TRX_CH_LID_SACCH, .link_id = L1SCHED_CH_LID_SACCH,
.ss_nr = 1, .ss_nr = 1,
/* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */ /* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -434,12 +434,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Slow SDCCH/4 associated control channel (sub-channel 2)", .desc = "Slow SDCCH/4 associated control channel (sub-channel 2)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH4 | GSMTAP_CHANNEL_ACCH, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH4 | GSMTAP_CHANNEL_ACCH,
.chan_nr = RSL_CHAN_SDCCH4_ACCH + (2 << 3), .chan_nr = RSL_CHAN_SDCCH4_ACCH + (2 << 3),
.link_id = TRX_CH_LID_SACCH, .link_id = L1SCHED_CH_LID_SACCH,
.ss_nr = 2, .ss_nr = 2,
/* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */ /* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -448,12 +448,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Slow SDCCH/4 associated control channel (sub-channel 3)", .desc = "Slow SDCCH/4 associated control channel (sub-channel 3)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH4 | GSMTAP_CHANNEL_ACCH, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH4 | GSMTAP_CHANNEL_ACCH,
.chan_nr = RSL_CHAN_SDCCH4_ACCH + (3 << 3), .chan_nr = RSL_CHAN_SDCCH4_ACCH + (3 << 3),
.link_id = TRX_CH_LID_SACCH, .link_id = L1SCHED_CH_LID_SACCH,
.ss_nr = 3, .ss_nr = 3,
/* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */ /* Same as for L1SCHED_BCCH and L1SCHED_SDCCH4_* (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -462,12 +462,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Slow SDCCH/8 associated control channel (sub-channel 0)", .desc = "Slow SDCCH/8 associated control channel (sub-channel 0)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8 | GSMTAP_CHANNEL_ACCH, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8 | GSMTAP_CHANNEL_ACCH,
.chan_nr = RSL_CHAN_SDCCH8_ACCH + (0 << 3), .chan_nr = RSL_CHAN_SDCCH8_ACCH + (0 << 3),
.link_id = TRX_CH_LID_SACCH, .link_id = L1SCHED_CH_LID_SACCH,
.ss_nr = 0, .ss_nr = 0,
/* Same as for L1SCHED_BCCH and L1SCHED_SDCCH8_* (xCCH), see above. */ /* Same as for L1SCHED_BCCH and L1SCHED_SDCCH8_* (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -476,12 +476,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Slow SDCCH/8 associated control channel (sub-channel 1)", .desc = "Slow SDCCH/8 associated control channel (sub-channel 1)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8 | GSMTAP_CHANNEL_ACCH, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8 | GSMTAP_CHANNEL_ACCH,
.chan_nr = RSL_CHAN_SDCCH8_ACCH + (1 << 3), .chan_nr = RSL_CHAN_SDCCH8_ACCH + (1 << 3),
.link_id = TRX_CH_LID_SACCH, .link_id = L1SCHED_CH_LID_SACCH,
.ss_nr = 1, .ss_nr = 1,
/* Same as for L1SCHED_BCCH and L1SCHED_SDCCH8_* (xCCH), see above. */ /* Same as for L1SCHED_BCCH and L1SCHED_SDCCH8_* (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -490,12 +490,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Slow SDCCH/8 associated control channel (sub-channel 2)", .desc = "Slow SDCCH/8 associated control channel (sub-channel 2)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8 | GSMTAP_CHANNEL_ACCH, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8 | GSMTAP_CHANNEL_ACCH,
.chan_nr = RSL_CHAN_SDCCH8_ACCH + (2 << 3), .chan_nr = RSL_CHAN_SDCCH8_ACCH + (2 << 3),
.link_id = TRX_CH_LID_SACCH, .link_id = L1SCHED_CH_LID_SACCH,
.ss_nr = 2, .ss_nr = 2,
/* Same as for L1SCHED_BCCH and L1SCHED_SDCCH8_* (xCCH), see above. */ /* Same as for L1SCHED_BCCH and L1SCHED_SDCCH8_* (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -504,12 +504,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Slow SDCCH/8 associated control channel (sub-channel 3)", .desc = "Slow SDCCH/8 associated control channel (sub-channel 3)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8 | GSMTAP_CHANNEL_ACCH, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8 | GSMTAP_CHANNEL_ACCH,
.chan_nr = RSL_CHAN_SDCCH8_ACCH + (3 << 3), .chan_nr = RSL_CHAN_SDCCH8_ACCH + (3 << 3),
.link_id = TRX_CH_LID_SACCH, .link_id = L1SCHED_CH_LID_SACCH,
.ss_nr = 3, .ss_nr = 3,
/* Same as for L1SCHED_BCCH and L1SCHED_SDCCH8_* (xCCH), see above. */ /* Same as for L1SCHED_BCCH and L1SCHED_SDCCH8_* (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -518,12 +518,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Slow SDCCH/8 associated control channel (sub-channel 4)", .desc = "Slow SDCCH/8 associated control channel (sub-channel 4)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8 | GSMTAP_CHANNEL_ACCH, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8 | GSMTAP_CHANNEL_ACCH,
.chan_nr = RSL_CHAN_SDCCH8_ACCH + (4 << 3), .chan_nr = RSL_CHAN_SDCCH8_ACCH + (4 << 3),
.link_id = TRX_CH_LID_SACCH, .link_id = L1SCHED_CH_LID_SACCH,
.ss_nr = 4, .ss_nr = 4,
/* Same as for L1SCHED_BCCH and L1SCHED_SDCCH8_* (xCCH), see above. */ /* Same as for L1SCHED_BCCH and L1SCHED_SDCCH8_* (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -532,12 +532,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Slow SDCCH/8 associated control channel (sub-channel 5)", .desc = "Slow SDCCH/8 associated control channel (sub-channel 5)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8 | GSMTAP_CHANNEL_ACCH, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8 | GSMTAP_CHANNEL_ACCH,
.chan_nr = RSL_CHAN_SDCCH8_ACCH + (5 << 3), .chan_nr = RSL_CHAN_SDCCH8_ACCH + (5 << 3),
.link_id = TRX_CH_LID_SACCH, .link_id = L1SCHED_CH_LID_SACCH,
.ss_nr = 5, .ss_nr = 5,
/* Same as for L1SCHED_BCCH and L1SCHED_SDCCH8_* (xCCH), see above. */ /* Same as for L1SCHED_BCCH and L1SCHED_SDCCH8_* (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -546,12 +546,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Slow SDCCH/8 associated control channel (sub-channel 6)", .desc = "Slow SDCCH/8 associated control channel (sub-channel 6)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8 | GSMTAP_CHANNEL_ACCH, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8 | GSMTAP_CHANNEL_ACCH,
.chan_nr = RSL_CHAN_SDCCH8_ACCH + (6 << 3), .chan_nr = RSL_CHAN_SDCCH8_ACCH + (6 << 3),
.link_id = TRX_CH_LID_SACCH, .link_id = L1SCHED_CH_LID_SACCH,
.ss_nr = 6, .ss_nr = 6,
/* Same as for L1SCHED_BCCH and L1SCHED_SDCCH8_* (xCCH), see above. */ /* Same as for L1SCHED_BCCH and L1SCHED_SDCCH8_* (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -560,12 +560,12 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Slow SDCCH/8 associated control channel (sub-channel 7)", .desc = "Slow SDCCH/8 associated control channel (sub-channel 7)",
.gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8 | GSMTAP_CHANNEL_ACCH, .gsmtap_chan_type = GSMTAP_CHANNEL_SDCCH8 | GSMTAP_CHANNEL_ACCH,
.chan_nr = RSL_CHAN_SDCCH8_ACCH + (7 << 3), .chan_nr = RSL_CHAN_SDCCH8_ACCH + (7 << 3),
.link_id = TRX_CH_LID_SACCH, .link_id = L1SCHED_CH_LID_SACCH,
.ss_nr = 7, .ss_nr = 7,
/* Same as for L1SCHED_BCCH and L1SCHED_SDCCH8_* (xCCH), see above. */ /* Same as for L1SCHED_BCCH and L1SCHED_SDCCH8_* (xCCH), see above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_CBTX, .flags = L1SCHED_CH_FLAG_CBTX,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
.tx_fn = tx_data_fn, .tx_fn = tx_data_fn,
}, },
@ -580,7 +580,7 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
* NOTE: the burst buffer is three times bigger because the * NOTE: the burst buffer is three times bigger because the
* payload of EDGE bursts is three times longer. */ * payload of EDGE bursts is three times longer. */
.burst_buf_size = 3 * 4 * GSM_BURST_PL_LEN, .burst_buf_size = 3 * 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_PDCH, .flags = L1SCHED_CH_FLAG_PDCH,
.rx_fn = rx_pdtch_fn, .rx_fn = rx_pdtch_fn,
.tx_fn = tx_pdtch_fn, .tx_fn = tx_pdtch_fn,
}, },
@ -589,7 +589,7 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
.desc = "Packet Timing advance control channel", .desc = "Packet Timing advance control channel",
.gsmtap_chan_type = GSMTAP_CHANNEL_PTCCH, .gsmtap_chan_type = GSMTAP_CHANNEL_PTCCH,
.chan_nr = RSL_CHAN_OSMO_PDCH, .chan_nr = RSL_CHAN_OSMO_PDCH,
.link_id = TRX_CH_LID_PTCCH, .link_id = L1SCHED_CH_LID_PTCCH,
/* On the Uplink, mobile stations transmit random Access Bursts /* On the Uplink, mobile stations transmit random Access Bursts
* to allow estimation of the timing advance for one MS in packet * to allow estimation of the timing advance for one MS in packet
@ -597,7 +597,7 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
* updates for several mobile stations. The coding scheme used * updates for several mobile stations. The coding scheme used
* for PTCCH/D messages is the same as for PDTCH CS-1. */ * for PTCCH/D messages is the same as for PDTCH CS-1. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_PDCH, .flags = L1SCHED_CH_FLAG_PDCH,
.rx_fn = rx_pdtch_fn, .rx_fn = rx_pdtch_fn,
.tx_fn = tx_rach_fn, .tx_fn = tx_rach_fn,
}, },
@ -610,7 +610,7 @@ const struct trx_lchan_desc trx_lchan_desc[_L1SCHED_CHAN_MAX] = {
/* Same as for L1SCHED_BCCH (xCCH), but Rx only. See above. */ /* Same as for L1SCHED_BCCH (xCCH), but Rx only. See above. */
.burst_buf_size = 4 * GSM_BURST_PL_LEN, .burst_buf_size = 4 * GSM_BURST_PL_LEN,
.flags = TRX_CH_FLAG_AUTO, .flags = L1SCHED_CH_FLAG_AUTO,
.rx_fn = rx_data_fn, .rx_fn = rx_data_fn,
}, },
[L1SCHED_SDCCH8_CBCH] = { [L1SCHED_SDCCH8_CBCH] = {

View File

@ -37,18 +37,18 @@
#include <osmocom/bb/trxcon/trx_if.h> #include <osmocom/bb/trxcon/trx_if.h>
#include <osmocom/bb/trxcon/l1ctl.h> #include <osmocom/bb/trxcon/l1ctl.h>
int rx_pdtch_fn(struct trx_instance *trx, struct trx_ts *ts, int rx_pdtch_fn(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid, struct l1sched_lchan_state *lchan, uint32_t fn, uint8_t bid,
const sbit_t *bits, const struct trx_meas_set *meas) const sbit_t *bits, const struct l1sched_meas_set *meas)
{ {
const struct trx_lchan_desc *lchan_desc; const struct l1sched_lchan_desc *lchan_desc;
uint8_t l2[GPRS_L2_MAX_LEN], *mask; uint8_t l2[GPRS_L2_MAX_LEN], *mask;
int n_errors, n_bits_total, rc; int n_errors, n_bits_total, rc;
sbit_t *buffer, *offset; sbit_t *buffer, *offset;
size_t l2_len; size_t l2_len;
/* Set up pointers */ /* Set up pointers */
lchan_desc = &trx_lchan_desc[lchan->type]; lchan_desc = &l1sched_lchan_desc[lchan->type];
mask = &lchan->rx_burst_mask; mask = &lchan->rx_burst_mask;
buffer = lchan->rx_bursts; buffer = lchan->rx_bursts;
@ -63,7 +63,7 @@ int rx_pdtch_fn(struct trx_instance *trx, struct trx_ts *ts,
*mask |= (1 << bid); *mask |= (1 << bid);
/* Store the measurements */ /* Store the measurements */
sched_trx_meas_push(lchan, meas); l1sched_lchan_meas_push(lchan, meas);
/* Copy burst to buffer of 4 bursts */ /* Copy burst to buffer of 4 bursts */
offset = buffer + bid * 116; offset = buffer + bid * 116;
@ -75,13 +75,13 @@ int rx_pdtch_fn(struct trx_instance *trx, struct trx_ts *ts,
return 0; return 0;
/* Calculate AVG of the measurements */ /* Calculate AVG of the measurements */
sched_trx_meas_avg(lchan, 4); l1sched_lchan_meas_avg(lchan, 4);
/* Check for complete set of bursts */ /* Check for complete set of bursts */
if ((*mask & 0xf) != 0xf) { if ((*mask & 0xf) != 0xf) {
LOGP(DSCHD, LOGL_ERROR, "Received incomplete (%s) data frame at " LOGP(DSCHD, LOGL_ERROR, "Received incomplete (%s) data frame at "
"fn=%u (%u/%u) for %s\n", "fn=%u (%u/%u) for %s\n",
burst_mask2str(mask, 4), lchan->meas_avg.fn, l1sched_burst_mask2str(mask, 4), lchan->meas_avg.fn,
lchan->meas_avg.fn % ts->mf_layout->period, lchan->meas_avg.fn % ts->mf_layout->period,
ts->mf_layout->period, ts->mf_layout->period,
lchan_desc->name); lchan_desc->name);
@ -103,25 +103,25 @@ int rx_pdtch_fn(struct trx_instance *trx, struct trx_ts *ts,
l2_len = rc > 0 ? rc : 0; l2_len = rc > 0 ? rc : 0;
/* Send a L2 frame to the higher layers */ /* Send a L2 frame to the higher layers */
sched_send_dt_ind(trx, ts, lchan, l1sched_send_dt_ind(trx, ts, lchan,
l2, l2_len, n_errors, rc < 0, true); l2, l2_len, n_errors, rc < 0, true);
return 0; return 0;
} }
int tx_pdtch_fn(struct trx_instance *trx, struct trx_ts *ts, int tx_pdtch_fn(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, struct l1sched_lchan_state *lchan,
struct sched_burst_req *br) struct l1sched_burst_req *br)
{ {
const struct trx_lchan_desc *lchan_desc; const struct l1sched_lchan_desc *lchan_desc;
ubit_t *buffer, *offset; ubit_t *buffer, *offset;
const uint8_t *tsc; const uint8_t *tsc;
uint8_t *mask; uint8_t *mask;
int rc; int rc;
/* Set up pointers */ /* Set up pointers */
lchan_desc = &trx_lchan_desc[lchan->type]; lchan_desc = &l1sched_lchan_desc[lchan->type];
mask = &lchan->tx_burst_mask; mask = &lchan->tx_burst_mask;
buffer = lchan->tx_bursts; buffer = lchan->tx_bursts;
@ -142,7 +142,7 @@ int tx_pdtch_fn(struct trx_instance *trx, struct trx_ts *ts,
lchan->prim->payload_len)); lchan->prim->payload_len));
/* Forget this primitive */ /* Forget this primitive */
sched_prim_drop(lchan); l1sched_prim_drop(lchan);
return -EINVAL; return -EINVAL;
} }
@ -155,7 +155,7 @@ send_burst:
*mask |= (1 << br->bid); *mask |= (1 << br->bid);
/* Choose proper TSC */ /* Choose proper TSC */
tsc = sched_nb_training_bits[trx->tsc]; tsc = l1sched_nb_training_bits[trx->tsc];
/* Compose a new burst */ /* Compose a new burst */
memset(br->burst, 0, 3); /* TB */ memset(br->burst, 0, 3); /* TB */
@ -171,10 +171,10 @@ send_burst:
/* If we have sent the last (4/4) burst */ /* If we have sent the last (4/4) burst */
if ((*mask & 0x0f) == 0x0f) { if ((*mask & 0x0f) == 0x0f) {
/* Confirm data / traffic sending */ /* Confirm data / traffic sending */
sched_send_dt_conf(trx, ts, lchan, br->fn, true); l1sched_send_dt_conf(trx, ts, lchan, br->fn, true);
/* Forget processed primitive */ /* Forget processed primitive */
sched_prim_drop(lchan); l1sched_prim_drop(lchan);
/* Reset mask */ /* Reset mask */
*mask = 0x00; *mask = 0x00;

View File

@ -73,9 +73,9 @@ static struct value_string rach_synch_seq_names[] = {
}; };
/* Obtain a to-be-transmitted RACH burst */ /* Obtain a to-be-transmitted RACH burst */
int tx_rach_fn(struct trx_instance *trx, struct trx_ts *ts, int tx_rach_fn(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, struct l1sched_lchan_state *lchan,
struct sched_burst_req *br) struct l1sched_burst_req *br)
{ {
struct l1ctl_ext_rach_req *ext_req = NULL; struct l1ctl_ext_rach_req *ext_req = NULL;
struct l1ctl_rach_req *req = NULL; struct l1ctl_rach_req *req = NULL;
@ -85,7 +85,7 @@ int tx_rach_fn(struct trx_instance *trx, struct trx_ts *ts,
int i, rc; int i, rc;
/* Is it extended (11-bit) RACH or not? */ /* Is it extended (11-bit) RACH or not? */
if (PRIM_IS_RACH11(lchan->prim)) { if (L1SCHED_PRIM_IS_RACH11(lchan->prim)) {
ext_req = (struct l1ctl_ext_rach_req *) lchan->prim->payload; ext_req = (struct l1ctl_ext_rach_req *) lchan->prim->payload;
synch_seq = ext_req->synch_seq; synch_seq = ext_req->synch_seq;
@ -94,7 +94,7 @@ int tx_rach_fn(struct trx_instance *trx, struct trx_ts *ts,
LOGP(DSCHD, LOGL_ERROR, "Unknown RACH synch. sequence=0x%02x\n", synch_seq); LOGP(DSCHD, LOGL_ERROR, "Unknown RACH synch. sequence=0x%02x\n", synch_seq);
/* Forget this primitive */ /* Forget this primitive */
sched_prim_drop(lchan); l1sched_prim_drop(lchan);
return -ENOTSUP; return -ENOTSUP;
} }
@ -109,10 +109,10 @@ int tx_rach_fn(struct trx_instance *trx, struct trx_ts *ts,
"(ra=%u bsic=%u)\n", ext_req->ra11, trx->bsic); "(ra=%u bsic=%u)\n", ext_req->ra11, trx->bsic);
/* Forget this primitive */ /* Forget this primitive */
sched_prim_drop(lchan); l1sched_prim_drop(lchan);
return rc; return rc;
} }
} else if (PRIM_IS_RACH8(lchan->prim)) { } else if (L1SCHED_PRIM_IS_RACH8(lchan->prim)) {
req = (struct l1ctl_rach_req *) lchan->prim->payload; req = (struct l1ctl_rach_req *) lchan->prim->payload;
synch_seq = RACH_SYNCH_SEQ_TS0; synch_seq = RACH_SYNCH_SEQ_TS0;
@ -127,14 +127,14 @@ int tx_rach_fn(struct trx_instance *trx, struct trx_ts *ts,
"(ra=%u bsic=%u)\n", req->ra, trx->bsic); "(ra=%u bsic=%u)\n", req->ra, trx->bsic);
/* Forget this primitive */ /* Forget this primitive */
sched_prim_drop(lchan); l1sched_prim_drop(lchan);
return rc; return rc;
} }
} else { } else {
LOGP(DSCHD, LOGL_ERROR, "Primitive has odd length %zu (expected %zu or %zu), " LOGP(DSCHD, LOGL_ERROR, "Primitive has odd length %zu (expected %zu or %zu), "
"so dropping...\n", lchan->prim->payload_len, "so dropping...\n", lchan->prim->payload_len,
sizeof(*req), sizeof(*ext_req)); sizeof(*req), sizeof(*ext_req));
sched_prim_drop(lchan); l1sched_prim_drop(lchan);
return -EINVAL; return -EINVAL;
} }
@ -156,21 +156,21 @@ int tx_rach_fn(struct trx_instance *trx, struct trx_ts *ts,
br->burst_len = GSM_BURST_LEN; br->burst_len = GSM_BURST_LEN;
LOGP(DSCHD, LOGL_NOTICE, "Scheduled %s RACH (%s) on fn=%u, tn=%u, lchan=%s\n", LOGP(DSCHD, LOGL_NOTICE, "Scheduled %s RACH (%s) on fn=%u, tn=%u, lchan=%s\n",
PRIM_IS_RACH11(lchan->prim) ? "extended (11-bit)" : "regular (8-bit)", L1SCHED_PRIM_IS_RACH11(lchan->prim) ? "extended (11-bit)" : "regular (8-bit)",
get_value_string(rach_synch_seq_names, synch_seq), br->fn, get_value_string(rach_synch_seq_names, synch_seq), br->fn,
ts->index, trx_lchan_desc[lchan->type].name); ts->index, l1sched_lchan_desc[lchan->type].name);
/* Confirm RACH request */ /* Confirm RACH request */
l1ctl_tx_rach_conf(trx->l1l, trx->band_arfcn, br->fn); l1ctl_tx_rach_conf(trx->l1l, trx->band_arfcn, br->fn);
/* Optional GSMTAP logging */ /* Optional GSMTAP logging */
sched_gsmtap_send(lchan->type, br->fn, ts->index, l1sched_gsmtap_send(lchan->type, br->fn, ts->index,
trx->band_arfcn | ARFCN_UPLINK, 0, 0, trx->band_arfcn | ARFCN_UPLINK, 0, 0,
PRIM_IS_RACH11(lchan->prim) ? (uint8_t *) &ext_req->ra11 : &req->ra, L1SCHED_PRIM_IS_RACH11(lchan->prim) ? (uint8_t *) &ext_req->ra11 : &req->ra,
PRIM_IS_RACH11(lchan->prim) ? 2 : 1); L1SCHED_PRIM_IS_RACH11(lchan->prim) ? 2 : 1);
/* Forget processed primitive */ /* Forget processed primitive */
sched_prim_drop(lchan); l1sched_prim_drop(lchan);
return 0; return 0;
} }

View File

@ -64,9 +64,9 @@ static void decode_sb(struct gsm_time *time, uint8_t *bsic, uint8_t *sb_info)
time->fn = gsm_gsmtime2fn(time); time->fn = gsm_gsmtime2fn(time);
} }
int rx_sch_fn(struct trx_instance *trx, struct trx_ts *ts, int rx_sch_fn(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid, struct l1sched_lchan_state *lchan, uint32_t fn, uint8_t bid,
const sbit_t *bits, const struct trx_meas_set *meas) const sbit_t *bits, const struct l1sched_meas_set *meas)
{ {
sbit_t payload[2 * 39]; sbit_t payload[2 * 39];
struct gsm_time time; struct gsm_time time;
@ -109,8 +109,8 @@ int rx_sch_fn(struct trx_instance *trx, struct trx_ts *ts,
return -ENOMEM; return -ENOMEM;
/* Fill in some downlink info */ /* Fill in some downlink info */
data->chan_nr = trx_lchan_desc[lchan->type].chan_nr | ts->index; data->chan_nr = l1sched_lchan_desc[lchan->type].chan_nr | ts->index;
data->link_id = trx_lchan_desc[lchan->type].link_id; data->link_id = l1sched_lchan_desc[lchan->type].link_id;
data->band_arfcn = htons(trx->band_arfcn); data->band_arfcn = htons(trx->band_arfcn);
data->frame_nr = htonl(fn); data->frame_nr = htonl(fn);
data->rx_level = -(meas->rssi); data->rx_level = -(meas->rssi);

View File

@ -39,18 +39,18 @@
#include <osmocom/bb/trxcon/trx_if.h> #include <osmocom/bb/trxcon/trx_if.h>
#include <osmocom/bb/trxcon/l1ctl.h> #include <osmocom/bb/trxcon/l1ctl.h>
int rx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts, int rx_tchf_fn(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid, struct l1sched_lchan_state *lchan, uint32_t fn, uint8_t bid,
const sbit_t *bits, const struct trx_meas_set *meas) const sbit_t *bits, const struct l1sched_meas_set *meas)
{ {
const struct trx_lchan_desc *lchan_desc; const struct l1sched_lchan_desc *lchan_desc;
int n_errors = -1, n_bits_total, rc; int n_errors = -1, n_bits_total, rc;
sbit_t *buffer, *offset; sbit_t *buffer, *offset;
uint8_t l2[128], *mask; uint8_t l2[128], *mask;
size_t l2_len; size_t l2_len;
/* Set up pointers */ /* Set up pointers */
lchan_desc = &trx_lchan_desc[lchan->type]; lchan_desc = &l1sched_lchan_desc[lchan->type];
mask = &lchan->rx_burst_mask; mask = &lchan->rx_burst_mask;
buffer = lchan->rx_bursts; buffer = lchan->rx_bursts;
@ -65,7 +65,7 @@ int rx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts,
*mask |= (1 << bid); *mask |= (1 << bid);
/* Store the measurements */ /* Store the measurements */
sched_trx_meas_push(lchan, meas); l1sched_lchan_meas_push(lchan, meas);
/* Copy burst to end of buffer of 8 bursts */ /* Copy burst to end of buffer of 8 bursts */
offset = buffer + bid * 116 + 464; offset = buffer + bid * 116 + 464;
@ -77,13 +77,13 @@ int rx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts,
return 0; return 0;
/* Calculate AVG of the measurements */ /* Calculate AVG of the measurements */
sched_trx_meas_avg(lchan, 8); l1sched_lchan_meas_avg(lchan, 8);
/* Check for complete set of bursts */ /* Check for complete set of bursts */
if ((*mask & 0xff) != 0xff) { if ((*mask & 0xff) != 0xff) {
LOGP(DSCHD, LOGL_ERROR, "Received incomplete (%s) traffic frame at " LOGP(DSCHD, LOGL_ERROR, "Received incomplete (%s) traffic frame at "
"fn=%u (%u/%u) for %s\n", "fn=%u (%u/%u) for %s\n",
burst_mask2str(mask, 8), lchan->meas_avg.fn, l1sched_burst_mask2str(mask, 8), lchan->meas_avg.fn,
lchan->meas_avg.fn % ts->mf_layout->period, lchan->meas_avg.fn % ts->mf_layout->period,
ts->mf_layout->period, ts->mf_layout->period,
lchan_desc->name); lchan_desc->name);
@ -128,7 +128,7 @@ int rx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts,
goto bfi; goto bfi;
} else if (rc == GSM_MACBLOCK_LEN) { } else if (rc == GSM_MACBLOCK_LEN) {
/* FACCH received, forward it to the higher layers */ /* FACCH received, forward it to the higher layers */
sched_send_dt_ind(trx, ts, lchan, l2, GSM_MACBLOCK_LEN, l1sched_send_dt_ind(trx, ts, lchan, l2, GSM_MACBLOCK_LEN,
n_errors, false, false); n_errors, false, false);
/* Send BFI substituting a stolen TCH frame */ /* Send BFI substituting a stolen TCH frame */
@ -140,13 +140,13 @@ int rx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts,
} }
/* Send a traffic frame to the higher layers */ /* Send a traffic frame to the higher layers */
return sched_send_dt_ind(trx, ts, lchan, l2, l2_len, return l1sched_send_dt_ind(trx, ts, lchan, l2, l2_len,
n_errors, false, true); n_errors, false, true);
bfi: bfi:
/* Didn't try to decode, fake measurements */ /* Didn't try to decode, fake measurements */
if (n_errors < 0) { if (n_errors < 0) {
lchan->meas_avg = (struct trx_meas_set) { lchan->meas_avg = (struct l1sched_meas_set) {
.fn = lchan->meas_avg.fn, .fn = lchan->meas_avg.fn,
.toa256 = 0, .toa256 = 0,
.rssi = -110, .rssi = -110,
@ -158,22 +158,22 @@ bfi:
/* BFI is not applicable in signalling mode */ /* BFI is not applicable in signalling mode */
if (lchan->tch_mode == GSM48_CMODE_SIGN) if (lchan->tch_mode == GSM48_CMODE_SIGN)
return sched_send_dt_ind(trx, ts, lchan, NULL, 0, return l1sched_send_dt_ind(trx, ts, lchan, NULL, 0,
n_errors, true, false); n_errors, true, false);
/* Bad frame indication */ /* Bad frame indication */
l2_len = sched_bad_frame_ind(l2, lchan); l2_len = l1sched_bad_frame_ind(l2, lchan);
/* Send a BFI frame to the higher layers */ /* Send a BFI frame to the higher layers */
return sched_send_dt_ind(trx, ts, lchan, l2, l2_len, return l1sched_send_dt_ind(trx, ts, lchan, l2, l2_len,
n_errors, true, true); n_errors, true, true);
} }
int tx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts, int tx_tchf_fn(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, struct l1sched_lchan_state *lchan,
struct sched_burst_req *br) struct l1sched_burst_req *br)
{ {
const struct trx_lchan_desc *lchan_desc; const struct l1sched_lchan_desc *lchan_desc;
ubit_t *buffer, *offset; ubit_t *buffer, *offset;
const uint8_t *tsc; const uint8_t *tsc;
uint8_t *mask; uint8_t *mask;
@ -181,7 +181,7 @@ int tx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts,
int rc; int rc;
/* Set up pointers */ /* Set up pointers */
lchan_desc = &trx_lchan_desc[lchan->type]; lchan_desc = &l1sched_lchan_desc[lchan->type];
mask = &lchan->tx_burst_mask; mask = &lchan->tx_burst_mask;
buffer = lchan->tx_bursts; buffer = lchan->tx_bursts;
@ -211,7 +211,7 @@ int tx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts,
"dropping frame...\n"); "dropping frame...\n");
/* Forget this primitive */ /* Forget this primitive */
sched_prim_drop(lchan); l1sched_prim_drop(lchan);
return -ENOTSUP; return -ENOTSUP;
default: default:
@ -219,7 +219,7 @@ int tx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts,
"dropping frame...\n", lchan->tch_mode); "dropping frame...\n", lchan->tch_mode);
/* Forget this primitive */ /* Forget this primitive */
sched_prim_drop(lchan); l1sched_prim_drop(lchan);
return -EINVAL; return -EINVAL;
} }
@ -232,7 +232,7 @@ int tx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts,
"(expected %zu for TCH or %u for FACCH), so dropping...\n", "(expected %zu for TCH or %u for FACCH), so dropping...\n",
lchan->prim->payload_len, l2_len, GSM_MACBLOCK_LEN); lchan->prim->payload_len, l2_len, GSM_MACBLOCK_LEN);
sched_prim_drop(lchan); l1sched_prim_drop(lchan);
return -EINVAL; return -EINVAL;
} }
@ -247,7 +247,7 @@ int tx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts,
lchan->prim->payload_len)); lchan->prim->payload_len));
/* Forget this primitive */ /* Forget this primitive */
sched_prim_drop(lchan); l1sched_prim_drop(lchan);
return -EINVAL; return -EINVAL;
} }
@ -260,7 +260,7 @@ send_burst:
*mask |= (1 << br->bid); *mask |= (1 << br->bid);
/* Choose proper TSC */ /* Choose proper TSC */
tsc = sched_nb_training_bits[trx->tsc]; tsc = l1sched_nb_training_bits[trx->tsc];
/* Compose a new burst */ /* Compose a new burst */
memset(br->burst, 0, 3); /* TB */ memset(br->burst, 0, 3); /* TB */
@ -276,10 +276,10 @@ send_burst:
/* If we have sent the last (4/4) burst */ /* If we have sent the last (4/4) burst */
if (*mask == 0x0f) { if (*mask == 0x0f) {
/* Confirm data / traffic sending */ /* Confirm data / traffic sending */
sched_send_dt_conf(trx, ts, lchan, br->fn, PRIM_IS_TCH(lchan->prim)); l1sched_send_dt_conf(trx, ts, lchan, br->fn, L1SCHED_PRIM_IS_TCH(lchan->prim));
/* Forget processed primitive */ /* Forget processed primitive */
sched_prim_drop(lchan); l1sched_prim_drop(lchan);
/* Reset mask */ /* Reset mask */
*mask = 0x00; *mask = 0x00;

View File

@ -97,7 +97,7 @@ const uint8_t tch_h1_ul_facch_block_map[3][6] = {
* @param start init or end of transmission? * @param start init or end of transmission?
* @return true (yes) or false (no) * @return true (yes) or false (no)
*/ */
bool sched_tchh_block_map_fn(enum l1sched_lchan_type chan, bool l1sched_tchh_block_map_fn(enum l1sched_lchan_type chan,
uint32_t fn, bool ul, bool facch, bool start) uint32_t fn, bool ul, bool facch, bool start)
{ {
uint8_t fn_mf; uint8_t fn_mf;
@ -153,7 +153,7 @@ bool sched_tchh_block_map_fn(enum l1sched_lchan_type chan,
* @return either frame number of the first burst, * @return either frame number of the first burst,
* or fn=last_fn if calculation failed * or fn=last_fn if calculation failed
*/ */
uint32_t sched_tchh_block_dl_first_fn(enum l1sched_lchan_type chan, uint32_t l1sched_tchh_block_dl_first_fn(enum l1sched_lchan_type chan,
uint32_t last_fn, bool facch) uint32_t last_fn, bool facch)
{ {
uint8_t fn_mf, fn_diff; uint8_t fn_mf, fn_diff;
@ -195,18 +195,18 @@ uint32_t sched_tchh_block_dl_first_fn(enum l1sched_lchan_type chan,
return last_fn; return last_fn;
} }
int rx_tchh_fn(struct trx_instance *trx, struct trx_ts *ts, int rx_tchh_fn(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid, struct l1sched_lchan_state *lchan, uint32_t fn, uint8_t bid,
const sbit_t *bits, const struct trx_meas_set *meas) const sbit_t *bits, const struct l1sched_meas_set *meas)
{ {
const struct trx_lchan_desc *lchan_desc; const struct l1sched_lchan_desc *lchan_desc;
int n_errors = -1, n_bits_total, rc; int n_errors = -1, n_bits_total, rc;
sbit_t *buffer, *offset; sbit_t *buffer, *offset;
uint8_t l2[128], *mask; uint8_t l2[128], *mask;
size_t l2_len; size_t l2_len;
/* Set up pointers */ /* Set up pointers */
lchan_desc = &trx_lchan_desc[lchan->type]; lchan_desc = &l1sched_lchan_desc[lchan->type];
mask = &lchan->rx_burst_mask; mask = &lchan->rx_burst_mask;
buffer = lchan->rx_bursts; buffer = lchan->rx_bursts;
@ -220,10 +220,10 @@ int rx_tchh_fn(struct trx_instance *trx, struct trx_ts *ts,
/* Align reception of the first FACCH/H frame */ /* Align reception of the first FACCH/H frame */
if (lchan->tch_mode == GSM48_CMODE_SIGN) { if (lchan->tch_mode == GSM48_CMODE_SIGN) {
if (!sched_tchh_facch_start(lchan->type, fn, 0)) if (!l1sched_tchh_facch_start(lchan->type, fn, 0))
return 0; return 0;
} else { /* or TCH/H traffic frame */ } else { /* or TCH/H traffic frame */
if (!sched_tchh_traffic_start(lchan->type, fn, 0)) if (!l1sched_tchh_traffic_start(lchan->type, fn, 0))
return 0; return 0;
} }
} }
@ -232,7 +232,7 @@ int rx_tchh_fn(struct trx_instance *trx, struct trx_ts *ts,
*mask |= (1 << bid); *mask |= (1 << bid);
/* Store the measurements */ /* Store the measurements */
sched_trx_meas_push(lchan, meas); l1sched_lchan_meas_push(lchan, meas);
/* Copy burst to the end of buffer of 6 bursts */ /* Copy burst to the end of buffer of 6 bursts */
offset = buffer + bid * 116 + 464; offset = buffer + bid * 116 + 464;
@ -264,7 +264,7 @@ int rx_tchh_fn(struct trx_instance *trx, struct trx_ts *ts,
case GSM48_CMODE_SIGN: case GSM48_CMODE_SIGN:
case GSM48_CMODE_SPEECH_V1: /* HR */ case GSM48_CMODE_SPEECH_V1: /* HR */
rc = gsm0503_tch_hr_decode(l2, buffer, rc = gsm0503_tch_hr_decode(l2, buffer,
!sched_tchh_facch_end(lchan->type, fn, 0), !l1sched_tchh_facch_end(lchan->type, fn, 0),
&n_errors, &n_bits_total); &n_errors, &n_bits_total);
break; break;
case GSM48_CMODE_SPEECH_AMR: /* AMR */ case GSM48_CMODE_SPEECH_AMR: /* AMR */
@ -289,7 +289,7 @@ int rx_tchh_fn(struct trx_instance *trx, struct trx_ts *ts,
/* Check decoding result */ /* Check decoding result */
if (rc < 4) { if (rc < 4) {
/* Calculate AVG of the measurements (assuming 4 bursts) */ /* Calculate AVG of the measurements (assuming 4 bursts) */
sched_trx_meas_avg(lchan, 4); l1sched_lchan_meas_avg(lchan, 4);
LOGP(DSCHD, LOGL_ERROR, "Received bad %s frame (rc=%d, ber=%d/%d) at fn=%u\n", LOGP(DSCHD, LOGL_ERROR, "Received bad %s frame (rc=%d, ber=%d/%d) at fn=%u\n",
lchan_desc->name, rc, n_errors, n_bits_total, lchan->meas_avg.fn); lchan_desc->name, rc, n_errors, n_bits_total, lchan->meas_avg.fn);
@ -301,10 +301,10 @@ int rx_tchh_fn(struct trx_instance *trx, struct trx_ts *ts,
lchan->dl_ongoing_facch = true; lchan->dl_ongoing_facch = true;
/* Calculate AVG of the measurements (FACCH/H takes 6 bursts) */ /* Calculate AVG of the measurements (FACCH/H takes 6 bursts) */
sched_trx_meas_avg(lchan, 6); l1sched_lchan_meas_avg(lchan, 6);
/* FACCH/H received, forward to the higher layers */ /* FACCH/H received, forward to the higher layers */
sched_send_dt_ind(trx, ts, lchan, l2, GSM_MACBLOCK_LEN, l1sched_send_dt_ind(trx, ts, lchan, l2, GSM_MACBLOCK_LEN,
n_errors, false, false); n_errors, false, false);
/* Send BFI substituting 1/2 stolen TCH frames */ /* Send BFI substituting 1/2 stolen TCH frames */
@ -315,11 +315,11 @@ int rx_tchh_fn(struct trx_instance *trx, struct trx_ts *ts,
l2_len = rc; l2_len = rc;
/* Calculate AVG of the measurements (traffic takes 4 bursts) */ /* Calculate AVG of the measurements (traffic takes 4 bursts) */
sched_trx_meas_avg(lchan, 4); l1sched_lchan_meas_avg(lchan, 4);
} }
/* Send a traffic frame to the higher layers */ /* Send a traffic frame to the higher layers */
return sched_send_dt_ind(trx, ts, lchan, l2, l2_len, return l1sched_send_dt_ind(trx, ts, lchan, l2, l2_len,
n_errors, false, true); n_errors, false, true);
bfi_shift: bfi_shift:
@ -333,8 +333,8 @@ bfi_shift:
bfi: bfi:
/* Didn't try to decode, fake measurements */ /* Didn't try to decode, fake measurements */
if (n_errors < 0) { if (n_errors < 0) {
lchan->meas_avg = (struct trx_meas_set) { lchan->meas_avg = (struct l1sched_meas_set) {
.fn = sched_tchh_block_dl_first_fn(lchan->type, fn, false), .fn = l1sched_tchh_block_dl_first_fn(lchan->type, fn, false),
.toa256 = 0, .toa256 = 0,
.rssi = -110, .rssi = -110,
}; };
@ -345,22 +345,22 @@ bfi:
/* BFI is not applicable in signalling mode */ /* BFI is not applicable in signalling mode */
if (lchan->tch_mode == GSM48_CMODE_SIGN) if (lchan->tch_mode == GSM48_CMODE_SIGN)
return sched_send_dt_ind(trx, ts, lchan, NULL, 0, return l1sched_send_dt_ind(trx, ts, lchan, NULL, 0,
n_errors, true, false); n_errors, true, false);
/* Bad frame indication */ /* Bad frame indication */
l2_len = sched_bad_frame_ind(l2, lchan); l2_len = l1sched_bad_frame_ind(l2, lchan);
/* Send a BFI frame to the higher layers */ /* Send a BFI frame to the higher layers */
return sched_send_dt_ind(trx, ts, lchan, l2, l2_len, return l1sched_send_dt_ind(trx, ts, lchan, l2, l2_len,
n_errors, true, true); n_errors, true, true);
} }
int tx_tchh_fn(struct trx_instance *trx, struct trx_ts *ts, int tx_tchh_fn(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, struct l1sched_lchan_state *lchan,
struct sched_burst_req *br) struct l1sched_burst_req *br)
{ {
const struct trx_lchan_desc *lchan_desc; const struct l1sched_lchan_desc *lchan_desc;
ubit_t *buffer, *offset; ubit_t *buffer, *offset;
const uint8_t *tsc; const uint8_t *tsc;
uint8_t *mask; uint8_t *mask;
@ -368,7 +368,7 @@ int tx_tchh_fn(struct trx_instance *trx, struct trx_ts *ts,
int rc; int rc;
/* Set up pointers */ /* Set up pointers */
lchan_desc = &trx_lchan_desc[lchan->type]; lchan_desc = &l1sched_lchan_desc[lchan->type];
mask = &lchan->tx_burst_mask; mask = &lchan->tx_burst_mask;
buffer = lchan->tx_bursts; buffer = lchan->tx_bursts;
@ -382,7 +382,7 @@ int tx_tchh_fn(struct trx_instance *trx, struct trx_ts *ts,
if (*mask == 0x00) { if (*mask == 0x00) {
/* Align transmission of the first FACCH/H frame */ /* Align transmission of the first FACCH/H frame */
if (lchan->tch_mode == GSM48_CMODE_SIGN) if (lchan->tch_mode == GSM48_CMODE_SIGN)
if (!sched_tchh_facch_start(lchan->type, br->fn, 1)) if (!l1sched_tchh_facch_start(lchan->type, br->fn, 1))
return 0; return 0;
} }
@ -413,19 +413,19 @@ int tx_tchh_fn(struct trx_instance *trx, struct trx_ts *ts,
"dropping frame...\n"); "dropping frame...\n");
/* Forget this primitive */ /* Forget this primitive */
sched_prim_drop(lchan); l1sched_prim_drop(lchan);
return -ENOTSUP; return -ENOTSUP;
default: default:
LOGP(DSCHD, LOGL_ERROR, "Invalid TCH mode: %u, " LOGP(DSCHD, LOGL_ERROR, "Invalid TCH mode: %u, "
"dropping frame...\n", lchan->tch_mode); "dropping frame...\n", lchan->tch_mode);
/* Forget this primitive */ /* Forget this primitive */
sched_prim_drop(lchan); l1sched_prim_drop(lchan);
return -EINVAL; return -EINVAL;
} }
/* Determine payload length */ /* Determine payload length */
if (PRIM_IS_FACCH(lchan->prim)) { if (L1SCHED_PRIM_IS_FACCH(lchan->prim)) {
l2_len = GSM_MACBLOCK_LEN; /* FACCH */ l2_len = GSM_MACBLOCK_LEN; /* FACCH */
} else if (lchan->prim->payload_len != l2_len) { } else if (lchan->prim->payload_len != l2_len) {
LOGP(DSCHD, LOGL_ERROR, "Primitive has odd length %zu " LOGP(DSCHD, LOGL_ERROR, "Primitive has odd length %zu "
@ -433,7 +433,7 @@ int tx_tchh_fn(struct trx_instance *trx, struct trx_ts *ts,
lchan->prim->payload_len, l2_len, GSM_MACBLOCK_LEN); lchan->prim->payload_len, l2_len, GSM_MACBLOCK_LEN);
/* Forget this primitive */ /* Forget this primitive */
sched_prim_drop(lchan); l1sched_prim_drop(lchan);
return -EINVAL; return -EINVAL;
} }
@ -445,12 +445,12 @@ int tx_tchh_fn(struct trx_instance *trx, struct trx_ts *ts,
lchan->prim->payload_len)); lchan->prim->payload_len));
/* Forget this primitive */ /* Forget this primitive */
sched_prim_drop(lchan); l1sched_prim_drop(lchan);
return -EINVAL; return -EINVAL;
} }
/* A FACCH/H frame occupies 6 bursts */ /* A FACCH/H frame occupies 6 bursts */
if (PRIM_IS_FACCH(lchan->prim)) if (L1SCHED_PRIM_IS_FACCH(lchan->prim))
lchan->ul_facch_blocks = 6; lchan->ul_facch_blocks = 6;
send_burst: send_burst:
@ -461,7 +461,7 @@ send_burst:
*mask |= (1 << br->bid); *mask |= (1 << br->bid);
/* Choose proper TSC */ /* Choose proper TSC */
tsc = sched_nb_training_bits[trx->tsc]; tsc = l1sched_nb_training_bits[trx->tsc];
/* Compose a new burst */ /* Compose a new burst */
memset(br->burst, 0, 3); /* TB */ memset(br->burst, 0, 3); /* TB */
@ -484,11 +484,11 @@ send_burst:
* confirm data / traffic sending * confirm data / traffic sending
*/ */
if (!lchan->ul_facch_blocks) if (!lchan->ul_facch_blocks)
sched_send_dt_conf(trx, ts, lchan, br->fn, l1sched_send_dt_conf(trx, ts, lchan, br->fn,
PRIM_IS_TCH(lchan->prim)); L1SCHED_PRIM_IS_TCH(lchan->prim));
/* Forget processed primitive */ /* Forget processed primitive */
sched_prim_drop(lchan); l1sched_prim_drop(lchan);
} }
return 0; return 0;

View File

@ -37,17 +37,17 @@
#include <osmocom/bb/trxcon/trx_if.h> #include <osmocom/bb/trxcon/trx_if.h>
#include <osmocom/bb/trxcon/l1ctl.h> #include <osmocom/bb/trxcon/l1ctl.h>
int rx_data_fn(struct trx_instance *trx, struct trx_ts *ts, int rx_data_fn(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid, struct l1sched_lchan_state *lchan, uint32_t fn, uint8_t bid,
const sbit_t *bits, const struct trx_meas_set *meas) const sbit_t *bits, const struct l1sched_meas_set *meas)
{ {
const struct trx_lchan_desc *lchan_desc; const struct l1sched_lchan_desc *lchan_desc;
uint8_t l2[GSM_MACBLOCK_LEN], *mask; uint8_t l2[GSM_MACBLOCK_LEN], *mask;
int n_errors, n_bits_total, rc; int n_errors, n_bits_total, rc;
sbit_t *buffer, *offset; sbit_t *buffer, *offset;
/* Set up pointers */ /* Set up pointers */
lchan_desc = &trx_lchan_desc[lchan->type]; lchan_desc = &l1sched_lchan_desc[lchan->type];
mask = &lchan->rx_burst_mask; mask = &lchan->rx_burst_mask;
buffer = lchan->rx_bursts; buffer = lchan->rx_bursts;
@ -62,7 +62,7 @@ int rx_data_fn(struct trx_instance *trx, struct trx_ts *ts,
*mask |= (1 << bid); *mask |= (1 << bid);
/* Store the measurements */ /* Store the measurements */
sched_trx_meas_push(lchan, meas); l1sched_lchan_meas_push(lchan, meas);
/* Copy burst to buffer of 4 bursts */ /* Copy burst to buffer of 4 bursts */
offset = buffer + bid * 116; offset = buffer + bid * 116;
@ -74,13 +74,13 @@ int rx_data_fn(struct trx_instance *trx, struct trx_ts *ts,
return 0; return 0;
/* Calculate AVG of the measurements */ /* Calculate AVG of the measurements */
sched_trx_meas_avg(lchan, 4); l1sched_lchan_meas_avg(lchan, 4);
/* Check for complete set of bursts */ /* Check for complete set of bursts */
if ((*mask & 0xf) != 0xf) { if ((*mask & 0xf) != 0xf) {
LOGP(DSCHD, LOGL_ERROR, "Received incomplete (%s) data frame at " LOGP(DSCHD, LOGL_ERROR, "Received incomplete (%s) data frame at "
"fn=%u (%u/%u) for %s\n", "fn=%u (%u/%u) for %s\n",
burst_mask2str(mask, 4), lchan->meas_avg.fn, l1sched_burst_mask2str(mask, 4), lchan->meas_avg.fn,
lchan->meas_avg.fn % ts->mf_layout->period, lchan->meas_avg.fn % ts->mf_layout->period,
ts->mf_layout->period, ts->mf_layout->period,
lchan_desc->name); lchan_desc->name);
@ -103,27 +103,27 @@ int rx_data_fn(struct trx_instance *trx, struct trx_ts *ts,
* We should anyway send dummy frame for * We should anyway send dummy frame for
* proper measurement reporting... * proper measurement reporting...
*/ */
return sched_send_dt_ind(trx, ts, lchan, NULL, 0, return l1sched_send_dt_ind(trx, ts, lchan, NULL, 0,
n_errors, true, false); n_errors, true, false);
} }
/* Send a L2 frame to the higher layers */ /* Send a L2 frame to the higher layers */
return sched_send_dt_ind(trx, ts, lchan, l2, GSM_MACBLOCK_LEN, return l1sched_send_dt_ind(trx, ts, lchan, l2, GSM_MACBLOCK_LEN,
n_errors, false, false); n_errors, false, false);
} }
int tx_data_fn(struct trx_instance *trx, struct trx_ts *ts, int tx_data_fn(struct trx_instance *trx, struct l1sched_ts *ts,
struct trx_lchan_state *lchan, struct l1sched_lchan_state *lchan,
struct sched_burst_req *br) struct l1sched_burst_req *br)
{ {
const struct trx_lchan_desc *lchan_desc; const struct l1sched_lchan_desc *lchan_desc;
ubit_t *buffer, *offset; ubit_t *buffer, *offset;
const uint8_t *tsc; const uint8_t *tsc;
uint8_t *mask; uint8_t *mask;
int rc; int rc;
/* Set up pointers */ /* Set up pointers */
lchan_desc = &trx_lchan_desc[lchan->type]; lchan_desc = &l1sched_lchan_desc[lchan->type];
mask = &lchan->tx_burst_mask; mask = &lchan->tx_burst_mask;
buffer = lchan->tx_bursts; buffer = lchan->tx_bursts;
@ -140,7 +140,7 @@ int tx_data_fn(struct trx_instance *trx, struct trx_ts *ts,
LOGP(DSCHD, LOGL_ERROR, "Primitive has odd length %zu (expected %u), " LOGP(DSCHD, LOGL_ERROR, "Primitive has odd length %zu (expected %u), "
"so dropping...\n", lchan->prim->payload_len, GSM_MACBLOCK_LEN); "so dropping...\n", lchan->prim->payload_len, GSM_MACBLOCK_LEN);
sched_prim_drop(lchan); l1sched_prim_drop(lchan);
return -EINVAL; return -EINVAL;
} }
@ -152,7 +152,7 @@ int tx_data_fn(struct trx_instance *trx, struct trx_ts *ts,
lchan->prim->payload_len)); lchan->prim->payload_len));
/* Forget this primitive */ /* Forget this primitive */
sched_prim_drop(lchan); l1sched_prim_drop(lchan);
return -EINVAL; return -EINVAL;
} }
@ -165,7 +165,7 @@ send_burst:
*mask |= (1 << br->bid); *mask |= (1 << br->bid);
/* Choose proper TSC */ /* Choose proper TSC */
tsc = sched_nb_training_bits[trx->tsc]; tsc = l1sched_nb_training_bits[trx->tsc];
/* Compose a new burst */ /* Compose a new burst */
memset(br->burst, 0, 3); /* TB */ memset(br->burst, 0, 3); /* TB */
@ -181,10 +181,10 @@ send_burst:
/* If we have sent the last (4/4) burst */ /* If we have sent the last (4/4) burst */
if ((*mask & 0x0f) == 0x0f) { if ((*mask & 0x0f) == 0x0f) {
/* Confirm data sending */ /* Confirm data sending */
sched_send_dt_conf(trx, ts, lchan, br->fn, false); l1sched_send_dt_conf(trx, ts, lchan, br->fn, false);
/* Forget processed primitive */ /* Forget processed primitive */
sched_prim_drop(lchan); l1sched_prim_drop(lchan);
/* Reset mask */ /* Reset mask */
*mask = 0x00; *mask = 0x00;

View File

@ -28,7 +28,7 @@
#include <osmocom/bb/trxcon/sched_trx.h> #include <osmocom/bb/trxcon/sched_trx.h>
/* Non-combined CCCH */ /* Non-combined CCCH */
static const struct trx_frame frame_bcch[51] = { static const struct l1sched_tdma_frame frame_bcch[51] = {
/* dl_chan dl_bid ul_chan ul_bid */ /* dl_chan dl_bid ul_chan ul_bid */
{ L1SCHED_FCCH, 0, L1SCHED_RACH, 0 }, { L1SCHED_FCCH, 0, L1SCHED_RACH, 0 },
{ L1SCHED_SCH, 0, L1SCHED_RACH, 0 }, { L1SCHED_SCH, 0, L1SCHED_RACH, 0 },
@ -84,7 +84,7 @@ static const struct trx_frame frame_bcch[51] = {
}; };
/* Combined CCCH+SDCCH4 */ /* Combined CCCH+SDCCH4 */
static const struct trx_frame frame_bcch_sdcch4[102] = { static const struct l1sched_tdma_frame frame_bcch_sdcch4[102] = {
/* dl_chan dl_bid ul_chan ul_bid */ /* dl_chan dl_bid ul_chan ul_bid */
{ L1SCHED_FCCH, 0, L1SCHED_SDCCH4_3, 0 }, { L1SCHED_FCCH, 0, L1SCHED_SDCCH4_3, 0 },
{ L1SCHED_SCH, 0, L1SCHED_SDCCH4_3, 1 }, { L1SCHED_SCH, 0, L1SCHED_SDCCH4_3, 1 },
@ -191,7 +191,7 @@ static const struct trx_frame frame_bcch_sdcch4[102] = {
{ L1SCHED_IDLE, 0, L1SCHED_SDCCH4_2, 3 }, { L1SCHED_IDLE, 0, L1SCHED_SDCCH4_2, 3 },
}; };
static const struct trx_frame frame_bcch_sdcch4_cbch[102] = { static const struct l1sched_tdma_frame frame_bcch_sdcch4_cbch[102] = {
/* dl_chan dl_bid ul_chan ul_bid */ /* dl_chan dl_bid ul_chan ul_bid */
{ L1SCHED_FCCH, 0, L1SCHED_SDCCH4_3, 0 }, { L1SCHED_FCCH, 0, L1SCHED_SDCCH4_3, 0 },
{ L1SCHED_SCH, 0, L1SCHED_SDCCH4_3, 1 }, { L1SCHED_SCH, 0, L1SCHED_SDCCH4_3, 1 },
@ -298,7 +298,7 @@ static const struct trx_frame frame_bcch_sdcch4_cbch[102] = {
{ L1SCHED_IDLE, 0, L1SCHED_IDLE, 3 }, { L1SCHED_IDLE, 0, L1SCHED_IDLE, 3 },
}; };
static const struct trx_frame frame_sdcch8[102] = { static const struct l1sched_tdma_frame frame_sdcch8[102] = {
/* dl_chan dl_bid ul_chan ul_bid */ /* dl_chan dl_bid ul_chan ul_bid */
{ L1SCHED_SDCCH8_0, 0, L1SCHED_SACCH8_5, 0 }, { L1SCHED_SDCCH8_0, 0, L1SCHED_SACCH8_5, 0 },
{ L1SCHED_SDCCH8_0, 1, L1SCHED_SACCH8_5, 1 }, { L1SCHED_SDCCH8_0, 1, L1SCHED_SACCH8_5, 1 },
@ -405,7 +405,7 @@ static const struct trx_frame frame_sdcch8[102] = {
{ L1SCHED_IDLE, 0, L1SCHED_SACCH8_4, 3 }, { L1SCHED_IDLE, 0, L1SCHED_SACCH8_4, 3 },
}; };
static const struct trx_frame frame_sdcch8_cbch[102] = { static const struct l1sched_tdma_frame frame_sdcch8_cbch[102] = {
/* dl_chan dl_bid ul_chan ul_bid */ /* dl_chan dl_bid ul_chan ul_bid */
{ L1SCHED_SDCCH8_0, 0, L1SCHED_SACCH8_5, 0 }, { L1SCHED_SDCCH8_0, 0, L1SCHED_SACCH8_5, 0 },
{ L1SCHED_SDCCH8_0, 1, L1SCHED_SACCH8_5, 1 }, { L1SCHED_SDCCH8_0, 1, L1SCHED_SACCH8_5, 1 },
@ -512,7 +512,7 @@ static const struct trx_frame frame_sdcch8_cbch[102] = {
{ L1SCHED_IDLE, 0, L1SCHED_SACCH8_4, 3 }, { L1SCHED_IDLE, 0, L1SCHED_SACCH8_4, 3 },
}; };
static const struct trx_frame frame_tchf_ts0[104] = { static const struct l1sched_tdma_frame frame_tchf_ts0[104] = {
/* dl_chan dl_bid ul_chan ul_bid */ /* dl_chan dl_bid ul_chan ul_bid */
{ L1SCHED_TCHF, 0, L1SCHED_TCHF, 0 }, { L1SCHED_TCHF, 0, L1SCHED_TCHF, 0 },
{ L1SCHED_TCHF, 1, L1SCHED_TCHF, 1 }, { L1SCHED_TCHF, 1, L1SCHED_TCHF, 1 },
@ -620,7 +620,7 @@ static const struct trx_frame frame_tchf_ts0[104] = {
{ L1SCHED_IDLE, 0, L1SCHED_IDLE, 0 }, { L1SCHED_IDLE, 0, L1SCHED_IDLE, 0 },
}; };
static const struct trx_frame frame_tchf_ts1[104] = { static const struct l1sched_tdma_frame frame_tchf_ts1[104] = {
/* dl_chan dl_bid ul_chan ul_bid */ /* dl_chan dl_bid ul_chan ul_bid */
{ L1SCHED_TCHF, 0, L1SCHED_TCHF, 0 }, { L1SCHED_TCHF, 0, L1SCHED_TCHF, 0 },
{ L1SCHED_TCHF, 1, L1SCHED_TCHF, 1 }, { L1SCHED_TCHF, 1, L1SCHED_TCHF, 1 },
@ -728,7 +728,7 @@ static const struct trx_frame frame_tchf_ts1[104] = {
{ L1SCHED_SACCHTF, 3, L1SCHED_SACCHTF, 3 }, { L1SCHED_SACCHTF, 3, L1SCHED_SACCHTF, 3 },
}; };
static const struct trx_frame frame_tchf_ts2[104] = { static const struct l1sched_tdma_frame frame_tchf_ts2[104] = {
/* dl_chan dl_bid ul_chan ul_bid */ /* dl_chan dl_bid ul_chan ul_bid */
{ L1SCHED_TCHF, 0, L1SCHED_TCHF, 0 }, { L1SCHED_TCHF, 0, L1SCHED_TCHF, 0 },
{ L1SCHED_TCHF, 1, L1SCHED_TCHF, 1 }, { L1SCHED_TCHF, 1, L1SCHED_TCHF, 1 },
@ -836,7 +836,7 @@ static const struct trx_frame frame_tchf_ts2[104] = {
{ L1SCHED_IDLE, 0, L1SCHED_IDLE, 0 }, { L1SCHED_IDLE, 0, L1SCHED_IDLE, 0 },
}; };
static const struct trx_frame frame_tchf_ts3[104] = { static const struct l1sched_tdma_frame frame_tchf_ts3[104] = {
/* dl_chan dl_bid ul_chan ul_bid */ /* dl_chan dl_bid ul_chan ul_bid */
{ L1SCHED_TCHF, 0, L1SCHED_TCHF, 0 }, { L1SCHED_TCHF, 0, L1SCHED_TCHF, 0 },
{ L1SCHED_TCHF, 1, L1SCHED_TCHF, 1 }, { L1SCHED_TCHF, 1, L1SCHED_TCHF, 1 },
@ -944,7 +944,7 @@ static const struct trx_frame frame_tchf_ts3[104] = {
{ L1SCHED_SACCHTF, 2, L1SCHED_SACCHTF, 2 }, { L1SCHED_SACCHTF, 2, L1SCHED_SACCHTF, 2 },
}; };
static const struct trx_frame frame_tchf_ts4[104] = { static const struct l1sched_tdma_frame frame_tchf_ts4[104] = {
/* dl_chan dl_bid ul_chan ul_bid */ /* dl_chan dl_bid ul_chan ul_bid */
{ L1SCHED_TCHF, 0, L1SCHED_TCHF, 0 }, { L1SCHED_TCHF, 0, L1SCHED_TCHF, 0 },
{ L1SCHED_TCHF, 1, L1SCHED_TCHF, 1 }, { L1SCHED_TCHF, 1, L1SCHED_TCHF, 1 },
@ -1052,7 +1052,7 @@ static const struct trx_frame frame_tchf_ts4[104] = {
{ L1SCHED_IDLE, 0, L1SCHED_IDLE, 0 }, { L1SCHED_IDLE, 0, L1SCHED_IDLE, 0 },
}; };
static const struct trx_frame frame_tchf_ts5[104] = { static const struct l1sched_tdma_frame frame_tchf_ts5[104] = {
/* dl_chan dl_bid ul_chan ul_bid */ /* dl_chan dl_bid ul_chan ul_bid */
{ L1SCHED_TCHF, 0, L1SCHED_TCHF, 0 }, { L1SCHED_TCHF, 0, L1SCHED_TCHF, 0 },
{ L1SCHED_TCHF, 1, L1SCHED_TCHF, 1 }, { L1SCHED_TCHF, 1, L1SCHED_TCHF, 1 },
@ -1160,7 +1160,7 @@ static const struct trx_frame frame_tchf_ts5[104] = {
{ L1SCHED_SACCHTF, 1, L1SCHED_SACCHTF, 1 }, { L1SCHED_SACCHTF, 1, L1SCHED_SACCHTF, 1 },
}; };
static const struct trx_frame frame_tchf_ts6[104] = { static const struct l1sched_tdma_frame frame_tchf_ts6[104] = {
/* dl_chan dl_bid ul_chan ul_bid */ /* dl_chan dl_bid ul_chan ul_bid */
{ L1SCHED_TCHF, 0, L1SCHED_TCHF, 0 }, { L1SCHED_TCHF, 0, L1SCHED_TCHF, 0 },
{ L1SCHED_TCHF, 1, L1SCHED_TCHF, 1 }, { L1SCHED_TCHF, 1, L1SCHED_TCHF, 1 },
@ -1268,7 +1268,7 @@ static const struct trx_frame frame_tchf_ts6[104] = {
{ L1SCHED_IDLE, 0, L1SCHED_IDLE, 0 }, { L1SCHED_IDLE, 0, L1SCHED_IDLE, 0 },
}; };
static const struct trx_frame frame_tchf_ts7[104] = { static const struct l1sched_tdma_frame frame_tchf_ts7[104] = {
/* dl_chan dl_bid ul_chan ul_bid */ /* dl_chan dl_bid ul_chan ul_bid */
{ L1SCHED_TCHF, 0, L1SCHED_TCHF, 0 }, { L1SCHED_TCHF, 0, L1SCHED_TCHF, 0 },
{ L1SCHED_TCHF, 1, L1SCHED_TCHF, 1 }, { L1SCHED_TCHF, 1, L1SCHED_TCHF, 1 },
@ -1376,7 +1376,7 @@ static const struct trx_frame frame_tchf_ts7[104] = {
{ L1SCHED_SACCHTF, 0, L1SCHED_SACCHTF, 0 }, { L1SCHED_SACCHTF, 0, L1SCHED_SACCHTF, 0 },
}; };
static const struct trx_frame frame_tchh_ts01[104] = { static const struct l1sched_tdma_frame frame_tchh_ts01[104] = {
/* dl_chan dl_bid ul_chan ul_bid */ /* dl_chan dl_bid ul_chan ul_bid */
{ L1SCHED_TCHH_0, 0, L1SCHED_TCHH_0, 0 }, { L1SCHED_TCHH_0, 0, L1SCHED_TCHH_0, 0 },
{ L1SCHED_TCHH_1, 0, L1SCHED_TCHH_1, 0 }, { L1SCHED_TCHH_1, 0, L1SCHED_TCHH_1, 0 },
@ -1484,7 +1484,7 @@ static const struct trx_frame frame_tchh_ts01[104] = {
{ L1SCHED_SACCHTH_1, 3, L1SCHED_SACCHTH_1, 3 }, { L1SCHED_SACCHTH_1, 3, L1SCHED_SACCHTH_1, 3 },
}; };
static const struct trx_frame frame_tchh_ts23[104] = { static const struct l1sched_tdma_frame frame_tchh_ts23[104] = {
/* dl_chan dl_bid ul_chan ul_bid */ /* dl_chan dl_bid ul_chan ul_bid */
{ L1SCHED_TCHH_0, 0, L1SCHED_TCHH_0, 0 }, { L1SCHED_TCHH_0, 0, L1SCHED_TCHH_0, 0 },
{ L1SCHED_TCHH_1, 0, L1SCHED_TCHH_1, 0 }, { L1SCHED_TCHH_1, 0, L1SCHED_TCHH_1, 0 },
@ -1592,7 +1592,7 @@ static const struct trx_frame frame_tchh_ts23[104] = {
{ L1SCHED_SACCHTH_1, 2, L1SCHED_SACCHTH_1, 2 }, { L1SCHED_SACCHTH_1, 2, L1SCHED_SACCHTH_1, 2 },
}; };
static const struct trx_frame frame_tchh_ts45[104] = { static const struct l1sched_tdma_frame frame_tchh_ts45[104] = {
/* dl_chan dl_bid ul_chan ul_bid */ /* dl_chan dl_bid ul_chan ul_bid */
{ L1SCHED_TCHH_0, 0, L1SCHED_TCHH_0, 0 }, { L1SCHED_TCHH_0, 0, L1SCHED_TCHH_0, 0 },
{ L1SCHED_TCHH_1, 0, L1SCHED_TCHH_1, 0 }, { L1SCHED_TCHH_1, 0, L1SCHED_TCHH_1, 0 },
@ -1700,7 +1700,7 @@ static const struct trx_frame frame_tchh_ts45[104] = {
{ L1SCHED_SACCHTH_1, 1, L1SCHED_SACCHTH_1, 1 }, { L1SCHED_SACCHTH_1, 1, L1SCHED_SACCHTH_1, 1 },
}; };
static const struct trx_frame frame_tchh_ts67[104] = { static const struct l1sched_tdma_frame frame_tchh_ts67[104] = {
/* dl_chan dl_bid ul_chan ul_bid */ /* dl_chan dl_bid ul_chan ul_bid */
{ L1SCHED_TCHH_0, 0, L1SCHED_TCHH_0, 0 }, { L1SCHED_TCHH_0, 0, L1SCHED_TCHH_0, 0 },
{ L1SCHED_TCHH_1, 0, L1SCHED_TCHH_1, 0 }, { L1SCHED_TCHH_1, 0, L1SCHED_TCHH_1, 0 },
@ -1808,7 +1808,7 @@ static const struct trx_frame frame_tchh_ts67[104] = {
{ L1SCHED_SACCHTH_1, 0, L1SCHED_SACCHTH_1, 0 }, { L1SCHED_SACCHTH_1, 0, L1SCHED_SACCHTH_1, 0 },
}; };
static const struct trx_frame frame_pdch[104] = { static const struct l1sched_tdma_frame frame_pdch[104] = {
/* dl_chan dl_bid ul_chan ul_bid */ /* dl_chan dl_bid ul_chan ul_bid */
{ L1SCHED_PDTCH, 0, L1SCHED_PDTCH, 0 }, { L1SCHED_PDTCH, 0, L1SCHED_PDTCH, 0 },
{ L1SCHED_PDTCH, 1, L1SCHED_PDTCH, 1 }, { L1SCHED_PDTCH, 1, L1SCHED_PDTCH, 1 },
@ -1969,7 +1969,7 @@ static const struct trx_frame frame_pdch[104] = {
* 102 = 2 x 51 frame multiframe * 102 = 2 x 51 frame multiframe
* 104 = 4 x 26 frame multiframe * 104 = 4 x 26 frame multiframe
*/ */
static const struct trx_multiframe layouts[] = { static const struct l1sched_tdma_multiframe layouts[] = {
{ {
GSM_PCHAN_NONE, "NONE", GSM_PCHAN_NONE, "NONE",
0, 0xff, 0, 0xff,
@ -2086,7 +2086,7 @@ static const struct trx_multiframe layouts[] = {
}, },
}; };
const struct trx_multiframe *sched_mframe_layout( const struct l1sched_tdma_multiframe *l1sched_mframe_layout(
enum gsm_phys_chan_config config, int tn) enum gsm_phys_chan_config config, int tn)
{ {
int i, ts_allowed; int i, ts_allowed;

View File

@ -45,15 +45,15 @@
* @param link_id RSL link description (used to set a proper chan) * @param link_id RSL link description (used to set a proper chan)
* @return zero in case of success, otherwise a error number * @return zero in case of success, otherwise a error number
*/ */
int sched_prim_init(void *ctx, struct trx_ts_prim **prim, int l1sched_prim_init(void *ctx, struct l1sched_ts_prim **prim,
size_t pl_len, uint8_t chan_nr, uint8_t link_id) size_t pl_len, uint8_t chan_nr, uint8_t link_id)
{ {
enum l1sched_lchan_type lchan_type; enum l1sched_lchan_type lchan_type;
struct trx_ts_prim *new_prim; struct l1sched_ts_prim *new_prim;
uint8_t len; uint8_t len;
/* Determine lchan type */ /* Determine lchan type */
lchan_type = sched_trx_chan_nr2lchan_type(chan_nr, link_id); lchan_type = l1sched_chan_nr2lchan_type(chan_nr, link_id);
if (!lchan_type) { if (!lchan_type) {
LOGP(DSCH, LOGL_ERROR, "Couldn't determine lchan type " LOGP(DSCH, LOGL_ERROR, "Couldn't determine lchan type "
"for chan_nr=%02x and link_id=%02x\n", chan_nr, link_id); "for chan_nr=%02x and link_id=%02x\n", chan_nr, link_id);
@ -61,7 +61,7 @@ int sched_prim_init(void *ctx, struct trx_ts_prim **prim,
} }
/* How much memory do we need? */ /* How much memory do we need? */
len = sizeof(struct trx_ts_prim); /* Primitive header */ len = sizeof(struct l1sched_ts_prim); /* Primitive header */
len += pl_len; /* Requested payload size */ len += pl_len; /* Requested payload size */
/* Allocate a new primitive */ /* Allocate a new primitive */
@ -90,10 +90,10 @@ int sched_prim_init(void *ctx, struct trx_ts_prim **prim,
* @param chan_nr RSL channel description * @param chan_nr RSL channel description
* @return zero in case of success, otherwise a error number * @return zero in case of success, otherwise a error number
*/ */
int sched_prim_push(struct trx_instance *trx, int l1sched_prim_push(struct trx_instance *trx,
struct trx_ts_prim *prim, uint8_t chan_nr) struct l1sched_ts_prim *prim, uint8_t chan_nr)
{ {
struct trx_ts *ts; struct l1sched_ts *ts;
uint8_t tn; uint8_t tn;
/* Determine TS index */ /* Determine TS index */
@ -125,9 +125,9 @@ int sched_prim_push(struct trx_instance *trx,
* @param lchan lchan to assign a primitive * @param lchan lchan to assign a primitive
* @return SACCH primitive to be transmitted * @return SACCH primitive to be transmitted
*/ */
static struct trx_ts_prim *prim_compose_mr(struct trx_lchan_state *lchan) static struct l1sched_ts_prim *prim_compose_mr(struct l1sched_lchan_state *lchan)
{ {
struct trx_ts_prim *prim; struct l1sched_ts_prim *prim;
uint8_t *mr_src_ptr; uint8_t *mr_src_ptr;
bool cached; bool cached;
int rc; int rc;
@ -162,8 +162,8 @@ static struct trx_ts_prim *prim_compose_mr(struct trx_lchan_state *lchan)
}; };
/* Allocate a new primitive */ /* Allocate a new primitive */
rc = sched_prim_init(lchan, &prim, GSM_MACBLOCK_LEN, rc = l1sched_prim_init(lchan, &prim, GSM_MACBLOCK_LEN,
trx_lchan_desc[lchan->type].chan_nr, TRX_CH_LID_SACCH); l1sched_lchan_desc[lchan->type].chan_nr, L1SCHED_CH_LID_SACCH);
OSMO_ASSERT(rc == 0); OSMO_ASSERT(rc == 0);
/* Check if the MR cache is populated (verify LAPDm header) */ /* Check if the MR cache is populated (verify LAPDm header) */
@ -198,12 +198,12 @@ static struct trx_ts_prim *prim_compose_mr(struct trx_lchan_state *lchan)
LOGP(DSCHD, LOGL_NOTICE, "SACCH MR cache usage count=%u > 5 " LOGP(DSCHD, LOGL_NOTICE, "SACCH MR cache usage count=%u > 5 "
"on lchan=%s => ancient measurements, please fix!\n", "on lchan=%s => ancient measurements, please fix!\n",
lchan->sacch.mr_cache_usage, lchan->sacch.mr_cache_usage,
trx_lchan_desc[lchan->type].name); l1sched_lchan_desc[lchan->type].name);
} }
LOGP(DSCHD, LOGL_NOTICE, "Using a %s Measurement Report " LOGP(DSCHD, LOGL_NOTICE, "Using a %s Measurement Report "
"on lchan=%s\n", (cached ? "cached" : "dummy"), "on lchan=%s\n", (cached ? "cached" : "dummy"),
trx_lchan_desc[lchan->type].name); l1sched_lchan_desc[lchan->type].name);
return prim; return prim;
} }
@ -234,12 +234,12 @@ static struct trx_ts_prim *prim_compose_mr(struct trx_lchan_state *lchan)
* @param lchan lchan to assign a primitive * @param lchan lchan to assign a primitive
* @return SACCH primitive to be transmitted * @return SACCH primitive to be transmitted
*/ */
static struct trx_ts_prim *prim_dequeue_sacch(struct llist_head *queue, static struct l1sched_ts_prim *prim_dequeue_sacch(struct llist_head *queue,
struct trx_lchan_state *lchan) struct l1sched_lchan_state *lchan)
{ {
struct trx_ts_prim *prim_nmr = NULL; struct l1sched_ts_prim *prim_nmr = NULL;
struct trx_ts_prim *prim_mr = NULL; struct l1sched_ts_prim *prim_mr = NULL;
struct trx_ts_prim *prim; struct l1sched_ts_prim *prim;
bool mr_now; bool mr_now;
/* Shall we transmit MR now? */ /* Shall we transmit MR now? */
@ -272,7 +272,7 @@ static struct trx_ts_prim *prim_dequeue_sacch(struct llist_head *queue,
LOGP(DSCHD, LOGL_DEBUG, "SACCH MR selection on lchan=%s: " LOGP(DSCHD, LOGL_DEBUG, "SACCH MR selection on lchan=%s: "
"mr_tx_last=%d prim_mr=%p prim_nmr=%p\n", "mr_tx_last=%d prim_mr=%p prim_nmr=%p\n",
trx_lchan_desc[lchan->type].name, l1sched_lchan_desc[lchan->type].name,
lchan->sacch.mr_tx_last, lchan->sacch.mr_tx_last,
prim_mr, prim_nmr); prim_mr, prim_nmr);
@ -299,24 +299,24 @@ static struct trx_ts_prim *prim_dequeue_sacch(struct llist_head *queue,
lchan->sacch.mr_cache_usage = 0; lchan->sacch.mr_cache_usage = 0;
LOGP(DSCHD, LOGL_DEBUG, "SACCH MR cache has been updated " LOGP(DSCHD, LOGL_DEBUG, "SACCH MR cache has been updated "
"for lchan=%s\n", trx_lchan_desc[lchan->type].name); "for lchan=%s\n", l1sched_lchan_desc[lchan->type].name);
} }
/* Update the MR transmission state */ /* Update the MR transmission state */
lchan->sacch.mr_tx_last = PRIM_IS_MR(prim); lchan->sacch.mr_tx_last = PRIM_IS_MR(prim);
LOGP(DSCHD, LOGL_DEBUG, "SACCH decision on lchan=%s: %s\n", LOGP(DSCHD, LOGL_DEBUG, "SACCH decision on lchan=%s: %s\n",
trx_lchan_desc[lchan->type].name, PRIM_IS_MR(prim) ? l1sched_lchan_desc[lchan->type].name, PRIM_IS_MR(prim) ?
"Measurement Report" : "data frame"); "Measurement Report" : "data frame");
return prim; return prim;
} }
/* Dequeues a primitive of a given channel type */ /* Dequeues a primitive of a given channel type */
static struct trx_ts_prim *prim_dequeue_one(struct llist_head *queue, static struct l1sched_ts_prim *prim_dequeue_one(struct llist_head *queue,
enum l1sched_lchan_type lchan_type) enum l1sched_lchan_type lchan_type)
{ {
struct trx_ts_prim *prim; struct l1sched_ts_prim *prim;
/** /**
* There is no need to use the 'safe' list iteration here * There is no need to use the 'safe' list iteration here
@ -337,7 +337,7 @@ static struct trx_ts_prim *prim_dequeue_one(struct llist_head *queue,
* of a given channel type (Lm or Bm). * of a given channel type (Lm or Bm).
* *
* Note: we could avoid 'lchan_type' parameter and just * Note: we could avoid 'lchan_type' parameter and just
* check the prim's channel type using CHAN_IS_TCH(), * check the prim's channel type using L1SCHED_CHAN_IS_TCH(),
* but the current approach is a bit more flexible, * but the current approach is a bit more flexible,
* and allows one to have both sub-slots of TCH/H * and allows one to have both sub-slots of TCH/H
* enabled on same timeslot e.g. for testing... * enabled on same timeslot e.g. for testing...
@ -349,10 +349,10 @@ static struct trx_ts_prim *prim_dequeue_one(struct llist_head *queue,
* @return either a FACCH, or a TCH primitive if found, * @return either a FACCH, or a TCH primitive if found,
* otherwise NULL * otherwise NULL
*/ */
static struct trx_ts_prim *prim_dequeue_tch(struct llist_head *queue, static struct l1sched_ts_prim *prim_dequeue_tch(struct llist_head *queue,
enum l1sched_lchan_type lchan_type, bool facch) enum l1sched_lchan_type lchan_type, bool facch)
{ {
struct trx_ts_prim *prim; struct l1sched_ts_prim *prim;
/** /**
* There is no need to use the 'safe' list iteration here * There is no need to use the 'safe' list iteration here
@ -363,7 +363,7 @@ static struct trx_ts_prim *prim_dequeue_tch(struct llist_head *queue,
continue; continue;
/* Either FACCH, or not FACCH */ /* Either FACCH, or not FACCH */
if (PRIM_IS_FACCH(prim) != facch) if (L1SCHED_PRIM_IS_FACCH(prim) != facch)
continue; continue;
llist_del(&prim->list); llist_del(&prim->list);
@ -382,10 +382,10 @@ static struct trx_ts_prim *prim_dequeue_tch(struct llist_head *queue,
* @return either a FACCH/F, or a TCH/F primitive, * @return either a FACCH/F, or a TCH/F primitive,
* otherwise NULL * otherwise NULL
*/ */
static struct trx_ts_prim *prim_dequeue_tch_f(struct llist_head *queue) static struct l1sched_ts_prim *prim_dequeue_tch_f(struct llist_head *queue)
{ {
struct trx_ts_prim *facch; struct l1sched_ts_prim *facch;
struct trx_ts_prim *tch; struct l1sched_ts_prim *tch;
/* Attempt to find a pair of both FACCH/F and TCH/F frames */ /* Attempt to find a pair of both FACCH/F and TCH/F frames */
facch = prim_dequeue_tch(queue, L1SCHED_TCHF, true); facch = prim_dequeue_tch(queue, L1SCHED_TCHF, true);
@ -428,15 +428,15 @@ static struct trx_ts_prim *prim_dequeue_tch_f(struct llist_head *queue)
* @return either a FACCH/H, or a TCH/H primitive, * @return either a FACCH/H, or a TCH/H primitive,
* otherwise NULL * otherwise NULL
*/ */
static struct trx_ts_prim *prim_dequeue_tch_h(struct llist_head *queue, static struct l1sched_ts_prim *prim_dequeue_tch_h(struct llist_head *queue,
uint32_t fn, enum l1sched_lchan_type lchan_type) uint32_t fn, enum l1sched_lchan_type lchan_type)
{ {
struct trx_ts_prim *facch; struct l1sched_ts_prim *facch;
struct trx_ts_prim *tch; struct l1sched_ts_prim *tch;
bool facch_now; bool facch_now;
/* May we initiate an UL FACCH/H frame transmission now? */ /* May we initiate an UL FACCH/H frame transmission now? */
facch_now = sched_tchh_facch_start(lchan_type, fn, true); facch_now = l1sched_tchh_facch_start(lchan_type, fn, true);
if (!facch_now) /* Just dequeue a TCH/H prim */ if (!facch_now) /* Just dequeue a TCH/H prim */
goto no_facch; goto no_facch;
@ -472,11 +472,11 @@ no_facch:
* @param lchan logical channel state * @param lchan logical channel state
* @return a primitive or NULL if not found * @return a primitive or NULL if not found
*/ */
struct trx_ts_prim *sched_prim_dequeue(struct llist_head *queue, struct l1sched_ts_prim *l1sched_prim_dequeue(struct llist_head *queue,
uint32_t fn, struct trx_lchan_state *lchan) uint32_t fn, struct l1sched_lchan_state *lchan)
{ {
/* SACCH is unorthodox, see 3GPP TS 04.08, section 3.4.1 */ /* SACCH is unorthodox, see 3GPP TS 04.08, section 3.4.1 */
if (CHAN_IS_SACCH(lchan->type)) if (L1SCHED_CHAN_IS_SACCH(lchan->type))
return prim_dequeue_sacch(queue, lchan); return prim_dequeue_sacch(queue, lchan);
/* There is nothing to dequeue */ /* There is nothing to dequeue */
@ -504,7 +504,7 @@ struct trx_ts_prim *sched_prim_dequeue(struct llist_head *queue,
* *
* @param lchan a logical channel to drop prim from * @param lchan a logical channel to drop prim from
*/ */
void sched_prim_drop(struct trx_lchan_state *lchan) void l1sched_prim_drop(struct l1sched_lchan_state *lchan)
{ {
/* Forget this primitive */ /* Forget this primitive */
talloc_free(lchan->prim); talloc_free(lchan->prim);
@ -519,11 +519,11 @@ void sched_prim_drop(struct trx_lchan_state *lchan)
* @param lchan lchan to assign a primitive * @param lchan lchan to assign a primitive
* @return zero in case of success, otherwise a error code * @return zero in case of success, otherwise a error code
*/ */
int sched_prim_dummy(struct trx_lchan_state *lchan) int l1sched_prim_dummy(struct l1sched_lchan_state *lchan)
{ {
enum l1sched_lchan_type chan = lchan->type; enum l1sched_lchan_type chan = lchan->type;
uint8_t tch_mode = lchan->tch_mode; uint8_t tch_mode = lchan->tch_mode;
struct trx_ts_prim *prim; struct l1sched_ts_prim *prim;
uint8_t prim_buffer[40]; uint8_t prim_buffer[40];
size_t prim_len = 0; size_t prim_len = 0;
int i; int i;
@ -541,7 +541,7 @@ int sched_prim_dummy(struct trx_lchan_state *lchan)
/* Make sure that there is no existing primitive */ /* Make sure that there is no existing primitive */
OSMO_ASSERT(lchan->prim == NULL); OSMO_ASSERT(lchan->prim == NULL);
/* Not applicable for SACCH! */ /* Not applicable for SACCH! */
OSMO_ASSERT(!CHAN_IS_SACCH(lchan->type)); OSMO_ASSERT(!L1SCHED_CHAN_IS_SACCH(lchan->type));
/** /**
* Determine what actually should be generated: * Determine what actually should be generated:
@ -549,10 +549,10 @@ int sched_prim_dummy(struct trx_lchan_state *lchan)
* TCH in other modes: silence frame; * TCH in other modes: silence frame;
* other channels: LAPDm fill frame. * other channels: LAPDm fill frame.
*/ */
if (CHAN_IS_TCH(chan) && TCH_MODE_IS_SPEECH(tch_mode)) { if (L1SCHED_CHAN_IS_TCH(chan) && L1SCHED_TCH_MODE_IS_SPEECH(tch_mode)) {
/* Bad frame indication */ /* Bad frame indication */
prim_len = sched_bad_frame_ind(prim_buffer, lchan); prim_len = l1sched_bad_frame_ind(prim_buffer, lchan);
} else if (CHAN_IS_TCH(chan) && TCH_MODE_IS_DATA(tch_mode)) { } else if (L1SCHED_CHAN_IS_TCH(chan) && L1SCHED_TCH_MODE_IS_DATA(tch_mode)) {
/* FIXME: should we do anything for CSD? */ /* FIXME: should we do anything for CSD? */
return 0; return 0;
} else { } else {
@ -577,7 +577,7 @@ int sched_prim_dummy(struct trx_lchan_state *lchan)
return 0; return 0;
/* Allocate a new primitive */ /* Allocate a new primitive */
prim = talloc_zero_size(lchan, sizeof(struct trx_ts_prim) + prim_len); prim = talloc_zero_size(lchan, sizeof(struct l1sched_ts_prim) + prim_len);
if (prim == NULL) if (prim == NULL)
return -ENOMEM; return -ENOMEM;
@ -592,7 +592,7 @@ int sched_prim_dummy(struct trx_lchan_state *lchan)
lchan->prim = prim; lchan->prim = prim;
LOGP(DSCHD, LOGL_DEBUG, "Transmitting a dummy / silence frame " LOGP(DSCHD, LOGL_DEBUG, "Transmitting a dummy / silence frame "
"on lchan=%s\n", trx_lchan_desc[chan].name); "on lchan=%s\n", l1sched_lchan_desc[chan].name);
return 0; return 0;
} }
@ -602,9 +602,9 @@ int sched_prim_dummy(struct trx_lchan_state *lchan)
* *
* @param list list of prims going to be flushed * @param list list of prims going to be flushed
*/ */
void sched_prim_flush_queue(struct llist_head *list) void l1sched_prim_flush_queue(struct llist_head *list)
{ {
struct trx_ts_prim *prim, *prim_next; struct l1sched_ts_prim *prim, *prim_next;
llist_for_each_entry_safe(prim, prim_next, list, list) { llist_for_each_entry_safe(prim, prim_next, list, list) {
llist_del(&prim->list); llist_del(&prim->list);

View File

@ -37,19 +37,19 @@
#include <osmocom/bb/trxcon/trx_if.h> #include <osmocom/bb/trxcon/trx_if.h>
#include <osmocom/bb/trxcon/logging.h> #include <osmocom/bb/trxcon/logging.h>
static void sched_trx_a5_burst_enc(struct trx_lchan_state *lchan, static void l1sched_a5_burst_enc(struct l1sched_lchan_state *lchan,
struct sched_burst_req *br); struct l1sched_burst_req *br);
static void sched_frame_clck_cb(struct trx_sched *sched) static void sched_frame_clck_cb(struct l1sched_state *sched)
{ {
struct trx_instance *trx = (struct trx_instance *) sched->data; struct trx_instance *trx = (struct trx_instance *) sched->data;
struct sched_burst_req br[TRX_TS_COUNT]; struct l1sched_burst_req br[TRX_TS_COUNT];
const struct trx_frame *frame; const struct l1sched_tdma_frame *frame;
struct trx_lchan_state *lchan; struct l1sched_lchan_state *lchan;
trx_lchan_tx_func *handler; l1sched_lchan_tx_func *handler;
enum l1sched_lchan_type chan; enum l1sched_lchan_type chan;
uint8_t offset; uint8_t offset;
struct trx_ts *ts; struct l1sched_ts *ts;
int i; int i;
/* Advance TDMA frame number in order to give the transceiver /* Advance TDMA frame number in order to give the transceiver
@ -60,7 +60,7 @@ static void sched_frame_clck_cb(struct trx_sched *sched)
/* Iterate over timeslot list */ /* Iterate over timeslot list */
for (i = 0; i < TRX_TS_COUNT; i++) { for (i = 0; i < TRX_TS_COUNT; i++) {
/* Initialize the buffer for this timeslot */ /* Initialize the buffer for this timeslot */
br[i] = (struct sched_burst_req) { br[i] = (struct l1sched_burst_req) {
.fn = fn, .fn = fn,
.tn = i, .tn = i,
.pwr = trx->tx_power, .pwr = trx->tx_power,
@ -83,14 +83,14 @@ static void sched_frame_clck_cb(struct trx_sched *sched)
/* Get required info from frame */ /* Get required info from frame */
br[i].bid = frame->ul_bid; br[i].bid = frame->ul_bid;
chan = frame->ul_chan; chan = frame->ul_chan;
handler = trx_lchan_desc[chan].tx_fn; handler = l1sched_lchan_desc[chan].tx_fn;
/* Omit lchans without handler */ /* Omit lchans without handler */
if (!handler) if (!handler)
continue; continue;
/* Make sure that lchan was allocated and activated */ /* Make sure that lchan was allocated and activated */
lchan = sched_trx_find_lchan(ts, chan); lchan = l1sched_find_lchan(ts, chan);
if (lchan == NULL) if (lchan == NULL)
continue; continue;
@ -103,19 +103,19 @@ static void sched_frame_clck_cb(struct trx_sched *sched)
* attempt to obtain a new one from queue * attempt to obtain a new one from queue
*/ */
if (lchan->prim == NULL) if (lchan->prim == NULL)
lchan->prim = sched_prim_dequeue(&ts->tx_prims, fn, lchan); lchan->prim = l1sched_prim_dequeue(&ts->tx_prims, fn, lchan);
/* TODO: report TX buffers health to the higher layers */ /* TODO: report TX buffers health to the higher layers */
/* If CBTX (Continuous Burst Transmission) is assumed */ /* If CBTX (Continuous Burst Transmission) is assumed */
if (trx_lchan_desc[chan].flags & TRX_CH_FLAG_CBTX) { if (l1sched_lchan_desc[chan].flags & L1SCHED_CH_FLAG_CBTX) {
/** /**
* Probably, a TX buffer is empty. Nevertheless, * Probably, a TX buffer is empty. Nevertheless,
* we shall continuously transmit anything on * we shall continuously transmit anything on
* CBTX channels. * CBTX channels.
*/ */
if (lchan->prim == NULL) if (lchan->prim == NULL)
sched_prim_dummy(lchan); l1sched_prim_dummy(lchan);
} }
/* If there is no primitive, do nothing */ /* If there is no primitive, do nothing */
@ -124,15 +124,15 @@ static void sched_frame_clck_cb(struct trx_sched *sched)
/* Handover RACH needs to be handled regardless of the /* Handover RACH needs to be handled regardless of the
* current channel type and the associated handler. */ * current channel type and the associated handler. */
if (PRIM_IS_RACH(lchan->prim) && lchan->prim->chan != L1SCHED_RACH) if (L1SCHED_PRIM_IS_RACH(lchan->prim) && lchan->prim->chan != L1SCHED_RACH)
handler = trx_lchan_desc[L1SCHED_RACH].tx_fn; handler = l1sched_lchan_desc[L1SCHED_RACH].tx_fn;
/* Poke lchan handler */ /* Poke lchan handler */
handler(trx, ts, lchan, &br[i]); handler(trx, ts, lchan, &br[i]);
/* Perform A5/X burst encryption if required */ /* Perform A5/X burst encryption if required */
if (lchan->a5.algo) if (lchan->a5.algo)
sched_trx_a5_burst_enc(lchan, &br[i]); l1sched_a5_burst_enc(lchan, &br[i]);
} }
/* Send all bursts for this TDMA frame */ /* Send all bursts for this TDMA frame */
@ -140,9 +140,9 @@ static void sched_frame_clck_cb(struct trx_sched *sched)
trx_if_tx_burst(trx, &br[i]); trx_if_tx_burst(trx, &br[i]);
} }
int sched_trx_init(struct trx_instance *trx, uint32_t fn_advance) int l1sched_init(struct trx_instance *trx, uint32_t fn_advance)
{ {
struct trx_sched *sched; struct l1sched_state *sched;
if (!trx) if (!trx)
return -EINVAL; return -EINVAL;
@ -165,7 +165,7 @@ int sched_trx_init(struct trx_instance *trx, uint32_t fn_advance)
return 0; return 0;
} }
int sched_trx_shutdown(struct trx_instance *trx) int l1sched_shutdown(struct trx_instance *trx)
{ {
int i; int i;
@ -176,12 +176,12 @@ int sched_trx_shutdown(struct trx_instance *trx)
/* Free all potentially allocated timeslots */ /* Free all potentially allocated timeslots */
for (i = 0; i < TRX_TS_COUNT; i++) for (i = 0; i < TRX_TS_COUNT; i++)
sched_trx_del_ts(trx, i); l1sched_del_ts(trx, i);
return 0; return 0;
} }
int sched_trx_reset(struct trx_instance *trx, bool reset_clock) int l1sched_reset(struct trx_instance *trx, bool reset_clock)
{ {
int i; int i;
@ -193,16 +193,16 @@ int sched_trx_reset(struct trx_instance *trx, bool reset_clock)
/* Free all potentially allocated timeslots */ /* Free all potentially allocated timeslots */
for (i = 0; i < TRX_TS_COUNT; i++) for (i = 0; i < TRX_TS_COUNT; i++)
sched_trx_del_ts(trx, i); l1sched_del_ts(trx, i);
/* Stop and reset clock counter if required */ /* Stop and reset clock counter if required */
if (reset_clock) if (reset_clock)
sched_clck_reset(&trx->sched); l1sched_clck_reset(&trx->sched);
return 0; return 0;
} }
struct trx_ts *sched_trx_add_ts(struct trx_instance *trx, int tn) struct l1sched_ts *l1sched_add_ts(struct trx_instance *trx, int tn)
{ {
/* Make sure that ts isn't allocated yet */ /* Make sure that ts isn't allocated yet */
if (trx->ts_list[tn] != NULL) { if (trx->ts_list[tn] != NULL) {
@ -213,7 +213,7 @@ struct trx_ts *sched_trx_add_ts(struct trx_instance *trx, int tn)
LOGP(DSCH, LOGL_NOTICE, "Add a new TDMA timeslot #%u\n", tn); LOGP(DSCH, LOGL_NOTICE, "Add a new TDMA timeslot #%u\n", tn);
/* Allocate a new one */ /* Allocate a new one */
trx->ts_list[tn] = talloc_zero(trx, struct trx_ts); trx->ts_list[tn] = talloc_zero(trx, struct l1sched_ts);
/* Add backpointer */ /* Add backpointer */
trx->ts_list[tn]->trx = trx; trx->ts_list[tn]->trx = trx;
@ -224,10 +224,10 @@ struct trx_ts *sched_trx_add_ts(struct trx_instance *trx, int tn)
return trx->ts_list[tn]; return trx->ts_list[tn];
} }
void sched_trx_del_ts(struct trx_instance *trx, int tn) void l1sched_del_ts(struct trx_instance *trx, int tn)
{ {
struct trx_lchan_state *lchan, *lchan_next; struct l1sched_lchan_state *lchan, *lchan_next;
struct trx_ts *ts; struct l1sched_ts *ts;
/* Find ts in list */ /* Find ts in list */
ts = trx->ts_list[tn]; ts = trx->ts_list[tn];
@ -237,7 +237,7 @@ void sched_trx_del_ts(struct trx_instance *trx, int tn)
LOGP(DSCH, LOGL_NOTICE, "Delete TDMA timeslot #%u\n", tn); LOGP(DSCH, LOGL_NOTICE, "Delete TDMA timeslot #%u\n", tn);
/* Deactivate all logical channels */ /* Deactivate all logical channels */
sched_trx_deactivate_all_lchans(ts); l1sched_deactivate_all_lchans(ts);
/* Free channel states */ /* Free channel states */
llist_for_each_entry_safe(lchan, lchan_next, &ts->lchans, list) { llist_for_each_entry_safe(lchan, lchan_next, &ts->lchans, list) {
@ -246,7 +246,7 @@ void sched_trx_del_ts(struct trx_instance *trx, int tn)
} }
/* Flush queue primitives for TX */ /* Flush queue primitives for TX */
sched_prim_flush_queue(&ts->tx_prims); l1sched_prim_flush_queue(&ts->tx_prims);
/* Remove ts from list and free memory */ /* Remove ts from list and free memory */
trx->ts_list[tn] = NULL; trx->ts_list[tn] = NULL;
@ -259,27 +259,27 @@ void sched_trx_del_ts(struct trx_instance *trx, int tn)
#define LAYOUT_HAS_LCHAN(layout, lchan) \ #define LAYOUT_HAS_LCHAN(layout, lchan) \
(layout->lchan_mask & ((uint64_t) 0x01 << lchan)) (layout->lchan_mask & ((uint64_t) 0x01 << lchan))
int sched_trx_configure_ts(struct trx_instance *trx, int tn, int l1sched_configure_ts(struct trx_instance *trx, int tn,
enum gsm_phys_chan_config config) enum gsm_phys_chan_config config)
{ {
struct trx_lchan_state *lchan; struct l1sched_lchan_state *lchan;
enum l1sched_lchan_type type; enum l1sched_lchan_type type;
struct trx_ts *ts; struct l1sched_ts *ts;
/* Try to find specified ts */ /* Try to find specified ts */
ts = trx->ts_list[tn]; ts = trx->ts_list[tn];
if (ts != NULL) { if (ts != NULL) {
/* Reconfiguration of existing one */ /* Reconfiguration of existing one */
sched_trx_reset_ts(trx, tn); l1sched_reset_ts(trx, tn);
} else { } else {
/* Allocate a new one if doesn't exist */ /* Allocate a new one if doesn't exist */
ts = sched_trx_add_ts(trx, tn); ts = l1sched_add_ts(trx, tn);
if (ts == NULL) if (ts == NULL)
return -ENOMEM; return -ENOMEM;
} }
/* Choose proper multiframe layout */ /* Choose proper multiframe layout */
ts->mf_layout = sched_mframe_layout(config, tn); ts->mf_layout = l1sched_mframe_layout(config, tn);
if (!ts->mf_layout) if (!ts->mf_layout)
return -EINVAL; return -EINVAL;
if (ts->mf_layout->chan_config != config) if (ts->mf_layout->chan_config != config)
@ -299,7 +299,7 @@ int sched_trx_configure_ts(struct trx_instance *trx, int tn,
continue; continue;
/* Allocate a channel state */ /* Allocate a channel state */
lchan = talloc_zero(ts, struct trx_lchan_state); lchan = talloc_zero(ts, struct l1sched_lchan_state);
if (!lchan) if (!lchan)
return -ENOMEM; return -ENOMEM;
@ -313,8 +313,8 @@ int sched_trx_configure_ts(struct trx_instance *trx, int tn,
llist_add_tail(&lchan->list, &ts->lchans); llist_add_tail(&lchan->list, &ts->lchans);
/* Enable channel automatically if required */ /* Enable channel automatically if required */
if (trx_lchan_desc[type].flags & TRX_CH_FLAG_AUTO) if (l1sched_lchan_desc[type].flags & L1SCHED_CH_FLAG_AUTO)
sched_trx_activate_lchan(ts, type); l1sched_activate_lchan(ts, type);
} }
/* Notify transceiver about TS activation */ /* Notify transceiver about TS activation */
@ -324,10 +324,10 @@ int sched_trx_configure_ts(struct trx_instance *trx, int tn,
return 0; return 0;
} }
int sched_trx_reset_ts(struct trx_instance *trx, int tn) int l1sched_reset_ts(struct trx_instance *trx, int tn)
{ {
struct trx_lchan_state *lchan, *lchan_next; struct l1sched_lchan_state *lchan, *lchan_next;
struct trx_ts *ts; struct l1sched_ts *ts;
/* Try to find specified ts */ /* Try to find specified ts */
ts = trx->ts_list[tn]; ts = trx->ts_list[tn];
@ -338,10 +338,10 @@ int sched_trx_reset_ts(struct trx_instance *trx, int tn)
ts->mf_layout = NULL; ts->mf_layout = NULL;
/* Flush queue primitives for TX */ /* Flush queue primitives for TX */
sched_prim_flush_queue(&ts->tx_prims); l1sched_prim_flush_queue(&ts->tx_prims);
/* Deactivate all logical channels */ /* Deactivate all logical channels */
sched_trx_deactivate_all_lchans(ts); l1sched_deactivate_all_lchans(ts);
/* Free channel states */ /* Free channel states */
llist_for_each_entry_safe(lchan, lchan_next, &ts->lchans, list) { llist_for_each_entry_safe(lchan, lchan_next, &ts->lchans, list) {
@ -355,10 +355,10 @@ int sched_trx_reset_ts(struct trx_instance *trx, int tn)
return 0; return 0;
} }
int sched_trx_start_ciphering(struct trx_ts *ts, uint8_t algo, int l1sched_start_ciphering(struct l1sched_ts *ts, uint8_t algo,
uint8_t *key, uint8_t key_len) uint8_t *key, uint8_t key_len)
{ {
struct trx_lchan_state *lchan; struct l1sched_lchan_state *lchan;
/* Prevent NULL-pointer deference */ /* Prevent NULL-pointer deference */
if (!ts) if (!ts)
@ -386,10 +386,10 @@ int sched_trx_start_ciphering(struct trx_ts *ts, uint8_t algo,
return 0; return 0;
} }
struct trx_lchan_state *sched_trx_find_lchan(struct trx_ts *ts, struct l1sched_lchan_state *l1sched_find_lchan(struct l1sched_ts *ts,
enum l1sched_lchan_type chan) enum l1sched_lchan_type chan)
{ {
struct trx_lchan_state *lchan; struct l1sched_lchan_state *lchan;
llist_for_each_entry(lchan, &ts->lchans, list) llist_for_each_entry(lchan, &ts->lchans, list)
if (lchan->type == chan) if (lchan->type == chan)
@ -398,10 +398,10 @@ struct trx_lchan_state *sched_trx_find_lchan(struct trx_ts *ts,
return NULL; return NULL;
} }
int sched_trx_set_lchans(struct trx_ts *ts, uint8_t chan_nr, int active, uint8_t tch_mode) int l1sched_set_lchans(struct l1sched_ts *ts, uint8_t chan_nr, int active, uint8_t tch_mode)
{ {
const struct trx_lchan_desc *lchan_desc; const struct l1sched_lchan_desc *lchan_desc;
struct trx_lchan_state *lchan; struct l1sched_lchan_state *lchan;
int rc = 0; int rc = 0;
/* Prevent NULL-pointer deference */ /* Prevent NULL-pointer deference */
@ -412,38 +412,38 @@ int sched_trx_set_lchans(struct trx_ts *ts, uint8_t chan_nr, int active, uint8_t
/* Iterate over all allocated lchans */ /* Iterate over all allocated lchans */
llist_for_each_entry(lchan, &ts->lchans, list) { llist_for_each_entry(lchan, &ts->lchans, list) {
lchan_desc = &trx_lchan_desc[lchan->type]; lchan_desc = &l1sched_lchan_desc[lchan->type];
if (lchan_desc->chan_nr == (chan_nr & 0xf8)) { if (lchan_desc->chan_nr == (chan_nr & 0xf8)) {
if (active) { if (active) {
rc |= sched_trx_activate_lchan(ts, lchan->type); rc |= l1sched_activate_lchan(ts, lchan->type);
lchan->tch_mode = tch_mode; lchan->tch_mode = tch_mode;
} else } else
rc |= sched_trx_deactivate_lchan(ts, lchan->type); rc |= l1sched_deactivate_lchan(ts, lchan->type);
} }
} }
return rc; return rc;
} }
int sched_trx_activate_lchan(struct trx_ts *ts, enum l1sched_lchan_type chan) int l1sched_activate_lchan(struct l1sched_ts *ts, enum l1sched_lchan_type chan)
{ {
const struct trx_lchan_desc *lchan_desc = &trx_lchan_desc[chan]; const struct l1sched_lchan_desc *lchan_desc = &l1sched_lchan_desc[chan];
struct trx_lchan_state *lchan; struct l1sched_lchan_state *lchan;
/* Try to find requested logical channel */ /* Try to find requested logical channel */
lchan = sched_trx_find_lchan(ts, chan); lchan = l1sched_find_lchan(ts, chan);
if (lchan == NULL) if (lchan == NULL)
return -EINVAL; return -EINVAL;
if (lchan->active) { if (lchan->active) {
LOGP(DSCH, LOGL_ERROR, "Logical channel %s already activated " LOGP(DSCH, LOGL_ERROR, "Logical channel %s already activated "
"on ts=%d\n", trx_lchan_desc[chan].name, ts->index); "on ts=%d\n", l1sched_lchan_desc[chan].name, ts->index);
return -EINVAL; return -EINVAL;
} }
LOGP(DSCH, LOGL_NOTICE, "Activating lchan=%s " LOGP(DSCH, LOGL_NOTICE, "Activating lchan=%s "
"on ts=%d\n", trx_lchan_desc[chan].name, ts->index); "on ts=%d\n", l1sched_lchan_desc[chan].name, ts->index);
/* Conditionally allocate memory for bursts */ /* Conditionally allocate memory for bursts */
if (lchan_desc->rx_fn && lchan_desc->burst_buf_size > 0) { if (lchan_desc->rx_fn && lchan_desc->burst_buf_size > 0) {
@ -466,17 +466,17 @@ int sched_trx_activate_lchan(struct trx_ts *ts, enum l1sched_lchan_type chan)
return 0; return 0;
} }
static void sched_trx_reset_lchan(struct trx_lchan_state *lchan) static void l1sched_reset_lchan(struct l1sched_lchan_state *lchan)
{ {
/* Prevent NULL-pointer deference */ /* Prevent NULL-pointer deference */
OSMO_ASSERT(lchan != NULL); OSMO_ASSERT(lchan != NULL);
/* Print some TDMA statistics for Downlink */ /* Print some TDMA statistics for Downlink */
if (trx_lchan_desc[lchan->type].rx_fn && lchan->active) { if (l1sched_lchan_desc[lchan->type].rx_fn && lchan->active) {
LOGP(DSCH, LOGL_DEBUG, "TDMA statistics for lchan=%s on ts=%u: " LOGP(DSCH, LOGL_DEBUG, "TDMA statistics for lchan=%s on ts=%u: "
"%lu DL frames have been processed, " "%lu DL frames have been processed, "
"%lu lost (compensated), last fn=%u\n", "%lu lost (compensated), last fn=%u\n",
trx_lchan_desc[lchan->type].name, lchan->ts->index, l1sched_lchan_desc[lchan->type].name, lchan->ts->index,
lchan->tdma.num_proc, lchan->tdma.num_lost, lchan->tdma.num_proc, lchan->tdma.num_lost,
lchan->tdma.last_proc); lchan->tdma.last_proc);
} }
@ -493,10 +493,10 @@ static void sched_trx_reset_lchan(struct trx_lchan_state *lchan)
lchan->tx_bursts = NULL; lchan->tx_bursts = NULL;
/* Forget the current prim */ /* Forget the current prim */
sched_prim_drop(lchan); l1sched_prim_drop(lchan);
/* Channel specific stuff */ /* Channel specific stuff */
if (CHAN_IS_TCH(lchan->type)) { if (L1SCHED_CHAN_IS_TCH(lchan->type)) {
lchan->dl_ongoing_facch = 0; lchan->dl_ongoing_facch = 0;
lchan->ul_facch_blocks = 0; lchan->ul_facch_blocks = 0;
@ -504,7 +504,7 @@ static void sched_trx_reset_lchan(struct trx_lchan_state *lchan)
/* Reset AMR state */ /* Reset AMR state */
memset(&lchan->amr, 0x00, sizeof(lchan->amr)); memset(&lchan->amr, 0x00, sizeof(lchan->amr));
} else if (CHAN_IS_SACCH(lchan->type)) { } else if (L1SCHED_CHAN_IS_SACCH(lchan->type)) {
/* Reset SACCH state */ /* Reset SACCH state */
memset(&lchan->sacch, 0x00, sizeof(lchan->sacch)); memset(&lchan->sacch, 0x00, sizeof(lchan->sacch));
} }
@ -516,26 +516,26 @@ static void sched_trx_reset_lchan(struct trx_lchan_state *lchan)
memset(&lchan->tdma, 0x00, sizeof(lchan->tdma)); memset(&lchan->tdma, 0x00, sizeof(lchan->tdma));
} }
int sched_trx_deactivate_lchan(struct trx_ts *ts, enum l1sched_lchan_type chan) int l1sched_deactivate_lchan(struct l1sched_ts *ts, enum l1sched_lchan_type chan)
{ {
struct trx_lchan_state *lchan; struct l1sched_lchan_state *lchan;
/* Try to find requested logical channel */ /* Try to find requested logical channel */
lchan = sched_trx_find_lchan(ts, chan); lchan = l1sched_find_lchan(ts, chan);
if (lchan == NULL) if (lchan == NULL)
return -EINVAL; return -EINVAL;
if (!lchan->active) { if (!lchan->active) {
LOGP(DSCH, LOGL_ERROR, "Logical channel %s already deactivated " LOGP(DSCH, LOGL_ERROR, "Logical channel %s already deactivated "
"on ts=%d\n", trx_lchan_desc[chan].name, ts->index); "on ts=%d\n", l1sched_lchan_desc[chan].name, ts->index);
return -EINVAL; return -EINVAL;
} }
LOGP(DSCH, LOGL_DEBUG, "Deactivating lchan=%s " LOGP(DSCH, LOGL_DEBUG, "Deactivating lchan=%s "
"on ts=%d\n", trx_lchan_desc[chan].name, ts->index); "on ts=%d\n", l1sched_lchan_desc[chan].name, ts->index);
/* Reset internal state, free memory */ /* Reset internal state, free memory */
sched_trx_reset_lchan(lchan); l1sched_reset_lchan(lchan);
/* Update activation flag */ /* Update activation flag */
lchan->active = 0; lchan->active = 0;
@ -543,9 +543,9 @@ int sched_trx_deactivate_lchan(struct trx_ts *ts, enum l1sched_lchan_type chan)
return 0; return 0;
} }
void sched_trx_deactivate_all_lchans(struct trx_ts *ts) void l1sched_deactivate_all_lchans(struct l1sched_ts *ts)
{ {
struct trx_lchan_state *lchan; struct l1sched_lchan_state *lchan;
LOGP(DSCH, LOGL_DEBUG, "Deactivating all logical channels " LOGP(DSCH, LOGL_DEBUG, "Deactivating all logical channels "
"on ts=%d\n", ts->index); "on ts=%d\n", ts->index);
@ -556,14 +556,14 @@ void sched_trx_deactivate_all_lchans(struct trx_ts *ts)
continue; continue;
/* Reset internal state, free memory */ /* Reset internal state, free memory */
sched_trx_reset_lchan(lchan); l1sched_reset_lchan(lchan);
/* Update activation flag */ /* Update activation flag */
lchan->active = 0; lchan->active = 0;
} }
} }
enum gsm_phys_chan_config sched_trx_chan_nr2pchan_config(uint8_t chan_nr) enum gsm_phys_chan_config l1sched_chan_nr2pchan_config(uint8_t chan_nr)
{ {
uint8_t cbits = chan_nr >> 3; uint8_t cbits = chan_nr >> 3;
@ -585,21 +585,21 @@ enum gsm_phys_chan_config sched_trx_chan_nr2pchan_config(uint8_t chan_nr)
return GSM_PCHAN_NONE; return GSM_PCHAN_NONE;
} }
enum l1sched_lchan_type sched_trx_chan_nr2lchan_type(uint8_t chan_nr, enum l1sched_lchan_type l1sched_chan_nr2lchan_type(uint8_t chan_nr,
uint8_t link_id) uint8_t link_id)
{ {
int i; int i;
/* Iterate over all known lchan types */ /* Iterate over all known lchan types */
for (i = 0; i < _L1SCHED_CHAN_MAX; i++) for (i = 0; i < _L1SCHED_CHAN_MAX; i++)
if (trx_lchan_desc[i].chan_nr == (chan_nr & 0xf8)) if (l1sched_lchan_desc[i].chan_nr == (chan_nr & 0xf8))
if (trx_lchan_desc[i].link_id == link_id) if (l1sched_lchan_desc[i].link_id == link_id)
return i; return i;
return L1SCHED_IDLE; return L1SCHED_IDLE;
} }
static void sched_trx_a5_burst_dec(struct trx_lchan_state *lchan, static void l1sched_a5_burst_dec(struct l1sched_lchan_state *lchan,
uint32_t fn, sbit_t *burst) uint32_t fn, sbit_t *burst)
{ {
ubit_t ks[114]; ubit_t ks[114];
@ -617,8 +617,8 @@ static void sched_trx_a5_burst_dec(struct trx_lchan_state *lchan,
} }
} }
static void sched_trx_a5_burst_enc(struct trx_lchan_state *lchan, static void l1sched_a5_burst_enc(struct l1sched_lchan_state *lchan,
struct sched_burst_req *br) struct l1sched_burst_req *br)
{ {
ubit_t ks[114]; ubit_t ks[114];
int i; int i;
@ -633,12 +633,12 @@ static void sched_trx_a5_burst_enc(struct trx_lchan_state *lchan,
} }
} }
static int subst_frame_loss(struct trx_lchan_state *lchan, static int subst_frame_loss(struct l1sched_lchan_state *lchan,
trx_lchan_rx_func *handler, l1sched_lchan_rx_func *handler,
uint32_t fn) uint32_t fn)
{ {
const struct trx_multiframe *mf; const struct l1sched_tdma_multiframe *mf;
const struct trx_frame *fp; const struct l1sched_tdma_frame *fp;
int elapsed, i; int elapsed, i;
/* Wait until at least one TDMA frame is processed */ /* Wait until at least one TDMA frame is processed */
@ -662,7 +662,7 @@ static int subst_frame_loss(struct trx_lchan_state *lchan,
* so better drop it. Otherwise we risk to get undefined behavior in handler(). */ * so better drop it. Otherwise we risk to get undefined behavior in handler(). */
LOGP(DSCHD, LOGL_ERROR, "(%s) Rx burst with fn=%u older than the last " LOGP(DSCHD, LOGL_ERROR, "(%s) Rx burst with fn=%u older than the last "
"processed fn=%u (see OS#4658) => dropping\n", "processed fn=%u (see OS#4658) => dropping\n",
trx_lchan_desc[lchan->type].name, l1sched_lchan_desc[lchan->type].name,
fn, lchan->tdma.last_proc); fn, lchan->tdma.last_proc);
return -EALREADY; return -EALREADY;
} }
@ -680,7 +680,7 @@ static int subst_frame_loss(struct trx_lchan_state *lchan,
} }
static const sbit_t bits[148] = { 0 }; static const sbit_t bits[148] = { 0 };
struct trx_meas_set fake_meas = { struct l1sched_meas_set fake_meas = {
.fn = lchan->tdma.last_proc, .fn = lchan->tdma.last_proc,
.rssi = -120, .rssi = -120,
.toa256 = 0, .toa256 = 0,
@ -693,7 +693,7 @@ static int subst_frame_loss(struct trx_lchan_state *lchan,
continue; continue;
LOGP(DSCHD, LOGL_NOTICE, "Substituting lost TDMA frame %u on %s\n", LOGP(DSCHD, LOGL_NOTICE, "Substituting lost TDMA frame %u on %s\n",
fake_meas.fn, trx_lchan_desc[lchan->type].name); fake_meas.fn, l1sched_lchan_desc[lchan->type].name);
handler(lchan->ts->trx, lchan->ts, lchan, handler(lchan->ts->trx, lchan->ts, lchan,
fake_meas.fn, fp->dl_bid, fake_meas.fn, fp->dl_bid,
@ -708,15 +708,15 @@ static int subst_frame_loss(struct trx_lchan_state *lchan,
return 0; return 0;
} }
int sched_trx_handle_rx_burst(struct trx_instance *trx, uint8_t tn, int l1sched_handle_rx_burst(struct trx_instance *trx, uint8_t tn,
uint32_t fn, sbit_t *bits, uint16_t nbits, uint32_t fn, sbit_t *bits, uint16_t nbits,
const struct trx_meas_set *meas) const struct l1sched_meas_set *meas)
{ {
struct trx_lchan_state *lchan; struct l1sched_lchan_state *lchan;
const struct trx_frame *frame; const struct l1sched_tdma_frame *frame;
struct trx_ts *ts; struct l1sched_ts *ts;
trx_lchan_rx_func *handler; l1sched_lchan_rx_func *handler;
enum l1sched_lchan_type chan; enum l1sched_lchan_type chan;
uint8_t offset, bid; uint8_t offset, bid;
int rc; int rc;
@ -736,7 +736,7 @@ int sched_trx_handle_rx_burst(struct trx_instance *trx, uint8_t tn,
/* Get required info from frame */ /* Get required info from frame */
bid = frame->dl_bid; bid = frame->dl_bid;
chan = frame->dl_chan; chan = frame->dl_chan;
handler = trx_lchan_desc[chan].rx_fn; handler = l1sched_lchan_desc[chan].rx_fn;
/* Omit bursts which have no handler, like IDLE bursts. /* Omit bursts which have no handler, like IDLE bursts.
* TODO: handle noise indications during IDLE frames. */ * TODO: handle noise indications during IDLE frames. */
@ -744,7 +744,7 @@ int sched_trx_handle_rx_burst(struct trx_instance *trx, uint8_t tn,
return -ENODEV; return -ENODEV;
/* Find required channel state */ /* Find required channel state */
lchan = sched_trx_find_lchan(ts, chan); lchan = l1sched_find_lchan(ts, chan);
if (lchan == NULL) if (lchan == NULL)
return -ENODEV; return -ENODEV;
@ -759,7 +759,7 @@ int sched_trx_handle_rx_burst(struct trx_instance *trx, uint8_t tn,
/* Perform A5/X decryption if required */ /* Perform A5/X decryption if required */
if (lchan->a5.algo) if (lchan->a5.algo)
sched_trx_a5_burst_dec(lchan, fn, bits); l1sched_a5_burst_dec(lchan, fn, bits);
/* Put burst to handler */ /* Put burst to handler */
handler(trx, ts, lchan, fn, bid, bits, meas); handler(trx, ts, lchan, fn, bid, bits, meas);
@ -786,9 +786,9 @@ int sched_trx_handle_rx_burst(struct trx_instance *trx, uint8_t tn,
(MEAS_HIST_FIRST(hist) + ARRAY_SIZE(hist->buf) - 1) (MEAS_HIST_FIRST(hist) + ARRAY_SIZE(hist->buf) - 1)
/* Add a new set of measurements to the history */ /* Add a new set of measurements to the history */
void sched_trx_meas_push(struct trx_lchan_state *lchan, const struct trx_meas_set *meas) void l1sched_lchan_meas_push(struct l1sched_lchan_state *lchan, const struct l1sched_meas_set *meas)
{ {
struct trx_lchan_meas_hist *hist = &lchan->meas_hist; struct l1sched_lchan_meas_hist *hist = &lchan->meas_hist;
/* Find a new position where to store the measurements */ /* Find a new position where to store the measurements */
if (hist->head == MEAS_HIST_LAST(hist) || hist->head == NULL) if (hist->head == MEAS_HIST_LAST(hist) || hist->head == NULL)
@ -800,10 +800,10 @@ void sched_trx_meas_push(struct trx_lchan_state *lchan, const struct trx_meas_se
} }
/* Calculate the AVG of n measurements from the history */ /* Calculate the AVG of n measurements from the history */
void sched_trx_meas_avg(struct trx_lchan_state *lchan, unsigned int n) void l1sched_lchan_meas_avg(struct l1sched_lchan_state *lchan, unsigned int n)
{ {
struct trx_lchan_meas_hist *hist = &lchan->meas_hist; struct l1sched_lchan_meas_hist *hist = &lchan->meas_hist;
struct trx_meas_set *meas = hist->head; struct l1sched_meas_set *meas = hist->head;
int toa256_sum = 0; int toa256_sum = 0;
int rssi_sum = 0; int rssi_sum = 0;
int i; int i;

View File

@ -571,7 +571,7 @@ rsp_error:
static int trx_data_rx_cb(struct osmo_fd *ofd, unsigned int what) static int trx_data_rx_cb(struct osmo_fd *ofd, unsigned int what)
{ {
struct trx_instance *trx = ofd->data; struct trx_instance *trx = ofd->data;
struct trx_meas_set meas; struct l1sched_meas_set meas;
uint8_t buf[TRXD_BUF_SIZE]; uint8_t buf[TRXD_BUF_SIZE];
sbit_t bits[148]; sbit_t bits[148];
int8_t rssi, tn; int8_t rssi, tn;
@ -613,24 +613,24 @@ static int trx_data_rx_cb(struct osmo_fd *ofd, unsigned int what)
tn, fn, rssi, toa256); tn, fn, rssi, toa256);
/* Group the measurements together */ /* Group the measurements together */
meas = (struct trx_meas_set) { meas = (struct l1sched_meas_set) {
.toa256 = toa256, .toa256 = toa256,
.rssi = rssi, .rssi = rssi,
.fn = fn, .fn = fn,
}; };
/* Poke scheduler */ /* Poke scheduler */
sched_trx_handle_rx_burst(trx, tn, fn, bits, 148, &meas); l1sched_handle_rx_burst(trx, tn, fn, bits, 148, &meas);
/* Correct local clock counter */ /* Correct local clock counter */
if (fn % 51 == 0) if (fn % 51 == 0)
sched_clck_handle(&trx->sched, fn); l1sched_clck_handle(&trx->sched, fn);
return 0; return 0;
} }
int trx_if_tx_burst(struct trx_instance *trx, int trx_if_tx_burst(struct trx_instance *trx,
const struct sched_burst_req *br) const struct l1sched_burst_req *br)
{ {
uint8_t buf[TRXD_BUF_SIZE]; uint8_t buf[TRXD_BUF_SIZE];
size_t length; size_t length;

View File

@ -93,7 +93,7 @@ static void trxcon_fsm_managed_action(struct osmo_fsm_inst *fi,
if (app_data.trx->fsm->state != TRX_STATE_OFFLINE) { if (app_data.trx->fsm->state != TRX_STATE_OFFLINE) {
/* Reset scheduler and clock counter */ /* Reset scheduler and clock counter */
sched_trx_reset(app_data.trx, true); l1sched_reset(app_data.trx, true);
/* TODO: implement trx_if_reset() */ /* TODO: implement trx_if_reset() */
trx_if_cmd_poweroff(app_data.trx); trx_if_cmd_poweroff(app_data.trx);
@ -330,7 +330,7 @@ int main(int argc, char **argv)
app_data.trx->l1l = app_data.l1l; app_data.trx->l1l = app_data.l1l;
/* Init scheduler */ /* Init scheduler */
rc = sched_trx_init(app_data.trx, app_data.trx_fn_advance); rc = l1sched_init(app_data.trx, app_data.trx_fn_advance);
if (rc) if (rc)
goto exit; goto exit;
@ -353,7 +353,7 @@ int main(int argc, char **argv)
exit: exit:
/* Close active connections */ /* Close active connections */
l1ctl_link_shutdown(app_data.l1l); l1ctl_link_shutdown(app_data.l1l);
sched_trx_shutdown(app_data.trx); l1sched_shutdown(app_data.trx);
trx_if_close(app_data.trx); trx_if_close(app_data.trx);
/* Shutdown main state machine */ /* Shutdown main state machine */