Pau Espin Pedrol | deed90d | 2021-05-26 13:17:01 +0200 | [diff] [blame] | 1 | /* bts_anr_fsm.h |
| 2 | * |
| 3 | * Copyright (C) 2021 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de> |
| 4 | * Author: Pau Espin Pedrol <pespin@sysmocom.de> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * as published by the Free Software Foundation; either version 2 |
| 9 | * of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 | */ |
| 20 | #pragma once |
| 21 | |
| 22 | #include <osmocom/core/fsm.h> |
| 23 | #include <osmocom/gsm/gsm23003.h> |
| 24 | |
| 25 | #include <pcu_utils.h> |
| 26 | |
| 27 | #define MAX_NEIGH_LIST_LEN 96 |
| 28 | |
| 29 | struct gprs_rlcmac_bts; |
| 30 | |
| 31 | enum bts_anr_fsm_event { |
| 32 | BTS_ANR_EV_RX_ANR_REQ, /* data: struct gsm_pcu_if_anr_req* */ |
| 33 | BTS_ANR_EV_SCHED_MS_MEAS, |
| 34 | BTS_ANR_EV_MS_MEAS_COMPL, /* data: struct ms_anr_ev_meas_compl* */ |
| 35 | BTS_ANR_EV_MS_MEAS_ABORTED, /* data: struct ms_anr_ev_meas_abort* */ |
| 36 | }; |
| 37 | |
| 38 | enum bts_anr_fsm_states { |
| 39 | BTS_ANR_ST_DISABLED, |
| 40 | BTS_ANR_ST_ENABLED |
| 41 | }; |
| 42 | |
| 43 | struct bts_anr_fsm_ctx { |
| 44 | struct osmo_fsm_inst *fi; |
| 45 | struct gprs_rlcmac_bts *bts; /* back pointer */ |
| 46 | struct arfcn_bsic cell_list[MAX_NEIGH_LIST_LEN]; /* ordered by ascending ARFCN */ |
| 47 | unsigned int num_cells; |
| 48 | unsigned int next_cell; /* Next cell list subset starts from this index */ |
| 49 | }; |
| 50 | |
| 51 | /* passed as data in BTS_ANR_EV_MS_MEAS_COMPL */ |
| 52 | |
| 53 | struct ms_anr_ev_meas_compl { |
| 54 | const struct arfcn_bsic *cell_list; /* len() = num_cells */ |
| 55 | const uint8_t *meas_list; /* len() = num_cells, value 0xff means invalid */ |
| 56 | unsigned int num_cells; |
| 57 | }; |
| 58 | |
| 59 | /* passed as data in BTS_ANR_EV_MS_MEAS_ABORT */ |
| 60 | struct ms_anr_ev_abort { |
| 61 | const struct arfcn_bsic* cell_list; |
| 62 | unsigned int num_cells; |
| 63 | }; |
| 64 | |
| 65 | struct bts_anr_fsm_ctx *bts_anr_fsm_alloc(struct gprs_rlcmac_bts* bts); |