-
Notifications
You must be signed in to change notification settings - Fork 680
[nrf noup] Support intermediary SLM optimized modem UART backend #3021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rlubos
merged 1 commit into
nrfconnect:main
from
bjarki-andreasen:modem-backend-uart-slm
Jul 11, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright (c) 2025 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr/kernel.h> | ||
#include <zephyr/drivers/uart.h> | ||
#include <zephyr/modem/pipe.h> | ||
#include <zephyr/modem/stats.h> | ||
|
||
#ifndef ZEPHYR_MODEM_BACKEND_UART_SLM_ | ||
#define ZEPHYR_MODEM_BACKEND_UART_SLM_ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
struct slm_rx_queue_event { | ||
uint8_t *buf; | ||
size_t len; | ||
}; | ||
|
||
struct modem_backend_uart_slm { | ||
const struct device *uart; | ||
struct modem_pipe pipe; | ||
struct k_work_delayable receive_ready_work; | ||
struct k_work transmit_idle_work; | ||
|
||
#ifdef CONFIG_MODEM_STATS | ||
struct modem_stats_buffer receive_buf_stats; | ||
struct modem_stats_buffer transmit_buf_stats; | ||
#endif | ||
struct ring_buf transmit_rb; | ||
struct k_work rx_disabled_work; | ||
atomic_t state; | ||
|
||
struct k_mem_slab rx_slab; | ||
struct k_msgq rx_queue; | ||
struct slm_rx_queue_event rx_event; | ||
struct slm_rx_queue_event rx_queue_buf[CONFIG_MODEM_BACKEND_UART_SLM_BUFFER_COUNT]; | ||
uint32_t rx_buf_size; | ||
uint8_t rx_buf_count; | ||
}; | ||
|
||
struct modem_backend_uart_slm_config { | ||
const struct device *uart; | ||
uint8_t *receive_buf; /* Address must be word-aligned. */ | ||
uint32_t receive_buf_size; | ||
uint8_t *transmit_buf; | ||
uint32_t transmit_buf_size; | ||
}; | ||
|
||
struct modem_pipe *modem_backend_uart_slm_init(struct modem_backend_uart_slm *backend, | ||
const struct modem_backend_uart_slm_config *config); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* ZEPHYR_MODEM_BACKEND_UART_SLM_ */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be a bit confusing to have
MODEM_BACKEND_UART
ben
when usingMODEM_BACKEND_UART_SLM
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe instead you could just add a
config MODEM_BACKEND_UART_ASYNC_SLM
and make use of the existingMODEM_BACKEND_UART_ASYNC
as it has all the configs you need? Well, as you want really.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows for a complete split from the
MODEM_BACKEND_UART
so that modem_backend_uart.c is not included.That said, there is going to be further development on this area, which means that this will be reconsidered.