From c8050e2a830100ec4fc0d8648840c85ebb432e5b Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 24 May 2024 13:32:05 +0200 Subject: [PATCH] samples: net: Remove deprecated gsm_modem sample The gsm_modem driver is deprecated, and will be removed. Remove the gsm modem sample which depends on the deprecated driver. Signed-off-by: Bjarki Arge Andreasen --- samples/net/gsm_modem/CMakeLists.txt | 8 -- samples/net/gsm_modem/README.rst | 40 ------ .../net/gsm_modem/boards/b_u585i_iot02a.conf | 12 -- .../gsm_modem/boards/b_u585i_iot02a.overlay | 37 ----- .../gsm_modem/boards/frdm_uart2_dts.overlay | 12 -- samples/net/gsm_modem/prj.conf | 35 ----- samples/net/gsm_modem/sample.yaml | 22 --- samples/net/gsm_modem/src/main.c | 130 ------------------ 8 files changed, 296 deletions(-) delete mode 100644 samples/net/gsm_modem/CMakeLists.txt delete mode 100644 samples/net/gsm_modem/README.rst delete mode 100644 samples/net/gsm_modem/boards/b_u585i_iot02a.conf delete mode 100644 samples/net/gsm_modem/boards/b_u585i_iot02a.overlay delete mode 100644 samples/net/gsm_modem/boards/frdm_uart2_dts.overlay delete mode 100644 samples/net/gsm_modem/prj.conf delete mode 100644 samples/net/gsm_modem/sample.yaml delete mode 100644 samples/net/gsm_modem/src/main.c diff --git a/samples/net/gsm_modem/CMakeLists.txt b/samples/net/gsm_modem/CMakeLists.txt deleted file mode 100644 index b32fe0e5b20..00000000000 --- a/samples/net/gsm_modem/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(gsm_modem) - -target_sources(app PRIVATE src/main.c) diff --git a/samples/net/gsm_modem/README.rst b/samples/net/gsm_modem/README.rst deleted file mode 100644 index 2021b0e0554..00000000000 --- a/samples/net/gsm_modem/README.rst +++ /dev/null @@ -1,40 +0,0 @@ -.. zephyr:code-sample:: gsm-modem - :name: Generic GSM modem - - Use a GSM modem to connect to a GPRS network. - -Overview -******** - -The Zephyr GSM modem sample application allows user to have a connection -to GPRS network. The connection to GSM modem is done using -:ref:`PPP (Point-to-Point Protocol) `. - -The source code of this sample application can be found at: -:zephyr_file:`samples/net/gsm_modem`. - -Requirements -************ - -- GSM modem card. The sample has been tested with SIMCOM SIM808 card. All - GSM modem cards should work as long as they support **AT+CGDCONT** command. -- Almost any Zephyr enabled board with sufficient resources can be used. - The sample has been tested with :ref:`reel_board`. - -Build and Running -***************** - -If you are using an external modem like the SIMCOM card, then connect -the necessary pins like RX and TX from your Zephyr target board to the -modem card. Internal modems, like what is found in :ref:`particle_boron` -board, are not yet supported. - -.. zephyr-app-commands:: - :zephyr-app: samples/net/gsm_modem - :board: reel_board - :goals: build flash - :gen-args: -DCONFIG_MODEM_GSM_APN=\"internet\" - :compact: - -Note that you might need to change the APN name according to your GSM network -configuration. diff --git a/samples/net/gsm_modem/boards/b_u585i_iot02a.conf b/samples/net/gsm_modem/boards/b_u585i_iot02a.conf deleted file mode 100644 index c344244d206..00000000000 --- a/samples/net/gsm_modem/boards/b_u585i_iot02a.conf +++ /dev/null @@ -1,12 +0,0 @@ -CONFIG_TEST_RANDOM_GENERATOR=y -CONFIG_GSM_MUX=y -CONFIG_UART_MUX=y -CONFIG_MODEM_GSM_APN="internet" -CONFIG_MAIN_STACK_SIZE=8192 -CONFIG_MODEM_GSM_QUECTEL=y -CONFIG_MODEM_SHELL=n -CONFIG_NET_MGMT_EVENT_INFO=y -CONFIG_NET_MGMT_EVENT_MONITOR=y -CONFIG_NET_MGMT_EVENT_MONITOR_AUTO_START=y -CONFIG_NET_LOG=y -CONFIG_NET_MGMT_EVENT_LOG_LEVEL_DBG=y diff --git a/samples/net/gsm_modem/boards/b_u585i_iot02a.overlay b/samples/net/gsm_modem/boards/b_u585i_iot02a.overlay deleted file mode 100644 index f8d862f4737..00000000000 --- a/samples/net/gsm_modem/boards/b_u585i_iot02a.overlay +++ /dev/null @@ -1,37 +0,0 @@ -/ { - aliases { - modem-uart = &usart2; - modem = &modem; - }; -}; - -&gpioh { - misc_fixed_usart2 { - gpio-hog; - gpios = <13 GPIO_ACTIVE_HIGH>; - output-high; - }; -}; - -&gpdma1 { - status = "okay"; -}; - -/* BG95 */ -&usart2 { - pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3 &usart2_rts_pa1 &usart2_cts_pa0>; - pinctrl-names = "default"; - current-speed = <115200>; - hw-flow-control; - - dmas = <&gpdma1 0 27 STM32_DMA_PERIPH_TX - &gpdma1 1 26 STM32_DMA_PERIPH_RX>; - dma-names = "tx", "rx"; - - status = "okay"; - - modem: modem { - compatible = "zephyr,gsm-ppp"; - status = "okay"; - }; -}; diff --git a/samples/net/gsm_modem/boards/frdm_uart2_dts.overlay b/samples/net/gsm_modem/boards/frdm_uart2_dts.overlay deleted file mode 100644 index 55c6e86f74d..00000000000 --- a/samples/net/gsm_modem/boards/frdm_uart2_dts.overlay +++ /dev/null @@ -1,12 +0,0 @@ -/* - * UART 2 is configured on FRDM pins PTD0, rts; PTD1, cts; PTD2, rx; PTD3, tx - * see https://www.nxp.com/docs/en/data-sheet/K64P144M120SF5.pdf chapter 5.1, - * page 74 - */ -&uart2 { - status = "okay"; - current-speed = <115200>; - gsm: gsm-modem { - compatible = "zephyr,gsm-ppp"; - }; -}; diff --git a/samples/net/gsm_modem/prj.conf b/samples/net/gsm_modem/prj.conf deleted file mode 100644 index c9494495d6a..00000000000 --- a/samples/net/gsm_modem/prj.conf +++ /dev/null @@ -1,35 +0,0 @@ -# UART support -CONFIG_SERIAL=y - -# GSM modem support -CONFIG_MODEM=y -CONFIG_MODEM_GSM_PPP=y - -# PPP networking support -CONFIG_NET_DRIVERS=y -CONFIG_NET_PPP=y -CONFIG_NET_L2_PPP=y -CONFIG_NET_NATIVE=y -CONFIG_NETWORKING=y - -CONFIG_NET_L2_PPP_TIMEOUT=10000 - -# IPv4 enables PPP IPCP support -CONFIG_NET_IPV4=y -CONFIG_NET_IPV6=n - -# Network management events -CONFIG_NET_CONNECTION_MANAGER=y - -# Log buffers, modem and PPP -CONFIG_LOG=y -CONFIG_NET_LOG=y -#CONFIG_LOG_BUFFER_SIZE=16384 -#CONFIG_MODEM_LOG_LEVEL_DBG=y -#CONFIG_NET_PPP_LOG_LEVEL_DBG=y -#CONFIG_NET_L2_PPP_LOG_LEVEL_DBG=y -#CONFIG_NET_MGMT_EVENT_LOG_LEVEL_DBG=y -#CONFIG_NET_CONNECTION_MANAGER_LOG_LEVEL_DBG=y - -CONFIG_NET_SHELL=y -CONFIG_MODEM_SHELL=y diff --git a/samples/net/gsm_modem/sample.yaml b/samples/net/gsm_modem/sample.yaml deleted file mode 100644 index bb5c3d47354..00000000000 --- a/samples/net/gsm_modem/sample.yaml +++ /dev/null @@ -1,22 +0,0 @@ -common: - harness: net - depends_on: serial-net - tags: - - net - - ppp - - modem - - gsm - platform_allow: frdm_k64f - extra_args: DTC_OVERLAY_FILE="boards/frdm_uart2_dts.overlay" -sample: - description: Sample for generic GSM modem - name: Generic GSM modem using PPP -tests: - sample.net.ppp.gsm.modem: - extra_configs: - - CONFIG_TEST_RANDOM_GENERATOR=y - sample.net.ppp.gsm.modem.mux: - extra_configs: - - CONFIG_TEST_RANDOM_GENERATOR=y - - CONFIG_GSM_MUX=y - - CONFIG_UART_MUX=y diff --git a/samples/net/gsm_modem/src/main.c b/samples/net/gsm_modem/src/main.c deleted file mode 100644 index 522a8c66606..00000000000 --- a/samples/net/gsm_modem/src/main.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2020, Intel Corporation - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -LOG_MODULE_REGISTER(sample_gsm_ppp, LOG_LEVEL_DBG); - -#define GSM_MODEM_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(zephyr_gsm_ppp) -#define UART_NODE DT_BUS(GSM_MODEM_NODE) - -static const struct device *const gsm_dev = DEVICE_DT_GET(GSM_MODEM_NODE); -static struct net_mgmt_event_callback mgmt_cb; -static bool starting = IS_ENABLED(CONFIG_GSM_PPP_AUTOSTART); - -static int cmd_sample_modem_suspend(const struct shell *sh, - size_t argc, char *argv[]) -{ - ARG_UNUSED(argc); - ARG_UNUSED(argv); - - if (!starting) { - shell_fprintf(sh, SHELL_NORMAL, "Modem is already stopped.\n"); - return -ENOEXEC; - } - - gsm_ppp_stop(gsm_dev); - starting = false; - - return 0; -} - -static int cmd_sample_modem_resume(const struct shell *sh, - size_t argc, char *argv[]) -{ - ARG_UNUSED(argc); - ARG_UNUSED(argv); - - if (starting) { - shell_fprintf(sh, SHELL_NORMAL, "Modem is already started.\n"); - return -ENOEXEC; - } - - gsm_ppp_start(gsm_dev); - starting = true; - - return 0; -} - -SHELL_STATIC_SUBCMD_SET_CREATE(sample_commands, - SHELL_CMD(resume, NULL, - "Resume the modem\n", - cmd_sample_modem_resume), - SHELL_CMD(suspend, NULL, - "Suspend the modem\n", - cmd_sample_modem_suspend), - SHELL_SUBCMD_SET_END -); - -SHELL_CMD_REGISTER(sample, &sample_commands, - "Sample application commands", NULL); - - -static void event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) -{ - ARG_UNUSED(cb); - ARG_UNUSED(iface); - - if ((mgmt_event & (NET_EVENT_L4_CONNECTED - | NET_EVENT_L4_DISCONNECTED)) != mgmt_event) { - return; - } - - if (mgmt_event == NET_EVENT_L4_CONNECTED) { - LOG_INF("Network connected"); - return; - } - - if (mgmt_event == NET_EVENT_L4_DISCONNECTED) { - LOG_INF("Network disconnected"); - return; - } -} - -static void modem_on_cb(const struct device *dev, void *user_data) -{ - ARG_UNUSED(dev); - ARG_UNUSED(user_data); - - LOG_INF("GSM modem on callback fired"); -} - -static void modem_off_cb(const struct device *dev, void *user_data) -{ - ARG_UNUSED(dev); - ARG_UNUSED(user_data); - - LOG_INF("GSM modem off callback fired"); -} - -int main(void) -{ - const struct device *const uart_dev = DEVICE_DT_GET(UART_NODE); - - /* Optional register modem power callbacks */ - gsm_ppp_register_modem_power_callback(gsm_dev, modem_on_cb, modem_off_cb, NULL); - - LOG_INF("Board '%s' APN '%s' UART '%s' device %p (%s)", - CONFIG_BOARD, CONFIG_MODEM_GSM_APN, - uart_dev->name, uart_dev, gsm_dev->name); - - net_mgmt_init_event_callback(&mgmt_cb, event_handler, - NET_EVENT_L4_CONNECTED | - NET_EVENT_L4_DISCONNECTED); - net_mgmt_add_event_callback(&mgmt_cb); - - return 0; -}