modem: drivers: add user pipes to cellular modem driver

Add two DLCI channels to the cellular modem driver, and expose
them using the modem pipelink module.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
This commit is contained in:
Bjarki Arge Andreasen 2024-05-23 20:13:23 +02:00 committed by Maureen Helm
parent 03596feda1
commit e878024a3d
2 changed files with 329 additions and 1 deletions

View file

@ -8,6 +8,7 @@ config MODEM_CELLULAR
select MODEM_CMUX
select MODEM_CHAT
select MODEM_PIPE
select MODEM_PIPELINK
select MODEM_BACKEND_UART
select RING_BUFFER
select NET_L2_PPP_OPTION_MRU
@ -50,4 +51,8 @@ config MODEM_CELLULAR_CHAT_BUFFER_SIZES
int "The size of the buffers used for the chat scripts in bytes."
default 128
config MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES
int "The size of the buffers used for each user pipe in bytes."
default 128
endif

View file

@ -11,6 +11,7 @@
#include <zephyr/modem/chat.h>
#include <zephyr/modem/cmux.h>
#include <zephyr/modem/pipe.h>
#include <zephyr/modem/pipelink.h>
#include <zephyr/modem/ppp.h>
#include <zephyr/modem/backend/uart.h>
#include <zephyr/net/ppp.h>
@ -33,6 +34,8 @@ LOG_MODULE_REGISTER(modem_cellular, CONFIG_MODEM_LOG_LEVEL);
#define MODEM_CELLULAR_DATA_MANUFACTURER_LEN (65)
#define MODEM_CELLULAR_DATA_FW_VERSION_LEN (65)
#define MODEM_CELLULAR_RESERVED_DLCIS (2)
/* Magic constants */
#define CSQ_RSSI_UNKNOWN (99)
#define CESQ_RSRP_UNKNOWN (255)
@ -86,6 +89,7 @@ struct modem_cellular_data {
struct modem_cmux cmux;
uint8_t cmux_receive_buf[CONFIG_MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE];
uint8_t cmux_transmit_buf[2 * CONFIG_MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE];
struct modem_cmux_dlci dlci1;
struct modem_cmux_dlci dlci2;
struct modem_pipe *dlci1_pipe;
@ -132,6 +136,15 @@ struct modem_cellular_data {
struct k_mutex event_rb_lock;
};
struct modem_cellular_user_pipe {
struct modem_cmux_dlci dlci;
uint8_t dlci_address;
uint8_t *dlci_receive_buf;
uint16_t dlci_receive_buf_size;
struct modem_pipe *pipe;
struct modem_pipelink *pipelink;
};
struct modem_cellular_config {
const struct device *uart;
struct gpio_dt_spec power_gpio;
@ -144,6 +157,8 @@ struct modem_cellular_config {
const struct modem_chat_script *init_chat_script;
const struct modem_chat_script *dial_chat_script;
const struct modem_chat_script *periodic_chat_script;
struct modem_cellular_user_pipe *user_pipes;
uint8_t user_pipes_size;
};
static const char *modem_cellular_state_str(enum modem_cellular_state state)
@ -219,6 +234,34 @@ static bool modem_cellular_gpio_is_enabled(const struct gpio_dt_spec *gpio)
return gpio->port != NULL;
}
static void modem_cellular_notify_user_pipes_connected(struct modem_cellular_data *data)
{
const struct modem_cellular_config *config =
(const struct modem_cellular_config *)data->dev->config;
struct modem_cellular_user_pipe *user_pipe;
struct modem_pipelink *pipelink;
for (uint8_t i = 0; i < config->user_pipes_size; i++) {
user_pipe = &config->user_pipes[i];
pipelink = user_pipe->pipelink;
modem_pipelink_notify_connected(pipelink);
}
}
static void modem_cellular_notify_user_pipes_disconnected(struct modem_cellular_data *data)
{
const struct modem_cellular_config *config =
(const struct modem_cellular_config *)data->dev->config;
struct modem_cellular_user_pipe *user_pipe;
struct modem_pipelink *pipelink;
for (uint8_t i = 0; i < config->user_pipes_size; i++) {
user_pipe = &config->user_pipes[i];
pipelink = user_pipe->pipelink;
modem_pipelink_notify_disconnected(pipelink);
}
}
static void modem_cellular_enter_state(struct modem_cellular_data *data,
enum modem_cellular_state state);
@ -530,6 +573,7 @@ static int modem_cellular_on_idle_state_enter(struct modem_cellular_data *data)
gpio_pin_set_dt(&config->reset_gpio, 1);
}
modem_cellular_notify_user_pipes_disconnected(data);
modem_chat_release(&data->chat);
modem_ppp_release(data->ppp);
modem_cmux_release(&data->cmux);
@ -766,6 +810,7 @@ static void modem_cellular_connect_cmux_event_handler(struct modem_cellular_data
break;
case MODEM_CELLULAR_EVENT_CMUX_CONNECTED:
modem_cellular_notify_user_pipes_connected(data);
modem_cellular_enter_state(data, MODEM_CELLULAR_STATE_OPEN_DLCI1);
break;
@ -994,6 +1039,7 @@ static void modem_cellular_init_power_off_event_handler(struct modem_cellular_da
static int modem_cellular_on_init_power_off_state_leave(struct modem_cellular_data *data)
{
modem_cellular_notify_user_pipes_disconnected(data);
modem_chat_release(&data->chat);
modem_ppp_release(data->ppp);
return 0;
@ -1560,6 +1606,20 @@ static int modem_cellular_init(const struct device *dev)
&dlci2_config);
}
for (uint8_t i = 0; i < config->user_pipes_size; i++) {
struct modem_cellular_user_pipe *user_pipe = &config->user_pipes[i];
const struct modem_cmux_dlci_config user_dlci_config = {
.dlci_address = user_pipe->dlci_address,
.receive_buf = user_pipe->dlci_receive_buf,
.receive_buf_size = user_pipe->dlci_receive_buf_size,
};
user_pipe->pipe = modem_cmux_dlci_init(&data->cmux, &user_pipe->dlci,
&user_dlci_config);
modem_pipelink_init(user_pipe->pipelink, user_pipe->pipe);
}
{
const struct modem_chat_config chat_config = {
.user_data = data,
@ -2027,7 +2087,27 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script,
#endif
#define MODEM_CELLULAR_INST_NAME(name, inst) \
_CONCAT(_CONCAT(_CONCAT(name, _), DT_DRV_COMPAT), inst)
_CONCAT_4(name, _, DT_DRV_COMPAT, inst)
#define MODEM_CELLULAR_DEFINE_USER_PIPE_DATA(inst, name, size) \
MODEM_PIPELINK_DT_INST_DEFINE(inst, name); \
static uint8_t MODEM_CELLULAR_INST_NAME(name, inst)[size] \
#define MODEM_CELLULAR_INIT_USER_PIPE(_inst, _name, _dlci_address) \
{ \
.dlci_address = _dlci_address, \
.dlci_receive_buf = MODEM_CELLULAR_INST_NAME(_name, _inst), \
.dlci_receive_buf_size = sizeof(MODEM_CELLULAR_INST_NAME(_name, _inst)), \
.pipelink = MODEM_PIPELINK_DT_INST_GET(_inst, _name), \
}
#define MODEM_CELLULAR_DEFINE_USER_PIPES(inst, ...) \
static struct modem_cellular_user_pipe MODEM_CELLULAR_INST_NAME(user_pipes, inst)[] = { \
__VA_ARGS__ \
}
#define MODEM_CELLULAR_GET_USER_PIPES(inst) \
MODEM_CELLULAR_INST_NAME(user_pipes, inst)
#define MODEM_CELLULAR_DEVICE_QUECTEL_BG95(inst) \
MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \
@ -2038,6 +2118,31 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script,
.ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \
}; \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
gnss_pipe, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
user_pipe_0, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
user_pipe_1, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPES( \
inst, \
MODEM_CELLULAR_INIT_USER_PIPE(inst, gnss_pipe, 3), \
MODEM_CELLULAR_INIT_USER_PIPE(inst, user_pipe_0, 4), \
MODEM_CELLULAR_INIT_USER_PIPE(inst, user_pipe_1, 5), \
); \
\
static const struct modem_cellular_config MODEM_CELLULAR_INST_NAME(config, inst) = { \
.uart = DEVICE_DT_GET(DT_INST_BUS(inst)), \
.power_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_power_gpios, {}), \
@ -2049,6 +2154,8 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script,
.init_chat_script = &quectel_bg95_init_chat_script, \
.dial_chat_script = &quectel_bg95_dial_chat_script, \
.periodic_chat_script = &_CONCAT(DT_DRV_COMPAT, _periodic_chat_script), \
.user_pipes = MODEM_CELLULAR_GET_USER_PIPES(inst), \
.user_pipes_size = ARRAY_SIZE(MODEM_CELLULAR_GET_USER_PIPES(inst)), \
}; \
\
PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \
@ -2067,6 +2174,31 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script,
.ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \
}; \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
gnss_pipe, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
user_pipe_0, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
user_pipe_1, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPES( \
inst, \
MODEM_CELLULAR_INIT_USER_PIPE(inst, gnss_pipe, 3), \
MODEM_CELLULAR_INIT_USER_PIPE(inst, user_pipe_0, 4), \
MODEM_CELLULAR_INIT_USER_PIPE(inst, user_pipe_1, 5), \
); \
\
static const struct modem_cellular_config MODEM_CELLULAR_INST_NAME(config, inst) = { \
.uart = DEVICE_DT_GET(DT_INST_BUS(inst)), \
.power_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_power_gpios, {}), \
@ -2078,6 +2210,8 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script,
.init_chat_script = &quectel_eg25_g_init_chat_script, \
.dial_chat_script = &quectel_eg25_g_dial_chat_script, \
.periodic_chat_script = &_CONCAT(DT_DRV_COMPAT, _periodic_chat_script), \
.user_pipes = MODEM_CELLULAR_GET_USER_PIPES(inst), \
.user_pipes_size = ARRAY_SIZE(MODEM_CELLULAR_GET_USER_PIPES(inst)), \
}; \
\
PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \
@ -2096,6 +2230,31 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script,
.ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \
}; \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
gnss_pipe, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
user_pipe_0, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
user_pipe_1, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPES( \
inst, \
MODEM_CELLULAR_INIT_USER_PIPE(inst, gnss_pipe, 3), \
MODEM_CELLULAR_INIT_USER_PIPE(inst, user_pipe_0, 4), \
MODEM_CELLULAR_INIT_USER_PIPE(inst, user_pipe_1, 5), \
); \
\
static const struct modem_cellular_config MODEM_CELLULAR_INST_NAME(config, inst) = { \
.uart = DEVICE_DT_GET(DT_INST_BUS(inst)), \
.power_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_power_gpios, {}), \
@ -2107,6 +2266,8 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script,
.init_chat_script = &simcom_sim7080_init_chat_script, \
.dial_chat_script = &simcom_sim7080_dial_chat_script, \
.periodic_chat_script = &simcom_sim7080_periodic_chat_script, \
.user_pipes = MODEM_CELLULAR_GET_USER_PIPES(inst), \
.user_pipes_size = ARRAY_SIZE(MODEM_CELLULAR_GET_USER_PIPES(inst)), \
}; \
\
PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \
@ -2125,6 +2286,31 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script,
.ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \
}; \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
gnss_pipe, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
user_pipe_0, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
user_pipe_1, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPES( \
inst, \
MODEM_CELLULAR_INIT_USER_PIPE(inst, gnss_pipe, 3), \
MODEM_CELLULAR_INIT_USER_PIPE(inst, user_pipe_0, 4), \
MODEM_CELLULAR_INIT_USER_PIPE(inst, user_pipe_1, 5), \
); \
\
static const struct modem_cellular_config MODEM_CELLULAR_INST_NAME(config, inst) = { \
.uart = DEVICE_DT_GET(DT_INST_BUS(inst)), \
.power_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_power_gpios, {}), \
@ -2136,6 +2322,8 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script,
.init_chat_script = &u_blox_sara_r4_init_chat_script, \
.dial_chat_script = &u_blox_sara_r4_dial_chat_script, \
.periodic_chat_script = &u_blox_sara_r4_periodic_chat_script, \
.user_pipes = MODEM_CELLULAR_GET_USER_PIPES(inst), \
.user_pipes_size = ARRAY_SIZE(MODEM_CELLULAR_GET_USER_PIPES(inst)), \
}; \
\
PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \
@ -2154,6 +2342,31 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script,
.ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \
}; \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
gnss_pipe, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
user_pipe_0, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
user_pipe_1, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPES( \
inst, \
MODEM_CELLULAR_INIT_USER_PIPE(inst, gnss_pipe, 3), \
MODEM_CELLULAR_INIT_USER_PIPE(inst, user_pipe_0, 4), \
MODEM_CELLULAR_INIT_USER_PIPE(inst, user_pipe_1, 5), \
); \
\
static const struct modem_cellular_config MODEM_CELLULAR_INST_NAME(config, inst) = { \
.uart = DEVICE_DT_GET(DT_INST_BUS(inst)), \
.power_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_power_gpios, {}), \
@ -2166,6 +2379,8 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script,
.init_chat_script = &u_blox_sara_r5_init_chat_script, \
.dial_chat_script = &u_blox_sara_r5_dial_chat_script, \
.periodic_chat_script = &u_blox_sara_r5_periodic_chat_script, \
.user_pipes = MODEM_CELLULAR_GET_USER_PIPES(inst), \
.user_pipes_size = ARRAY_SIZE(MODEM_CELLULAR_GET_USER_PIPES(inst)), \
}; \
\
PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \
@ -2184,6 +2399,31 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script,
.ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \
}; \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
gnss_pipe, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
user_pipe_0, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
user_pipe_1, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPES( \
inst, \
MODEM_CELLULAR_INIT_USER_PIPE(inst, gnss_pipe, 3), \
MODEM_CELLULAR_INIT_USER_PIPE(inst, user_pipe_0, 4), \
MODEM_CELLULAR_INIT_USER_PIPE(inst, user_pipe_1, 5), \
); \
\
static const struct modem_cellular_config MODEM_CELLULAR_INST_NAME(config, inst) = { \
.uart = DEVICE_DT_GET(DT_INST_BUS(inst)), \
.power_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_power_gpios, {}), \
@ -2195,6 +2435,8 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script,
.init_chat_script = &swir_hl7800_init_chat_script, \
.dial_chat_script = &swir_hl7800_dial_chat_script, \
.periodic_chat_script = &swir_hl7800_periodic_chat_script, \
.user_pipes = MODEM_CELLULAR_GET_USER_PIPES(inst), \
.user_pipes_size = ARRAY_SIZE(MODEM_CELLULAR_GET_USER_PIPES(inst)), \
}; \
\
PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \
@ -2213,6 +2455,31 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script,
.ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \
}; \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
gnss_pipe, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
user_pipe_0, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
user_pipe_1, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPES( \
inst, \
MODEM_CELLULAR_INIT_USER_PIPE(inst, gnss_pipe, 3), \
MODEM_CELLULAR_INIT_USER_PIPE(inst, user_pipe_0, 4), \
MODEM_CELLULAR_INIT_USER_PIPE(inst, user_pipe_1, 5), \
); \
\
static const struct modem_cellular_config MODEM_CELLULAR_INST_NAME(config, inst) = { \
.uart = DEVICE_DT_GET(DT_INST_BUS(inst)), \
.power_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_power_gpios, {}), \
@ -2224,6 +2491,8 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script,
.init_chat_script = &telit_me910g1_init_chat_script, \
.dial_chat_script = &telit_me910g1_dial_chat_script, \
.periodic_chat_script = &telit_me910g1_periodic_chat_script, \
.user_pipes = MODEM_CELLULAR_GET_USER_PIPES(inst), \
.user_pipes_size = ARRAY_SIZE(MODEM_CELLULAR_GET_USER_PIPES(inst)), \
}; \
\
PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \
@ -2241,6 +2510,31 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script,
.ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \
}; \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
gnss_pipe, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
user_pipe_0, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
user_pipe_1, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPES( \
inst, \
MODEM_CELLULAR_INIT_USER_PIPE(inst, gnss_pipe, 3), \
MODEM_CELLULAR_INIT_USER_PIPE(inst, user_pipe_0, 4), \
MODEM_CELLULAR_INIT_USER_PIPE(inst, user_pipe_1, 5), \
); \
\
static const struct modem_cellular_config MODEM_CELLULAR_INST_NAME(config, inst) = { \
.uart = DEVICE_DT_GET(DT_INST_BUS(inst)), \
.power_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_power_gpios, {}), \
@ -2252,6 +2546,8 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script,
.init_chat_script = &nordic_nrf91_slm_init_chat_script, \
.dial_chat_script = &nordic_nrf91_slm_dial_chat_script, \
.periodic_chat_script = &nordic_nrf91_slm_periodic_chat_script, \
.user_pipes = MODEM_CELLULAR_GET_USER_PIPES(inst), \
.user_pipes_size = ARRAY_SIZE(MODEM_CELLULAR_GET_USER_PIPES(inst)), \
}; \
\
PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \
@ -2270,6 +2566,31 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script,
.ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \
}; \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
gnss_pipe, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
user_pipe_0, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPE_DATA( \
inst, \
user_pipe_1, \
CONFIG_MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES \
); \
\
MODEM_CELLULAR_DEFINE_USER_PIPES( \
inst, \
MODEM_CELLULAR_INIT_USER_PIPE(inst, gnss_pipe, 3), \
MODEM_CELLULAR_INIT_USER_PIPE(inst, user_pipe_0, 4), \
MODEM_CELLULAR_INIT_USER_PIPE(inst, user_pipe_1, 5), \
); \
\
static const struct modem_cellular_config MODEM_CELLULAR_INST_NAME(config, inst) = { \
.uart = DEVICE_DT_GET(DT_INST_BUS(inst)), \
.power_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_power_gpios, {}), \
@ -2282,6 +2603,8 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script,
.init_chat_script = &sqn_gm02s_init_chat_script, \
.dial_chat_script = &sqn_gm02s_dial_chat_script, \
.periodic_chat_script = &sqn_gm02s_periodic_chat_script, \
.user_pipes = MODEM_CELLULAR_GET_USER_PIPES(inst), \
.user_pipes_size = ARRAY_SIZE(MODEM_CELLULAR_GET_USER_PIPES(inst)), \
}; \
\
PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \