This parameter was removed from net_context already thus applying the
change also on net_offload API.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Now that legacy - and unrelated - function named net_pkt_get_data has
been removed, we can rename net_pkt_get_data_new relevantly.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Instead of aborting on RSSI poll error, let's continue on and
reschedule the next RSSI poll.
This fixes an issue where RSSI polling would stop if for any reason
the modem doesn't fulfill an RSSI poll on time.
Signed-off-by: Michael Scott <mike@foundries.io>
Changes in commit 854045c14d ("drivers/modem: Switch wncm14a2a
driver to new net_pkt API") moved WNC-M14A2A modem driver to new
net_pkt APIs. As part of these changes, the values for source and
destination passed into net_ipv6_create() were reversed.
Let's correct them.
Signed-off-by: Michael Scott <mike@foundries.io>
Commit fd1401495b ("net/tcp: Move net_tcp_set_hdr() away from net
core") removed <net/tcp.h>. This results in a not found error being
generated when CONFIG_NET_TCP is enabled.
We also, don't need to include <net/udp.h> anymore due to new
net_pkt API changes.
Let's clean up the includes by removing both of them.
Signed-off-by: Michael Scott <mike@foundries.io>
Socket-based API sends timeout K_FOREVER(-1) to net_context_connect()
function where previously net_app APIs used an actual timeout value.
Now that we've switched to socket-based APIs, we reveal poor handling
for the timeout value which causes an error in the WNC-M14A2A driver
due to math performed on the -1 value.
Let's be sure to check for valid timeout values prior to performing
math and then make sure it falls within the allowable range of values
for the AT@SOCKCONN command (30 seconds to 360 seconds).
Signed-off-by: Michael Scott <mike@foundries.io>
In commit c1f24abb13 ("drivers: modem: wistron kconfig separation"),
A single line of the WNC-M14A2A congigs was left in the main modem
Kconfig.
Let's clean up the Kconfig file by removing the left over.
Signed-off-by: Michael Scott <mike@foundries.io>
CONFIG_GPIO may not be enabled on some HW, so let's make sure to
enable it if the dependencies are met, as the WNC-M14A2A driver
needs to set power, reset and other GPIOs.
Signed-off-by: Michael Scott <mike@foundries.io>
These symbols are already within an 'if MODEM_WNCM14A2A', so no need to
put 'depends on MODEM_WNCM14A2A' on them.
Also remove a redundant 'depends on MODEM' from MODEM_WNCM14A2A.
drivers/modem/Kconfig.wncm14a2a is already sourced within an 'if MODEM',
in drivers/modem/Kconfig.
'if FOO' is just shorthand for adding 'depends on FOO' to each item
within the 'if'. Dependencies on menus work similarly. There are no
"conditional includes" in Kconfig, so 'if FOO' has no special meaning
around a source. Conditional includes wouldn't be possible, because an
if condition could include (directly or indirectly) forward references
to symbols not defined yet.
Tip: When adding a symbol, check its dependencies in the menuconfig
('ninja menuconfig', then / to jump to the symbol). The menuconfig also
shows how the file with the symbol got included, so if you see
duplicated dependencies, it's easy to hunt down where they come from.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Coverity doesn't like that we're storing the return value of
net_buf_findcrlf() near the end of the handler block as "len".
Only to overwrite "len" again once we exit and look for the next
match.
Let's ignore the return value there and also remove the redundant
check for !frag. Either way, we've found a handler, and need to
break the search loop.
Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/12315
Signed-off-by: Michael Scott <mike@foundries.io>
We can't let i == value_size during the loop which gathers characters
for the length. If we do, the next check of "value[i] != ','" would
access memory beyond the value boundary.
Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/12290
Signed-off-by: Michael Scott <mike@foundries.io>
mdm_receiver_send() was sending 1 too many bytes of buf. This ended
up being the NULL terminator. Size should be reduced prior to the
while check so that this doesn't happen.
Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/14001
Signed-off-by: Michael Scott <mike@foundries.io>
Repalces send fifo_fill implementation with poll_out,
this makes the receiver usefull on most SoC.
Signed-off-by: Georgij Cernysiov <g.cernysiov@elco-automation.de>
Rearranges functions to public and private groups,
and adds missing function comments.
Signed-off-by: Georgij Cernysiov <g.cernysiov@elco-automation.de>
Log possible uart device binding error and change
the error type to a more correct one.
Signed-off-by: Georgij Cernysiov <g.cernysiov@elco-automation.de>
It is a bit awkward that ip/proto headers have to be rebuilt (with fake
data in it though). Let's see in future if that's really needed,
offload device handles already ip/proto headers by themselves so we
should not care.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Let's also check for bytes_read == 0 after calling mdm_receiver_recv()
and if so, break the loop so we don't endlessly loop.
Signed-off-by: Michael Scott <mike@foundries.io>
It is planned to deprecate SHELL_CREATE_STATIC_SUBCMD_SET macro
which is replaced by SHELL_STATIC_SUBCMD_SET_CREATE.
Additionally, removed irrelevant comments about alphabetical
ordering which is no longer needed.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
LOG_LEVEL should be set to CONFIG_MODEM_LOG_LEVEL not
CONFIG_LOG_MODEM_LEVEL. In cleaning this up use
LOG_MODULE_REGISTER(x,y) form to reduce 3 lines to 1.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
If status is 0, both ip_hdr and proto_hdr will own a pointer to the
relevant IP and Protocol headers. In order to know which of ipv4/ipv6
and udp/tcp one will need to use respectively net_pkt_family(pkt) and
net_context_get_ip_proto(context).
Having access to those headers directly, many callbacks will not need
to parse the packet again no get the src/dst addresses or the src/dst
ports. This will be change after this commit.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Every now and then the 100ms delay for collecting IMEI data from the
modem, wasn't long enough and this presents a bad user experience.
Let's set it to 500ms which seems to be working all the time.
Signed-off-by: Michael Scott <mike@foundries.io>
During development of the WNC-M14A2A modem driver, I felt like the
initialization took too long to make the user wait. However, due
to the addition of other drivers such as OpenThread where delays
during startup are noticable, the modem startup time isn't so bad.
Let's remove the delay work which allows Zephyr to startup before
the modem is fully initialized.
NOTE: This also fixes a long standing bug where samples using the
modem would never know when it was ready (without waiting for the
interface up event). This change makes it always ready once the
sample starts.
Signed-off-by: Michael Scott <mike@foundries.io>
Moved UART interrupt dependencies from concrete driver to
the modem receiver as it uses UART interrupt functions within.
This allows developing other UART interrupt based modems without
the need to depend on the aforementioned features explicitly.
Signed-off-by: Georgij Cernysiov <g.cernysiov@elco-automation.de>
net_buf_linearize() used to clear the contents of output buffer,
just to fill it with data as the next step. The only effect that
would have is if less data was written to the output buffer. But
it's not reliable for a caller to rely on net_buf_linearize() for
that, instead callers should take care to handle any conditions
like that themselves. For example, a caller which wants to process
the data as zero-terminated string, must reserve a byte for it
in the output buffer explicitly (and set it to zero).
The only in-tree user which relied on clearing output buffer was
wncm14a2a.c. But either had buffer sizes calculated very precisely
to always accommodate extra trailing zero byte (without providing
code comments about this), or arguably could suffer from buffer
overruns (at least if data received from a modem was invalid and
filled up all destination buffer, leaving no space for trailing
zero).
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
The comment was incorrect explaining why we were sending an
AT-command without waiting for a response (via a K_NO_WAIT timeout).
Let's correct the comment and avoid confusion.
Signed-off-by: Michael Scott <mike@foundries.io>
Remove overly complicated logic to skip incoming data if we were
still waiting on a previous set of data to be read.
This fixes a bug where an error during data receive could end up
with the modem ignoring all incoming data.
Signed-off-by: Michael Scott <mike@foundries.io>
Modem driver for WNCM14A2A was erroneously leaving the
selection of UART_INTERRUPT_DRIVEN up to CONSOLE_HANDLER.
Now, with the move to the new SHELL backend, this is no
longer happening.
Let's select it from the modem driver, instead of depending
on it.
Let's also add a dependency on SERIAL_SUPPORT_INTERRUPT
which the serial drivers enable to let us know
UART_INTERRUPT_DRIVEN is available.
Signed-off-by: Michael Scott <mike@foundries.io>
These changes were obtained by running a script created by
Ulf Magnusson <Ulf.Magnusson@nordicsemi.no> for the following
specification:
1. Read the contents of all dts_fixup.h files in Zephyr
2. Check the left-hand side of the #define macros (i.e. the X in
#define X Y)
3. Check if that name is also the name of a Kconfig option
3.a If it is, then do nothing
3.b If it is not, then replace CONFIG_ with DT_ or add DT_ if it
has neither of these two prefixes
4. Replace the use of the changed #define in the code itself
(.c, .h, .ld)
Additionally, some tweaks had to be added to this script to catch some
of the macros used in the code in a parameterized form, e.g.:
- CONFIG_GPIO_STM32_GPIO##__SUFFIX##_BASE_ADDRESS
- CONFIG_UART_##idx##_TX_PIN
- I2C_SBCON_##_num##_BASE_ADDR
and to prevent adding DT_ prefix to the following symbols:
- FLASH_START
- FLASH_SIZE
- SRAM_START
- SRAM_SIZE
- _ROM_ADDR
- _ROM_SIZE
- _RAM_ADDR
- _RAM_SIZE
which are surprisingly also defined in some dts_fixup.h files.
Finally, some manual corrections had to be done as well:
- name##_IRQ -> DT_##name##_IRQ in uart_stm32.c
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
I have no idea what I was thinking when I wrote this.
But, it's an easy fix to remove the void * entirely.
Signed-off-by: Michael Scott <mike@foundries.io>
New shell implementation is on the way. For now old one and all
references are kept to be gradually replaced by new shell.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
The return of memset is never checked. This patch explicitly ignore
the return to avoid MISRA-C violations.
The only directory excluded directory was ext/* since it contains
only imported code.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
These settings enable use of the WNC-M14A2A LTE-M modem as the default
network interface for the nRF52840-DK board (nrf52840_pca10056).
They include the following settings when MODEM_WNCM14A2A is selected:
- UARTE1 pin setup
- DTS / DTS fixup additions for WNC-M14A2A
- Kconfig settings for modem driver
Signed-off-by: Michael Scott <mike@foundries.io>
These settings enable use of the WNC-M14A2A LTE-M modem as the default
network interface instead of ethernet.
They include the following settings when MODEM_WNCM14A2A is selected:
- UART 2 setup
- Avoid ETH_0 setup due to pin conflicts
- DTS addition for WNC-M14A2A
- Kconfig settings for modem driver
Signed-off-by: Michael Scott <mike@foundries.io>
Add a set of modem shell commands to support modem development.
Start with:
modem list: Lists all registered modems and related information
modem send <modem receiver index> <command>: Send command to modem
Signed-off-by: Michael Scott <mike@foundries.io>
The WNC-M14A2A (LTE / LTE-M) modem is presented as an Arduino-
compatible shield via AT&T's IoT Starter Kit v1.0. It was
originally intended to work with the FRDM-K64F board, but
in theory as long as the right pins are configured it can
work with any board that supports Arduino-compatible headers.
The driver utilizes the CONFIG_NET_OFFLOAD setting to avoid the
normal handling of IP packets, and instead uses a socket-like
UART interface to handle incoming and outgoing data.
Signed-off-by: Michael Scott <mike@foundries.io>