lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

November 2022

  • 2 participants
  • 2503 discussions
Change in osmocom-bb[master]: fw: Add initial support for Sony Ericsson K200i/K220i phones
by steve-m 07 Nov '22

07 Nov '22
steve-m has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/30051 ) Change subject: fw: Add initial support for Sony Ericsson K200i/K220i phones ...................................................................... fw: Add initial support for Sony Ericsson K200i/K220i phones Includes RF frontend configuration, TIFFS config, keymap. Currently still using the rf_tables and afcparams from gta0x. No display driver yet. Make sure to run osmocon with -m romload -i 10 Change-Id: I711702862b1cec5a8089dac071f8a171ca026003 --- M src/target/firmware/Makefile A src/target/firmware/board/se_k2x0/init.c A src/target/firmware/board/se_k2x0/keymap.h A src/target/firmware/board/se_k2x0/rffe_k2x0.c 4 files changed, 286 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/51/30051/1 diff --git a/src/target/firmware/Makefile b/src/target/firmware/Makefile index 104ddac..c6f87cb 100644 --- a/src/target/firmware/Makefile +++ b/src/target/firmware/Makefile @@ -24,7 +24,7 @@ # # List of all supported boards (meant to be overridden on command line) -BOARDS?=compal_e88 compal_e86 compal_e99 se_j100 gta0x gtm900b fcdev3b pirelli_dpl10 +BOARDS?=compal_e88 compal_e86 compal_e99 se_j100 se_k2x0 gta0x gtm900b fcdev3b pirelli_dpl10 # Framebuffer support, board specific drivers FB_OBJS=fb/framebuffer.o fb/font.o fb/helvR08.o fb/helvB14.o fb/c64.o \ @@ -100,6 +100,12 @@ battery/dummy.o $(FB_j100_OBJS) BOARD_se_j100_ENVIRONMENTS=$(compal_COMMON_ENVIRONMENTS) +# Sony Ericsson K200i/K220i +BOARD_se_k2x0_OBJS=$(calypso_COMMON_OBJS) board/se_k2x0/init.o \ + board/se_k2x0/rffe_k2x0.o \ + board/gta0x/rf_tables.o board/gta0x/afcparams.o \ + board/common/readcal_tiffs.o battery/dummy.o $(FB_dummy_OBJS) +BOARD_se_k2x0_ENVIRONMENTS=highram # # Applications diff --git a/src/target/firmware/board/se_k2x0/init.c b/src/target/firmware/board/se_k2x0/init.c new file mode 100644 index 0000000..ebd32a7 --- /dev/null +++ b/src/target/firmware/board/se_k2x0/init.c @@ -0,0 +1,129 @@ +/* Initialization for the Sony Ericsson K200i/K220i */ + +/* (C) 2010 by Harald Welte <laforge(a)gnumonks.org> + * (C) 2010-22 by Steve Markgraf <steve(a)steve-m.de> + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <stdint.h> +#include <stdio.h> + +#include <debug.h> +#include <ctors.h> +#include <memory.h> +#include <board.h> +#include <keypad.h> +#include <console.h> +#include <flash/cfi_flash.h> + +#include <calypso/irq.h> +#include <calypso/clock.h> +#include <calypso/dma.h> +#include <calypso/rtc.h> +#include <calypso/timer.h> +#include <uart.h> +#include <calypso/backlight.h> + +#include <comm/sercomm.h> +#include <comm/timer.h> + +#include <abb/twl3025.h> +#include <rf/trf6151.h> + +#include <fb/framebuffer.h> +#include "keymap.h" + +#define ASIC_CONF_REG 0xfffef008 + +static void board_io_init(void) +{ + uint16_t reg; + + reg = readw(ASIC_CONF_REG); + /* TWL3025: Set SPI+RIF RX clock to rising edge */ + reg |= (1 << 13) | (1 << 14); + writew(reg, ASIC_CONF_REG); +} + +void board_init(int with_irq) +{ + /* Disable watchdog (compal loader leaves it enabled) */ + wdog_enable(0); + + /* Configure the memory interface - TODO: adapt for K2x0i, right now just + * copied from Pirelli DP-L10 */ + calypso_mem_cfg(CALYPSO_nCS0, 4, CALYPSO_MEM_16bit, 1); + calypso_mem_cfg(CALYPSO_nCS1, 4, CALYPSO_MEM_16bit, 1); + calypso_mem_cfg(CALYPSO_nCS2, 5, CALYPSO_MEM_16bit, 1); + calypso_mem_cfg(CALYPSO_nCS3, 4, CALYPSO_MEM_16bit, 1); + calypso_mem_cfg(CALYPSO_CS4, 7, CALYPSO_MEM_16bit, 1); + calypso_mem_cfg(CALYPSO_nCS6, 0, CALYPSO_MEM_32bit, 1); + calypso_mem_cfg(CALYPSO_nCS7, 0, CALYPSO_MEM_32bit, 0); + + /* Set VTCXO_DIV2 = 1, configure PLL for 104 MHz and give ARM half of that */ + calypso_clock_set(2, CALYPSO_PLL13_104_MHZ, ARM_MCLK_DIV_2); + + /* Configure the RHEA bridge with some sane default values */ + calypso_rhea_cfg(0, 0, 0xff, 0, 1, 0, 0); + + /* Initialize board-specific GPIO */ + board_io_init(); + + /* Enable bootrom mapping to route exception vectors to RAM */ + calypso_bootrom(with_irq); + calypso_exceptions_install(); + + /* Initialize interrupt controller */ + if (with_irq) + irq_init(); + + sercomm_bind_uart(UART_MODEM); + cons_bind_uart(UART_IRDA); + + /* initialize MODEM UART to be used for sercomm */ + uart_init(UART_MODEM, with_irq); + uart_baudrate(UART_MODEM, UART_115200); + + /* initialize IRDA UART to be used for old-school console code. + * note: IRDA uart only accessible on C115 and C117 PCB */ + uart_init(UART_IRDA, with_irq); + uart_baudrate(UART_IRDA, UART_115200); + + /* Initialize hardware timers */ + hwtimer_init(); + + /* Initialize DMA controller */ + dma_init(); + + /* Initialize real time clock */ + rtc_init(); + + /* Initialize system timers (uses hwtimer 2) */ + timer_init(); + + /* Initialize LCD driver and backlight */ + fb_init(); + bl_mode_pwl(1); + bl_level(50); + + /* Initialize keypad driver */ + keypad_init(keymap, with_irq); + + /* Initialize ABB driver (uses SPI) */ + twl3025_init(); + + /* Initialize TIFFS reader (13 sectors of 256 KiB each) */ + tiffs_init(0x01800000, 0x40000, 13); +} diff --git a/src/target/firmware/board/se_k2x0/keymap.h b/src/target/firmware/board/se_k2x0/keymap.h new file mode 100644 index 0000000..aa2d8a5 --- /dev/null +++ b/src/target/firmware/board/se_k2x0/keymap.h @@ -0,0 +1,28 @@ +/* Keymap for SE K200i/K220i */ +static const uint8_t keymap[] = { + [KEY_0] = 9, + [KEY_1] = 1, + [KEY_2] = 6, + [KEY_3] = 11, + [KEY_4] = 2, + [KEY_5] = 7, + [KEY_6] = 12, + [KEY_7] = 3, + [KEY_8] = 8, + [KEY_9] = 13, + [KEY_STAR] = 4, + [KEY_HASH] = 14, + [KEY_MENU] = 21, /* not existent */ + [KEY_LEFT_SB] = 0, + [KEY_RIGHT_SB] = 5, + [KEY_UP] = 16, + [KEY_DOWN] = 15, + [KEY_LEFT] = 17, + [KEY_RIGHT] = 18, + [KEY_OK] = 10, +/* power button is not connected to keypad scan matrix but to TWL3025 */ + [KEY_POWER] = 31, + [KEY_MINUS] = 22, /* not existent */ + [KEY_PLUS] = 23, /* not existent */ + [KEY_CAMERA] = 24, /* not existent */ +}; diff --git a/src/target/firmware/board/se_k2x0/rffe_k2x0.c b/src/target/firmware/board/se_k2x0/rffe_k2x0.c new file mode 100644 index 0000000..f9965ac --- /dev/null +++ b/src/target/firmware/board/se_k2x0/rffe_k2x0.c @@ -0,0 +1,122 @@ +/* RF frontend driver for Sony Ericsson K200i/K220i */ + +/* (C) 2022 by Steve Markgraf <steve(a)steve-m.de> + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include <stdint.h> +#include <stdio.h> + +#include <debug.h> +#include <memory.h> +#include <rffe.h> +#include <calypso/tsp.h> +#include <rf/trf6151.h> + +/* This is a value that has been measured on the C123 by Harald: 71dBm, + it is the difference between the input level at the antenna and what + the DSP reports, subtracted by the total gain of the TRF6151 */ +#define SYSTEM_INHERENT_GAIN 71 + +/* describe how the RF frontend is wired on the SE K200i/K220i */ +#define RITA_RESET TSPACT(0) /* Reset of the Rita TRF6151, correct for K200i */ +#define PA_ENABLE TSPACT(9) /* Enable the Power Amplifier */ +#define DCS_TXEN TSPACT(3) /* DCS (as opposed to GSM) Transmit */ + +#define ASM_VC1 TSPACT(1) /* GSM1800 TX at antenna switch, inverted */ +#define ASM_VC2 TSPACT(2) /* GSM900 TX at antenna switch, inverted */ + +#define IOTA_STROBE TSPEN(1) /* Strobe for the Iota TSP */ +#define RITA_STROBE TSPEN(2) /* Strobe for the Rita TSP */ + +/* switch RF Frontend Mode */ +void rffe_mode(enum gsm_band band, int tx) +{ + uint16_t tspact = tsp_act_state(); + + /* First we mask off all bits from the state cache */ + tspact &= ~(PA_ENABLE | DCS_TXEN); + tspact |= ASM_VC1 | ASM_VC2; + +#ifdef CONFIG_TX_ENABLE + /* Then we selectively set the bits on, if required */ + if (tx) { + if ((band == GSM_BAND_1800) || band == (GSM_BAND_1900)) { + tspact |= DCS_TXEN; + tspact &= ~ASM_VC1; + } else + tspact &= ~ASM_VC2; + + tspact |= PA_ENABLE; + } +#endif /* TRANSMIT_SUPPORT */ + + tsp_act_update(tspact); +} + +uint32_t rffe_get_rx_ports(void) +{ + return (1 << PORT_LO) | (1 << PORT_DCS1800) | (1 << PORT_PCS1900); +} + +uint32_t rffe_get_tx_ports(void) +{ + return (1 << PORT_LO) | (1 << PORT_HI); +} + +/* Returns need for IQ swap */ +int rffe_iq_swapped(uint16_t band_arfcn, int tx) +{ + return trf6151_iq_swapped(band_arfcn, tx); +} + +#define MCU_SW_TRACE 0xfffef00e +#define ARM_CONF_REG 0xfffef006 +#define ASIC_CONF_REG 0xfffef008 + +void rffe_init(void) +{ + /* Configure the TSPEN which is connected to the TWL3025 */ + tsp_setup(IOTA_STROBE, 1, 0, 0); + + trf6151_init(RITA_STROBE, RITA_RESET); +} + +uint8_t rffe_get_gain(void) +{ + return trf6151_get_gain(); +} + +void rffe_set_gain(uint8_t dbm) +{ + trf6151_set_gain(dbm); +} + +const uint8_t system_inherent_gain = SYSTEM_INHERENT_GAIN; + +/* Given the expected input level of exp_inp dBm/8 and the target of target_bb + * dBm8, configure the RF Frontend with the respective gain */ +void rffe_compute_gain(int16_t exp_inp, int16_t target_bb) +{ + trf6151_compute_gain(exp_inp, target_bb); +} + +void rffe_rx_win_ctrl(int16_t exp_inp, int16_t target_bb) +{ + /* FIXME */ +} -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/30051 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I711702862b1cec5a8089dac071f8a171ca026003 Gerrit-Change-Number: 30051 Gerrit-PatchSet: 1 Gerrit-Owner: steve-m <steve(a)steve-m.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmo-pfcp[master]: Add -Werror=implicit-int -Werror=int-conversion -Werror=old-style-def...
by fixeria 07 Nov '22

07 Nov '22
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-pfcp/+/29986 ) Change subject: Add -Werror=implicit-int -Werror=int-conversion -Werror=old-style-definition ...................................................................... Add -Werror=implicit-int -Werror=int-conversion -Werror=old-style-definition ... if --enable-werror is used Change-Id: I8e6cdc40cb77777677e5ffbbf3bf9e5c32555b2c --- M configure.ac 1 file changed, 1 insertion(+), 0 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved fixeria: Looks good to me, but someone else must approve diff --git a/configure.ac b/configure.ac index 1b8436e..ba7ff86 100644 --- a/configure.ac +++ b/configure.ac @@ -68,6 +68,7 @@ if test x"$werror" = x"yes" then WERROR_FLAGS="-Werror" + WERROR_FLAGS+=" -Werror=implicit-int -Werror=int-conversion -Werror=old-style-definition" WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations" WERROR_FLAGS+=" -Wno-error=cpp" # "#warning" CFLAGS="$CFLAGS $WERROR_FLAGS" -- To view, visit https://gerrit.osmocom.org/c/libosmo-pfcp/+/29986 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-pfcp Gerrit-Branch: master Gerrit-Change-Id: I8e6cdc40cb77777677e5ffbbf3bf9e5c32555b2c Gerrit-Change-Number: 29986 Gerrit-PatchSet: 2 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmocom-bb[master]: trxcon: deliver measurement results via the PHYIF primitives
by fixeria 07 Nov '22

07 Nov '22
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/30028 ) Change subject: trxcon: deliver measurement results via the PHYIF primitives ...................................................................... trxcon: deliver measurement results via the PHYIF primitives The PHYIF implementation shall not send events to the trxcon_fsm directly. The measurement command is sent in form of an abstract PHYIF primitive (PHYIF_CMDT_MEASURE), so it's more logical that the response is sent in form of a PHYIF primitive too. Change-Id: Ie20616c288c16559d0a566979b24d57b50369fab Related: OS#5599 --- M src/host/trxcon/include/osmocom/bb/trxcon/phyif.h M src/host/trxcon/src/trx_if.c M src/host/trxcon/src/trxcon.c 3 files changed, 48 insertions(+), 7 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, approved osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/phyif.h b/src/host/trxcon/include/osmocom/bb/trxcon/phyif.h index 037a905..ae272dd 100644 --- a/src/host/trxcon/include/osmocom/bb/trxcon/phyif.h +++ b/src/host/trxcon/include/osmocom/bb/trxcon/phyif.h @@ -40,12 +40,19 @@ int8_t ta; /* intentionally signed */ }; -/* param of PHYIF_CMDT_MEASURE */ +/* param of PHYIF_CMDT_MEASURE (command) */ struct phyif_cmdp_measure { uint16_t band_arfcn_start; uint16_t band_arfcn_stop; }; +/* param of PHYIF_CMDT_MEASURE (response) */ +struct phyif_rspp_measure { + bool last; + uint16_t band_arfcn; + int dbm; +}; + struct phyif_cmd { enum phyif_cmd_type type; union { @@ -57,6 +64,13 @@ } param; }; +struct phyif_rsp { + enum phyif_cmd_type type; + union { + struct phyif_rspp_measure measure; + } param; +}; + /* BURST.req - a burst to be transmitted */ struct phyif_burst_req { uint32_t fn; @@ -80,4 +94,5 @@ int phyif_handle_burst_ind(void *phyif, const struct phyif_burst_ind *bi); int phyif_handle_burst_req(void *phyif, const struct phyif_burst_req *br); int phyif_handle_cmd(void *phyif, const struct phyif_cmd *cmd); +int phyif_handle_rsp(void *phyif, const struct phyif_rsp *rsp); void phyif_close(void *phyif); diff --git a/src/host/trxcon/src/trx_if.c b/src/host/trxcon/src/trx_if.c index 7f3ce08..4074ba8 100644 --- a/src/host/trxcon/src/trx_if.c +++ b/src/host/trxcon/src/trx_if.c @@ -372,7 +372,6 @@ static void trx_if_measure_rsp_cb(struct trx_instance *trx, char *resp) { - struct trxcon_inst *trxcon = trx->trxcon; unsigned int freq10; uint16_t band_arfcn; int dbm; @@ -391,13 +390,16 @@ return; } - struct trxcon_param_full_power_scan_res res = { - .last_result = band_arfcn == trx->pm_band_arfcn_stop, - .band_arfcn = band_arfcn, - .dbm = dbm, + const struct phyif_rsp rsp = { + .type = PHYIF_CMDT_MEASURE, + .param.measure = { + .last = band_arfcn == trx->pm_band_arfcn_stop, + .band_arfcn = band_arfcn, + .dbm = dbm, + }, }; - osmo_fsm_inst_dispatch(trxcon->fi, TRXCON_EV_FULL_POWER_SCAN_RES, &res); + phyif_handle_rsp(trx, &rsp); /* Schedule a next measurement */ if (band_arfcn != trx->pm_band_arfcn_stop) { diff --git a/src/host/trxcon/src/trxcon.c b/src/host/trxcon/src/trxcon.c index 9522a49..2ea2c40 100644 --- a/src/host/trxcon/src/trxcon.c +++ b/src/host/trxcon/src/trxcon.c @@ -177,6 +177,30 @@ return trx_if_handle_phyif_cmd(phyif, cmd); } +int phyif_handle_rsp(void *phyif, const struct phyif_rsp *rsp) +{ + struct trx_instance *trx = phyif; + struct trxcon_inst *trxcon = trx->trxcon; + + switch (rsp->type) { + case PHYIF_CMDT_MEASURE: + { + const struct phyif_rspp_measure *meas = &rsp->param.measure; + struct trxcon_param_full_power_scan_res res = { + .last_result = meas->last, + .band_arfcn = meas->band_arfcn, + .dbm = meas->dbm, + }; + + return osmo_fsm_inst_dispatch(trxcon->fi, TRXCON_EV_FULL_POWER_SCAN_RES, &res); + } + default: + LOGPFSML(trxcon->fi, LOGL_ERROR, + "Unhandled PHYIF response (type 0x%02x)\n", rsp->type); + return -ENODEV; + } +} + void phyif_close(void *phyif) { trx_if_close(phyif); -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/30028 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Ie20616c288c16559d0a566979b24d57b50369fab Gerrit-Change-Number: 30028 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmocom-bb[master]: trxcon: abstract out trx_if.c from struct trxcon_inst
by fixeria 07 Nov '22

07 Nov '22
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/30029 ) Change subject: trxcon: abstract out trx_if.c from struct trxcon_inst ...................................................................... trxcon: abstract out trx_if.c from struct trxcon_inst The PHYIF implementation shall not have direct access to the struct trxcon_inst it belongs to. All communication shall be done via the abstract PHYIF interface (see <include/osmocom/bb/trxcon/phyif.h>). * Introduce struct trx_if_params containing all necessary params. * Make trx_if_open() accept a struct trx_if_params pointer. Change-Id: I1a97c4c783ab671636ca33700eca97dede2a4a09 Related: OS#5599 --- M src/host/trxcon/include/osmocom/bb/trxcon/trx_if.h M src/host/trxcon/src/trx_if.c M src/host/trxcon/src/trxcon.c 3 files changed, 47 insertions(+), 31 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, approved osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/trx_if.h b/src/host/trxcon/include/osmocom/bb/trxcon/trx_if.h index 9628f72..bfab0ad 100644 --- a/src/host/trxcon/include/osmocom/bb/trxcon/trx_if.h +++ b/src/host/trxcon/include/osmocom/bb/trxcon/trx_if.h @@ -10,9 +10,6 @@ #define TRXC_BUF_SIZE 1024 #define TRXD_BUF_SIZE 512 -/* Forward declaration to avoid mutual include */ -struct trxcon_inst; - enum trx_fsm_states { TRX_STATE_OFFLINE = 0, TRX_STATE_IDLE, @@ -21,9 +18,6 @@ }; struct trx_instance { - /* trxcon instance we belong to */ - struct trxcon_inst *trxcon; - struct osmo_fd trx_ofd_ctrl; struct osmo_fd trx_ofd_data; @@ -38,6 +32,9 @@ /* GSM L1 specific */ uint16_t pm_band_arfcn_start; uint16_t pm_band_arfcn_stop; + + /* Some private data */ + void *priv; }; struct trx_ctrl_msg { @@ -48,8 +45,18 @@ int cmd_len; }; -struct trx_instance *trx_if_open(struct trxcon_inst *trxcon, - const char *local_host, const char *remote_host, uint16_t port); +struct trx_if_params { + const char *local_host; + const char *remote_host; + uint16_t base_port; + uint8_t instance; + + struct osmo_fsm_inst *parent_fi; + uint32_t parent_term_event; + void *priv; +}; + +struct trx_instance *trx_if_open(const struct trx_if_params *params); void trx_if_close(struct trx_instance *trx); int trx_if_handle_phyif_burst_req(struct trx_instance *trx, const struct phyif_burst_req *br); diff --git a/src/host/trxcon/src/trx_if.c b/src/host/trxcon/src/trx_if.c index 4074ba8..928ad5d 100644 --- a/src/host/trxcon/src/trx_if.c +++ b/src/host/trxcon/src/trx_if.c @@ -40,7 +40,6 @@ #include <osmocom/gsm/gsm_utils.h> -#include <osmocom/bb/trxcon/trxcon.h> #include <osmocom/bb/trxcon/trx_if.h> #include <osmocom/bb/trxcon/logging.h> @@ -740,29 +739,31 @@ } /* Init TRX interface (TRXC, TRXD sockets and FSM) */ -struct trx_instance *trx_if_open(struct trxcon_inst *trxcon, - const char *local_host, const char *remote_host, - uint16_t base_port) +struct trx_instance *trx_if_open(const struct trx_if_params *params) { - const unsigned int offset = trxcon->id * 2; + const unsigned int offset = params->instance * 2; struct trx_instance *trx; struct osmo_fsm_inst *fi; int rc; - LOGPFSML(trxcon->fi, LOGL_NOTICE, "Init transceiver interface " - "(%s:%u/%u)\n", remote_host, base_port, trxcon->id); + LOGPFSML(params->parent_fi, LOGL_NOTICE, + "Init transceiver interface (%s:%u/%u)\n", + params->remote_host, params->base_port, + params->instance); /* Allocate a new dedicated state machine */ - fi = osmo_fsm_inst_alloc_child(&trx_fsm, trxcon->fi, TRXCON_EV_PHYIF_FAILURE); + fi = osmo_fsm_inst_alloc_child(&trx_fsm, params->parent_fi, + params->parent_term_event); if (fi == NULL) { - LOGPFSML(trxcon->fi, LOGL_ERROR, "Failed to allocate an instance " - "of FSM '%s'\n", trx_fsm.name); + LOGPFSML(params->parent_fi, LOGL_ERROR, + "Failed to allocate an instance of FSM '%s'\n", + trx_fsm.name); return NULL; } trx = talloc_zero(fi, struct trx_instance); if (!trx) { - LOGPFSML(trxcon->fi, LOGL_ERROR, "Failed to allocate memory\n"); + LOGPFSML(params->parent_fi, LOGL_ERROR, "Failed to allocate memory\n"); osmo_fsm_inst_free(fi); return NULL; } @@ -772,27 +773,27 @@ /* Open sockets */ rc = trx_udp_open(trx, &trx->trx_ofd_ctrl, /* TRXC */ - local_host, base_port + 101 + offset, - remote_host, base_port + 1 + offset, + params->local_host, params->base_port + 101 + offset, + params->remote_host, params->base_port + 1 + offset, trx_ctrl_read_cb); if (rc < 0) goto udp_error; rc = trx_udp_open(trx, &trx->trx_ofd_data, /* TRXD */ - local_host, base_port + 102 + offset, - remote_host, base_port + 2 + offset, + params->local_host, params->base_port + 102 + offset, + params->remote_host, params->base_port + 2 + offset, trx_data_rx_cb); if (rc < 0) goto udp_error; - trx->trxcon = trxcon; + trx->priv = params->priv; fi->priv = trx; trx->fi = fi; return trx; udp_error: - LOGPFSML(trx->fi, LOGL_ERROR, "Couldn't establish UDP connection\n"); + LOGPFSML(params->parent_fi, LOGL_ERROR, "Couldn't establish UDP connection\n"); osmo_fsm_inst_free(trx->fi); return NULL; } diff --git a/src/host/trxcon/src/trxcon.c b/src/host/trxcon/src/trxcon.c index 2ea2c40..306a8fe 100644 --- a/src/host/trxcon/src/trxcon.c +++ b/src/host/trxcon/src/trxcon.c @@ -149,7 +149,7 @@ int phyif_handle_burst_ind(void *phyif, const struct phyif_burst_ind *bi) { struct trx_instance *trx = phyif; - struct trxcon_inst *trxcon = trx->trxcon; + struct trxcon_inst *trxcon = trx->priv; const struct l1sched_meas_set meas = { .fn = bi->fn, .toa256 = bi->toa256, @@ -180,7 +180,7 @@ int phyif_handle_rsp(void *phyif, const struct phyif_rsp *rsp) { struct trx_instance *trx = phyif; - struct trxcon_inst *trxcon = trx->trxcon; + struct trxcon_inst *trxcon = trx->priv; switch (rsp->type) { case PHYIF_CMDT_MEASURE: @@ -356,11 +356,19 @@ /* Logging context to be used by both l1ctl and l1sched modules */ trxcon->log_prefix = talloc_asprintf(trxcon, "%s: ", osmo_fsm_inst_name(fi)); + const struct trx_if_params phyif_params = { + .local_host = app_data.trx_bind_ip, + .remote_host = app_data.trx_remote_ip, + .base_port = app_data.trx_base_port, + .instance = trxcon->id, + + .parent_fi = trxcon->fi, + .parent_term_event = TRXCON_EV_PHYIF_FAILURE, + .priv = trxcon, + }; + /* Init transceiver interface */ - trxcon->phyif = trx_if_open(trxcon, - app_data.trx_bind_ip, - app_data.trx_remote_ip, - app_data.trx_base_port); + trxcon->phyif = trx_if_open(&phyif_params); if (trxcon->phyif == NULL) { trxcon_inst_free(trxcon); return NULL; -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/30029 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I1a97c4c783ab671636ca33700eca97dede2a4a09 Gerrit-Change-Number: 30029 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmocom-bb[master]: trxcon: trxcon_fsm.c: remove unused import of l1ctl_server.h
by fixeria 07 Nov '22

07 Nov '22
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/30027 ) Change subject: trxcon: trxcon_fsm.c: remove unused import of l1ctl_server.h ...................................................................... trxcon: trxcon_fsm.c: remove unused import of l1ctl_server.h Change-Id: I81a877845160db3b9d6823091ac9243be0836729 --- M src/host/trxcon/src/trxcon_fsm.c 1 file changed, 0 insertions(+), 1 deletion(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/host/trxcon/src/trxcon_fsm.c b/src/host/trxcon/src/trxcon_fsm.c index 4ee824c..f936449 100644 --- a/src/host/trxcon/src/trxcon_fsm.c +++ b/src/host/trxcon/src/trxcon_fsm.c @@ -31,7 +31,6 @@ #include <osmocom/bb/trxcon/phyif.h> #include <osmocom/bb/trxcon/logging.h> #include <osmocom/bb/trxcon/l1ctl.h> -#include <osmocom/bb/trxcon/l1ctl_server.h> #include <osmocom/bb/l1sched/l1sched.h> #include <osmocom/bb/l1sched/logging.h> -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/30027 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I81a877845160db3b9d6823091ac9243be0836729 Gerrit-Change-Number: 30027 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-MessageType: merged
1 0
0 0
Change in osmocom-bb[master]: trxcon: handle RACH.cnf via TRXCON_EV_TX_ACCESS_BURST_CNF
by fixeria 07 Nov '22

07 Nov '22
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/29960 ) Change subject: trxcon: handle RACH.cnf via TRXCON_EV_TX_ACCESS_BURST_CNF ...................................................................... trxcon: handle RACH.cnf via TRXCON_EV_TX_ACCESS_BURST_CNF Change-Id: I64de7d4e8137041b373a9920296553fbfe8386d4 Related: OS#5599 --- M src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h M src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h M src/host/trxcon/src/l1ctl.c M src/host/trxcon/src/trxcon.c M src/host/trxcon/src/trxcon_fsm.c 5 files changed, 33 insertions(+), 9 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h b/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h index eb67bee..deeb318 100644 --- a/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h +++ b/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h @@ -22,4 +22,4 @@ int l1ctl_tx_dt_conf(struct l1ctl_client *l1c, const struct trxcon_param_tx_data_cnf *cnf); int l1ctl_tx_rach_conf(struct l1ctl_client *l1c, - uint16_t band_arfcn, uint32_t fn); + const struct trxcon_param_tx_access_burst_cnf *cnf); diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h index 5af2122..117f3fd 100644 --- a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h +++ b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h @@ -26,6 +26,7 @@ TRXCON_EV_SET_TCH_MODE_REQ, TRXCON_EV_SET_PHY_CONFIG_REQ, TRXCON_EV_TX_ACCESS_BURST_REQ, + TRXCON_EV_TX_ACCESS_BURST_CNF, TRXCON_EV_UPDATE_SACCH_CACHE_REQ, TRXCON_EV_DEDICATED_ESTABLISH_REQ, TRXCON_EV_DEDICATED_RELEASE_REQ, @@ -126,6 +127,12 @@ bool is_11bit; }; +/* param of TRXCON_EV_TX_ACCESS_BURST_CNF */ +struct trxcon_param_tx_access_burst_cnf { + uint16_t band_arfcn; + uint32_t frame_nr; +}; + /* param of TRXCON_EV_DEDICATED_ESTABLISH_REQ */ struct trxcon_param_dedicated_establish_req { uint8_t chan_nr; diff --git a/src/host/trxcon/src/l1ctl.c b/src/host/trxcon/src/l1ctl.c index b9805eb..890e4d2 100644 --- a/src/host/trxcon/src/l1ctl.c +++ b/src/host/trxcon/src/l1ctl.c @@ -263,20 +263,20 @@ } int l1ctl_tx_rach_conf(struct l1ctl_client *l1c, - uint16_t band_arfcn, uint32_t fn) + const struct trxcon_param_tx_access_burst_cnf *cnf) { - struct l1ctl_info_dl *dl; struct msgb *msg; msg = l1ctl_alloc_msg(L1CTL_RACH_CONF); if (msg == NULL) return -ENOMEM; - dl = put_dl_info_hdr(msg, NULL); - memset(dl, 0x00, sizeof(*dl)); + const struct l1ctl_info_dl dl_hdr = { + .band_arfcn = htons(cnf->band_arfcn), + .frame_nr = htonl(cnf->frame_nr), + }; - dl->band_arfcn = htons(band_arfcn); - dl->frame_nr = htonl(fn); + put_dl_info_hdr(msg, &dl_hdr); return l1ctl_client_send(l1c, msg); } diff --git a/src/host/trxcon/src/trxcon.c b/src/host/trxcon/src/trxcon.c index b6bd56d..9522a49 100644 --- a/src/host/trxcon/src/trxcon.c +++ b/src/host/trxcon/src/trxcon.c @@ -278,10 +278,14 @@ case L1SCHED_DT_OTHER: if (L1SCHED_PRIM_IS_RACH(lchan->prim)) { const struct l1sched_ts_prim_rach *rach; + struct trxcon_param_tx_access_burst_cnf cnf = { + .band_arfcn = trxcon->l1p.band_arfcn, + .frame_nr = fn, + }; + + rc = osmo_fsm_inst_dispatch(trxcon->fi, TRXCON_EV_TX_ACCESS_BURST_CNF, &cnf); rach = (struct l1sched_ts_prim_rach *)lchan->prim->payload; - - rc = l1ctl_tx_rach_conf(trxcon->l2if, trxcon->l1p.band_arfcn, fn); if (lchan->prim->type == L1SCHED_PRIM_RACH11) { ra_buf[0] = (uint8_t)(rach->ra >> 3); ra_buf[1] = (uint8_t)(rach->ra & 0x07); diff --git a/src/host/trxcon/src/trxcon_fsm.c b/src/host/trxcon/src/trxcon_fsm.c index 676c060..4ee824c 100644 --- a/src/host/trxcon/src/trxcon_fsm.c +++ b/src/host/trxcon/src/trxcon_fsm.c @@ -256,6 +256,9 @@ case TRXCON_EV_TX_ACCESS_BURST_REQ: handle_tx_access_burst_req(fi, data); break; + case TRXCON_EV_TX_ACCESS_BURST_CNF: + l1ctl_tx_rach_conf(trxcon->l2if, (const struct trxcon_param_tx_access_burst_cnf *)data); + break; case TRXCON_EV_SET_CCCH_MODE_REQ: { struct trxcon_param_set_ccch_tch_mode_req *req = data; @@ -356,6 +359,9 @@ case TRXCON_EV_TX_ACCESS_BURST_REQ: handle_tx_access_burst_req(fi, data); break; + case TRXCON_EV_TX_ACCESS_BURST_CNF: + l1ctl_tx_rach_conf(trxcon->l2if, (const struct trxcon_param_tx_access_burst_cnf *)data); + break; case TRXCON_EV_DEDICATED_RELEASE_REQ: l1sched_reset(trxcon->sched, false); osmo_fsm_inst_state_chg(fi, TRXCON_ST_RESET, 0, 0); @@ -463,6 +469,9 @@ case TRXCON_EV_TX_ACCESS_BURST_REQ: handle_tx_access_burst_req(fi, data); break; + case TRXCON_EV_TX_ACCESS_BURST_CNF: + l1ctl_tx_rach_conf(trxcon->l2if, (const struct trxcon_param_tx_access_burst_cnf *)data); + break; case TRXCON_EV_RX_DATA_IND: { const struct trxcon_param_rx_data_ind *ind = data; @@ -540,6 +549,7 @@ .in_event_mask = S(TRXCON_EV_RX_DATA_IND) | S(TRXCON_EV_SET_CCCH_MODE_REQ) | S(TRXCON_EV_TX_ACCESS_BURST_REQ) + | S(TRXCON_EV_TX_ACCESS_BURST_CNF) | S(TRXCON_EV_DEDICATED_ESTABLISH_REQ), .action = &trxcon_st_bcch_ccch_action, }, @@ -550,6 +560,7 @@ | S(TRXCON_ST_BCCH_CCCH), .in_event_mask = S(TRXCON_EV_DEDICATED_RELEASE_REQ) | S(TRXCON_EV_TX_ACCESS_BURST_REQ) + | S(TRXCON_EV_TX_ACCESS_BURST_CNF) | S(TRXCON_EV_SET_TCH_MODE_REQ) | S(TRXCON_EV_TX_DATA_REQ) | S(TRXCON_EV_TX_DATA_CNF) @@ -564,6 +575,7 @@ | S(TRXCON_ST_BCCH_CCCH), .in_event_mask = S(TRXCON_EV_DEDICATED_RELEASE_REQ) | S(TRXCON_EV_TX_ACCESS_BURST_REQ) + | S(TRXCON_EV_TX_ACCESS_BURST_CNF) | S(TRXCON_EV_RX_DATA_IND), .action = &trxcon_st_packet_data_action, }, @@ -582,6 +594,7 @@ OSMO_VALUE_STRING(TRXCON_EV_SET_TCH_MODE_REQ), OSMO_VALUE_STRING(TRXCON_EV_SET_PHY_CONFIG_REQ), OSMO_VALUE_STRING(TRXCON_EV_TX_ACCESS_BURST_REQ), + OSMO_VALUE_STRING(TRXCON_EV_TX_ACCESS_BURST_CNF), OSMO_VALUE_STRING(TRXCON_EV_UPDATE_SACCH_CACHE_REQ), OSMO_VALUE_STRING(TRXCON_EV_DEDICATED_ESTABLISH_REQ), OSMO_VALUE_STRING(TRXCON_EV_DEDICATED_RELEASE_REQ), 1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/29960 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I64de7d4e8137041b373a9920296553fbfe8386d4 Gerrit-Change-Number: 29960 Gerrit-PatchSet: 3 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmocom-bb[master]: trxcon: l1ctl.h: remove unneeded import of l1ctl_proto.h
by fixeria 07 Nov '22

07 Nov '22
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/30026 ) Change subject: trxcon: l1ctl.h: remove unneeded import of l1ctl_proto.h ...................................................................... trxcon: l1ctl.h: remove unneeded import of l1ctl_proto.h Change-Id: Ie66bb553cffd72a59d949979d8f97bacfc0bdad0 --- M src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h 1 file changed, 0 insertions(+), 1 deletion(-) Approvals: fixeria: Looks good to me, approved osmith: Looks good to me, but someone else must approve msuraev: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h b/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h index deeb318..1a8d775 100644 --- a/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h +++ b/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h @@ -4,7 +4,6 @@ #include <osmocom/core/msgb.h> #include <osmocom/bb/trxcon/l1ctl_server.h> -#include <osmocom/bb/trxcon/l1ctl_proto.h> /* Event handlers */ int l1ctl_rx_cb(struct l1ctl_client *l1c, struct msgb *msg); -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/30026 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Ie66bb553cffd72a59d949979d8f97bacfc0bdad0 Gerrit-Change-Number: 30026 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmocom-bb[master]: trxcon: handle DATA.cnf/TRAFFIC.cnf via TRXCON_EV_TX_DATA_CNF
by fixeria 07 Nov '22

07 Nov '22
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/29958 ) Change subject: trxcon: handle DATA.cnf/TRAFFIC.cnf via TRXCON_EV_TX_DATA_CNF ...................................................................... trxcon: handle DATA.cnf/TRAFFIC.cnf via TRXCON_EV_TX_DATA_CNF We already handle DATA.req/TRAFFIC.req via TRXCON_EV_TX_DATA_REQ, so let's handle the respective *.cnf messages via the FSM too. Change-Id: Ica7a25f0bf8c7f89037a776d711ac641c57c9ad5 Related: OS#5599 --- M src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h M src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h M src/host/trxcon/src/l1ctl.c M src/host/trxcon/src/trxcon.c M src/host/trxcon/src/trxcon_fsm.c 5 files changed, 33 insertions(+), 14 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h b/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h index 0d55ff1..eb67bee 100644 --- a/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h +++ b/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h @@ -20,6 +20,6 @@ int l1ctl_tx_dt_ind(struct l1ctl_client *l1c, const struct trxcon_param_rx_data_ind *ind); int l1ctl_tx_dt_conf(struct l1ctl_client *l1c, - struct l1ctl_info_dl *data, bool traffic); + const struct trxcon_param_tx_data_cnf *cnf); int l1ctl_tx_rach_conf(struct l1ctl_client *l1c, uint16_t band_arfcn, uint32_t fn); diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h index 9c641df..5af2122 100644 --- a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h +++ b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h @@ -30,6 +30,7 @@ TRXCON_EV_DEDICATED_ESTABLISH_REQ, TRXCON_EV_DEDICATED_RELEASE_REQ, TRXCON_EV_TX_DATA_REQ, + TRXCON_EV_TX_DATA_CNF, TRXCON_EV_RX_DATA_IND, TRXCON_EV_CRYPTO_REQ, }; @@ -91,6 +92,15 @@ const uint8_t *data; }; +/* param of TRXCON_EV_TX_DATA_CNF */ +struct trxcon_param_tx_data_cnf { + bool traffic; + uint8_t chan_nr; + uint8_t link_id; + uint16_t band_arfcn; + uint32_t frame_nr; +}; + /* param of TRXCON_EV_RX_DATA_IND */ struct trxcon_param_rx_data_ind { bool traffic; diff --git a/src/host/trxcon/src/l1ctl.c b/src/host/trxcon/src/l1ctl.c index 7a35d59..b9805eb 100644 --- a/src/host/trxcon/src/l1ctl.c +++ b/src/host/trxcon/src/l1ctl.c @@ -285,8 +285,8 @@ /** * Handles both L1CTL_DATA_CONF and L1CTL_TRAFFIC_CONF. */ -int l1ctl_tx_dt_conf(struct l1ctl_client *l1c, - struct l1ctl_info_dl *data, bool traffic) +int l1ctl_tx_dt_conf(struct l1ctl_client *l1c, bool traffic, + struct trxcon_param_tx_data_cnf *cnf) { struct msgb *msg; @@ -295,8 +295,15 @@ if (msg == NULL) return -ENOMEM; + const struct l1ctl_info_dl dl_hdr = { + .chan_nr = cnf->chan_nr, + .link_id = cnf->link_id, + .frame_nr = htonl(cnf->frame_nr), + .band_arfcn = htons(cnf->band_arfcn), + }; + /* Copy DL frame header from source message */ - put_dl_info_hdr(msg, data); + put_dl_info_hdr(msg, &dl_hdr); return l1ctl_client_send(l1c, msg); } diff --git a/src/host/trxcon/src/trxcon.c b/src/host/trxcon/src/trxcon.c index 039195b..6b5bdb5 100644 --- a/src/host/trxcon/src/trxcon.c +++ b/src/host/trxcon/src/trxcon.c @@ -47,7 +47,6 @@ #include <osmocom/bb/trxcon/logging.h> #include <osmocom/bb/trxcon/l1ctl.h> #include <osmocom/bb/trxcon/l1ctl_server.h> -#include <osmocom/bb/trxcon/l1ctl_proto.h> #include <osmocom/bb/l1sched/l1sched.h> #define COPYRIGHT \ @@ -248,7 +247,6 @@ const struct l1sched_lchan_desc *lchan_desc; struct l1sched_state *sched = lchan->ts->sched; struct trxcon_inst *trxcon = sched->priv; - struct l1ctl_info_dl dl_hdr; const uint8_t *data; uint8_t ra_buf[2]; size_t data_len; @@ -256,22 +254,21 @@ lchan_desc = &l1sched_lchan_desc[lchan->type]; - dl_hdr = (struct l1ctl_info_dl) { + struct trxcon_param_tx_data_cnf cnf = { + /* .traffic is set below */ .chan_nr = lchan_desc->chan_nr | lchan->ts->index, .link_id = lchan_desc->link_id, - .frame_nr = htonl(fn), - .band_arfcn = htons(trxcon->l1p.band_arfcn), + .band_arfcn = trxcon->l1p.band_arfcn, + .frame_nr = fn, }; switch (dt) { case L1SCHED_DT_TRAFFIC: case L1SCHED_DT_PACKET_DATA: - rc = l1ctl_tx_dt_conf(trxcon->l2if, &dl_hdr, true); - data_len = lchan->prim->payload_len; - data = lchan->prim->payload; - break; + cnf.traffic = true; + /* fall-through */ case L1SCHED_DT_SIGNALING: - rc = l1ctl_tx_dt_conf(trxcon->l2if, &dl_hdr, false); + rc = osmo_fsm_inst_dispatch(trxcon->fi, TRXCON_EV_TX_DATA_CNF, &cnf); data_len = lchan->prim->payload_len; data = lchan->prim->payload; break; diff --git a/src/host/trxcon/src/trxcon_fsm.c b/src/host/trxcon/src/trxcon_fsm.c index fb375c4..676c060 100644 --- a/src/host/trxcon/src/trxcon_fsm.c +++ b/src/host/trxcon/src/trxcon_fsm.c @@ -443,6 +443,9 @@ } break; } + case TRXCON_EV_TX_DATA_CNF: + l1ctl_tx_dt_conf(trxcon->l2if, (const struct trxcon_param_tx_data_cnf *)data); + break; case TRXCON_EV_RX_DATA_IND: l1ctl_tx_dt_ind(trxcon->l2if, (const struct trxcon_param_rx_data_ind *)data); break; @@ -549,6 +552,7 @@ | S(TRXCON_EV_TX_ACCESS_BURST_REQ) | S(TRXCON_EV_SET_TCH_MODE_REQ) | S(TRXCON_EV_TX_DATA_REQ) + | S(TRXCON_EV_TX_DATA_CNF) | S(TRXCON_EV_RX_DATA_IND) | S(TRXCON_EV_CRYPTO_REQ), .action = &trxcon_st_dedicated_action, @@ -582,6 +586,7 @@ OSMO_VALUE_STRING(TRXCON_EV_DEDICATED_ESTABLISH_REQ), OSMO_VALUE_STRING(TRXCON_EV_DEDICATED_RELEASE_REQ), OSMO_VALUE_STRING(TRXCON_EV_TX_DATA_REQ), + OSMO_VALUE_STRING(TRXCON_EV_TX_DATA_CNF), OSMO_VALUE_STRING(TRXCON_EV_RX_DATA_IND), OSMO_VALUE_STRING(TRXCON_EV_CRYPTO_REQ), { 0, NULL } 1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/29958 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Ica7a25f0bf8c7f89037a776d711ac641c57c9ad5 Gerrit-Change-Number: 29958 Gerrit-PatchSet: 3 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmocom-bb[master]: trxcon: l1sched_handle_data_cnf(): make the cnf struct scoped
by fixeria 07 Nov '22

07 Nov '22
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/29959 ) Change subject: trxcon: l1sched_handle_data_cnf(): make the cnf struct scoped ...................................................................... trxcon: l1sched_handle_data_cnf(): make the cnf struct scoped Change-Id: I526116c2a20970aee7881e19e283e083bc6b1911 Related: OS#5599 --- M src/host/trxcon/src/trxcon.c 1 file changed, 12 insertions(+), 9 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/host/trxcon/src/trxcon.c b/src/host/trxcon/src/trxcon.c index 6b5bdb5..b6bd56d 100644 --- a/src/host/trxcon/src/trxcon.c +++ b/src/host/trxcon/src/trxcon.c @@ -247,6 +247,7 @@ const struct l1sched_lchan_desc *lchan_desc; struct l1sched_state *sched = lchan->ts->sched; struct trxcon_inst *trxcon = sched->priv; + bool is_traffic = false; const uint8_t *data; uint8_t ra_buf[2]; size_t data_len; @@ -254,24 +255,26 @@ lchan_desc = &l1sched_lchan_desc[lchan->type]; - struct trxcon_param_tx_data_cnf cnf = { - /* .traffic is set below */ - .chan_nr = lchan_desc->chan_nr | lchan->ts->index, - .link_id = lchan_desc->link_id, - .band_arfcn = trxcon->l1p.band_arfcn, - .frame_nr = fn, - }; - switch (dt) { case L1SCHED_DT_TRAFFIC: case L1SCHED_DT_PACKET_DATA: - cnf.traffic = true; + is_traffic = true; /* fall-through */ case L1SCHED_DT_SIGNALING: + { + struct trxcon_param_tx_data_cnf cnf = { + .traffic = is_traffic, + .chan_nr = lchan_desc->chan_nr | lchan->ts->index, + .link_id = lchan_desc->link_id, + .band_arfcn = trxcon->l1p.band_arfcn, + .frame_nr = fn, + }; + rc = osmo_fsm_inst_dispatch(trxcon->fi, TRXCON_EV_TX_DATA_CNF, &cnf); data_len = lchan->prim->payload_len; data = lchan->prim->payload; break; + } case L1SCHED_DT_OTHER: if (L1SCHED_PRIM_IS_RACH(lchan->prim)) { const struct l1sched_ts_prim_rach *rach; 1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/29959 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I526116c2a20970aee7881e19e283e083bc6b1911 Gerrit-Change-Number: 29959 Gerrit-PatchSet: 3 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmocom-bb[master]: trxcon: compose struct l1ctl_info_dl in l1ctl_tx_dt_ind()
by fixeria 07 Nov '22

07 Nov '22
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/29956 ) Change subject: trxcon: compose struct l1ctl_info_dl in l1ctl_tx_dt_ind() ...................................................................... trxcon: compose struct l1ctl_info_dl in l1ctl_tx_dt_ind() The trxcon_fsm should not be dealing with the L1CTL protocol, so let's better hand over the trxcon_param_rx_traffic_data_ind to l1ctl_tx_dt_ind() and compose the l1ctl_info_dl there. Change-Id: Ie57d86ffd9ea7c44187aafba0df1f519d1c523fb Related: OS#5599 --- M src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h M src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h M src/host/trxcon/src/l1ctl.c M src/host/trxcon/src/trxcon.c M src/host/trxcon/src/trxcon_fsm.c 5 files changed, 22 insertions(+), 41 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h b/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h index 9518bb9..70d804f 100644 --- a/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h +++ b/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h @@ -17,10 +17,8 @@ int l1ctl_tx_reset_conf(struct l1ctl_client *l1c, uint8_t type); int l1ctl_tx_reset_ind(struct l1ctl_client *l1c, uint8_t type); -int l1ctl_tx_dt_ind(struct l1ctl_client *l1c, - const struct l1ctl_info_dl *dl_info, - const uint8_t *l2, size_t l2_len, - bool traffic); +int l1ctl_tx_dt_ind(struct l1ctl_client *l1c, bool traffic, + const struct trxcon_param_rx_traffic_data_ind *ind); int l1ctl_tx_dt_conf(struct l1ctl_client *l1c, struct l1ctl_info_dl *data, bool traffic); int l1ctl_tx_rach_conf(struct l1ctl_client *l1c, diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h index 9aa5e55..37e3f14 100644 --- a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h +++ b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h @@ -96,6 +96,7 @@ struct trxcon_param_rx_traffic_data_ind { uint8_t chan_nr; uint8_t link_id; + uint16_t band_arfcn; uint32_t frame_nr; int16_t toa256; int8_t rssi; diff --git a/src/host/trxcon/src/l1ctl.c b/src/host/trxcon/src/l1ctl.c index 87bfe74..5baac1f 100644 --- a/src/host/trxcon/src/l1ctl.c +++ b/src/host/trxcon/src/l1ctl.c @@ -232,26 +232,32 @@ /** * Handles both L1CTL_DATA_IND and L1CTL_TRAFFIC_IND. */ -int l1ctl_tx_dt_ind(struct l1ctl_client *l1c, - const struct l1ctl_info_dl *dl_info, - const uint8_t *l2, size_t l2_len, - bool traffic) +int l1ctl_tx_dt_ind(struct l1ctl_client *l1c, bool traffic, + const struct trxcon_param_rx_traffic_data_ind *ind) { struct msgb *msg; - uint8_t *msg_l2; msg = l1ctl_alloc_msg(traffic ? L1CTL_TRAFFIC_IND : L1CTL_DATA_IND); if (msg == NULL) return -ENOMEM; - put_dl_info_hdr(msg, dl_info); + const struct l1ctl_info_dl dl_hdr = { + .chan_nr = ind->chan_nr, + .link_id = ind->link_id, + .frame_nr = htonl(ind->frame_nr), + .band_arfcn = htons(ind->band_arfcn), + .fire_crc = ind->data_len > 0 ? 0 : 2, + .rx_level = dbm2rxlev(ind->rssi), + .num_biterr = ind->n_errors, + /* TODO: set proper .snr */ + }; + + put_dl_info_hdr(msg, &dl_hdr); /* Copy the L2 payload if preset */ - if (l2 && l2_len > 0) { - msg_l2 = (uint8_t *) msgb_put(msg, l2_len); - memcpy(msg_l2, l2, l2_len); - } + if (ind->data && ind->data_len > 0) + memcpy(msgb_put(msg, ind->data_len), ind->data, ind->data_len); /* Put message to upper layers */ return l1ctl_client_send(l1c, msg); diff --git a/src/host/trxcon/src/trxcon.c b/src/host/trxcon/src/trxcon.c index 764f717..0bbb602 100644 --- a/src/host/trxcon/src/trxcon.c +++ b/src/host/trxcon/src/trxcon.c @@ -200,6 +200,7 @@ struct trxcon_param_rx_traffic_data_ind ind = { .chan_nr = lchan_desc->chan_nr | lchan->ts->index, .link_id = lchan_desc->link_id, + .band_arfcn = trxcon->l1p.band_arfcn, .frame_nr = meas->fn, .toa256 = meas->toa256, .rssi = meas->rssi, diff --git a/src/host/trxcon/src/trxcon_fsm.c b/src/host/trxcon/src/trxcon_fsm.c index 58a749e..0e005a3 100644 --- a/src/host/trxcon/src/trxcon_fsm.c +++ b/src/host/trxcon/src/trxcon_fsm.c @@ -23,8 +23,6 @@ #include <string.h> #include <errno.h> -#include <arpa/inet.h> - #include <osmocom/core/fsm.h> #include <osmocom/core/msgb.h> #include <osmocom/core/talloc.h> @@ -34,7 +32,6 @@ #include <osmocom/bb/trxcon/logging.h> #include <osmocom/bb/trxcon/l1ctl.h> #include <osmocom/bb/trxcon/l1ctl_server.h> -#include <osmocom/bb/trxcon/l1ctl_proto.h> #include <osmocom/bb/l1sched/l1sched.h> #include <osmocom/bb/l1sched/logging.h> @@ -345,18 +342,8 @@ case TRXCON_EV_RX_DATA_IND: { const struct trxcon_param_rx_traffic_data_ind *ind = data; - const struct l1ctl_info_dl dl_hdr = { - .chan_nr = ind->chan_nr, - .link_id = ind->link_id, - .frame_nr = htonl(ind->frame_nr), - .band_arfcn = htons(trxcon->l1p.band_arfcn), - .fire_crc = ind->data_len > 0 ? 0 : 2, - .rx_level = dbm2rxlev(ind->rssi), - .num_biterr = ind->n_errors, - /* TODO: set proper .snr */ - }; - l1ctl_tx_dt_ind(trxcon->l2if, &dl_hdr, ind->data, ind->data_len, false); + l1ctl_tx_dt_ind(trxcon->l2if, false, ind); break; } default: @@ -465,20 +452,8 @@ case TRXCON_EV_RX_DATA_IND: { const struct trxcon_param_rx_traffic_data_ind *ind = data; - const struct l1ctl_info_dl dl_hdr = { - .chan_nr = ind->chan_nr, - .link_id = ind->link_id, - .frame_nr = htonl(ind->frame_nr), - .band_arfcn = htons(trxcon->l1p.band_arfcn), - .fire_crc = ind->data_len > 0 ? 0 : 2, - .rx_level = dbm2rxlev(ind->rssi), - .num_biterr = ind->n_errors, - /* TODO: set proper .snr */ - }; - l1ctl_tx_dt_ind(trxcon->l2if, &dl_hdr, - ind->data, ind->data_len, - event == TRXCON_EV_RX_TRAFFIC_IND); + l1ctl_tx_dt_ind(trxcon->l2if, event == TRXCON_EV_RX_TRAFFIC_IND, ind); break; } default: 1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/29956 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Ie57d86ffd9ea7c44187aafba0df1f519d1c523fb Gerrit-Change-Number: 29956 Gerrit-PatchSet: 3 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • ...
  • 251
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.