Nrf modem library notes

From Wiki at Neela Nurseries
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Friday 9/10 we were looking into Nordic nRF modem library files, as these are a part of pretty much all radio and LTE modem based Nordic sample apps. A first file of interest is:

 vi /home/cpguest/embedded/ncs/v1.6.1/nrf/lib/nrf_modem_lib/nrf_modem_lib.c
  1 /*
  2  * Copyright (c) 2019 Nordic Semiconductor ASA
  3  *
  4  * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
  5  */
  6
  7 #include <init.h>
  8 #include <device.h>
  9 #include <zephyr.h>
 10 #include <zephyr/types.h>
 11 #include <nrfx_ipc.h>
 12 #include <nrf_modem.h>
 13 #include <nrf_modem_platform.h>
 14 #include <pm_config.h>
 15
 16 #ifdef CONFIG_LTE_LINK_CONTROL
 17 #include <modem/lte_lc.h>
 18 #endif
 19
 20 #ifndef CONFIG_TRUSTED_EXECUTION_NONSECURE
 21 #error  nrf_modem_lib must be run as non-secure firmware.\
 22         Are you building for the correct board ?
 23 #endif
 24
 25 struct shutdown_thread {
 26         sys_snode_t node;
 27         struct k_sem sem;
 28 };
 29
 30 static sys_slist_t shutdown_threads;
 31 static bool first_time_init;
 32 static struct k_mutex slist_mutex;
 33
 34 static int init_ret;
 35
 36 static const nrf_modem_init_params_t init_params = {
 37         .ipc_irq_prio = NRF_MODEM_NETWORK_IRQ_PRIORITY,
 38         .shmem.ctrl = {
 39                 .base = PM_NRF_MODEM_LIB_CTRL_ADDRESS,
 40                 .size = CONFIG_NRF_MODEM_LIB_SHMEM_CTRL_SIZE,
 41         },
 42         .shmem.tx = {
 43                 .base = PM_NRF_MODEM_LIB_TX_ADDRESS,
 44                 .size = CONFIG_NRF_MODEM_LIB_SHMEM_TX_SIZE,
 45         },
 46         .shmem.rx = {
 47                 .base = PM_NRF_MODEM_LIB_RX_ADDRESS,
 48                 .size = CONFIG_NRF_MODEM_LIB_SHMEM_RX_SIZE,
 49         },
 50 #if CONFIG_NRF_MODEM_LIB_TRACE_ENABLED
 51         .shmem.trace = {
 52                 .base = PM_NRF_MODEM_LIB_TRACE_ADDRESS,
 53                 .size = CONFIG_NRF_MODEM_LIB_SHMEM_TRACE_SIZE,
 54         },
 55 #endif
 56 };

  .
  .
  .