fw/l1a: Add a message to safely count the length of a txqueue
[osmocom-bb.git] / include / l1ctl_proto.h
index af24c6d..9adadfd 100644 (file)
 #ifndef __L1CTL_PROTO_H__
 #define __L1CTL_PROTO_H__
 
-#define L1CTL_FBSB_REQ         1
-#define L1CTL_FBSB_CONF                2
-#define L1CTL_DATA_IND         3
-#define L1CTL_RACH_REQ         4
-#define L1CTL_DM_EST_REQ       5
-#define L1CTL_DATA_REQ         7
-#define L1CTL_RESET_IND                8
-#define L1CTL_PM_REQ           9       /* power measurement */
-#define L1CTL_PM_CONF          10      /* power measurement */
-#define L1CTL_ECHO_REQ         11
-#define L1CTL_ECHO_CONF                12
-#define L1CTL_RACH_CONF                13
-#define L1CTL_RESET_REQ                14
-#define L1CTL_RESET_CONF       15
-#define L1CTL_DATA_CONF                16
-#define L1CTL_CCCH_MODE_REQ    17
-#define L1CTL_CCCH_MODE_CONF   18
-#define L1CTL_DM_REL_REQ       19
-#define L1CTL_PARAM_REQ                20
+enum {
+       _L1CTL_NONE             = 0,
+       L1CTL_FBSB_REQ,
+       L1CTL_FBSB_CONF,
+       L1CTL_DATA_IND,
+       L1CTL_RACH_REQ,
+       L1CTL_DM_EST_REQ,
+       L1CTL_DATA_REQ,
+       L1CTL_RESET_IND,
+       L1CTL_PM_REQ,           /* power measurement */
+       L1CTL_PM_CONF,          /* power measurement */
+       L1CTL_ECHO_REQ,
+       L1CTL_ECHO_CONF,
+       L1CTL_RACH_CONF,
+       L1CTL_RESET_REQ,
+       L1CTL_RESET_CONF,
+       L1CTL_DATA_CONF,
+       L1CTL_CCCH_MODE_REQ,
+       L1CTL_CCCH_MODE_CONF,
+       L1CTL_DM_REL_REQ,
+       L1CTL_PARAM_REQ,
+       L1CTL_DM_FREQ_REQ,
+       L1CTL_CRYPTO_REQ,
+       L1CTL_SIM_REQ,
+       L1CTL_SIM_CONF,
+       L1CTL_TCH_MODE_REQ,
+       L1CTL_TCH_MODE_CONF,
+};
 
 enum ccch_mode {
        CCCH_MODE_NONE = 0,
@@ -100,6 +109,12 @@ struct l1ctl_ccch_mode_conf {
        uint8_t padding[3];
 } __attribute__((packed));
 
+/* TCH mode was changed */
+struct l1ctl_tch_mode_conf {
+       uint8_t tch_mode;       /* enum tch_mode */
+       uint8_t padding[3];
+} __attribute__((packed));
+
 /* data on the CCCH was found. This is following the header */
 struct l1ctl_data_ind {
        uint8_t data[23];
@@ -149,12 +164,20 @@ struct l1ctl_ccch_mode_req {
        uint8_t padding[3];
 } __attribute__((packed));
 
+/*
+ * msg for TCH_MODE_REQ
+ * the l1_info_ul header is in front
+ */
+struct l1ctl_tch_mode_req {
+       uint8_t tch_mode;       /* enum gsm48_chan_mode */
+       uint8_t padding[3];
+} __attribute__((packed));
+
 /* the l1_info_ul header is in front */
 struct l1ctl_rach_req {
        uint8_t ra;
-       uint8_t fn51;
-       uint8_t mf_off;
-       uint8_t padding[1];
+       uint8_t combined;
+       uint16_t offset;
 } __attribute__((packed));
 
 /* the l1_info_ul header is in front */
@@ -164,23 +187,44 @@ struct l1ctl_par_req {
        uint8_t padding[2];
 } __attribute__((packed));
 
+struct l1ctl_h0 {
+       uint16_t band_arfcn;
+} __attribute__((packed));
+
+struct l1ctl_h1 {
+       uint8_t hsn;
+       uint8_t maio;
+       uint8_t n;
+       uint8_t _padding[1];
+       uint16_t ma[64];
+} __attribute__((packed));
+
 struct l1ctl_dm_est_req {
        uint8_t tsc;
        uint8_t h;
        union {
-               struct {
-                       uint16_t band_arfcn;
-               } h0;
-               struct {
-                       uint8_t hsn;
-                       uint8_t maio;
-                       uint8_t n;
-                       uint8_t _padding[1];
-                       uint16_t ma[64];
-               } h1;
+               struct l1ctl_h0 h0;
+               struct l1ctl_h1 h1;
+       };
+       uint8_t tch_mode;
+       uint8_t _padding[1];
+} __attribute__((packed));
+
+struct l1ctl_dm_freq_req {
+       uint16_t fn;
+       uint8_t tsc;
+       uint8_t h;
+       union {
+               struct l1ctl_h0 h0;
+               struct l1ctl_h1 h1;
        };
 } __attribute__((packed));
 
+struct l1ctl_crypto_req {
+       uint8_t algo;
+       uint8_t key[0];
+} __attribute__((packed));
+
 struct l1ctl_pm_req {
        uint8_t type;
        uint8_t padding[3];