During debugging I got "Got unexpected PDU" errors because a new CF was
received before the state was set to ISOTP_TX_WAIT_FC in the send state
machine. Setting the state before printing the debug information fixes
the issue.
Signed-off-by: Martin Jäger <martin@libre.solar>
Fixed addressing as specified in ISO 15765-2 encodes the source and
target address of a device or function inside the CAN ID according to
SAE J1939.
In order to allow to receive incoming requests from different nodes,
the CAN filter mask has to be set such that the source address is
ignored in the receive context. In addition to that, flow control
frames have to be sent back to the actual source of the request, which
requires adjustments to the TX CAN ID.
This commit implements above features and thus allows ISO-TP to be
used in a network based on SAE J1939 or NMEA-2000.
Signed-off-by: Martin Jäger <martin@libre.solar>
ISO 15765-2 specifies that the CAN frame length for single frames and
the last consecutive frame may or may not be optimized to the actual
length of the PDU payload. The ISO-TP implementation should only
consider the information from the N_PCI section.
The previous implementation did not allow padding. With this commit,
padding is allowed by default and can even be required to be more
compliant to AUTOSAR standards.
Signed-off-by: Martin Jäger <martin@libre.solar>
Reordering of the struct elements to match the Linux format.
The __packed() is not necessary anymore.
std_id and ext_id is merged to id in the frame and filter.
Additionally, the frames are ready for CAN-FD.
Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.
A coccinelle rule is used for this:
@r_const_dev_1
disable optional_qualifier
@
@@
-struct device *
+const struct device *
@r_const_dev_2
disable optional_qualifier
@
@@
-struct device * const
+const struct device *
Fixes#27399
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
-Wimplicit-fallthrough=2 requires a fallthrough comment or a compiler
to tells gcc that this happens intentionally.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This set of functions seem to be there just because of historical
reasons, stemming from Kbuild. They are non-obvious and prone to errors,
so remove them in favor of the `_ifdef()` ones with an explicit
`CONFIG_` condition.
Script used:
git grep -l _if_kconfig | xargs sed -E -i
"s/_if_kconfig\(\s*(\w*)/_ifdef(CONFIG_\U\1\E \1/g"
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Convert all canbus related API/samples/tests/subsys
to the new timeout API with k_timeout_t.
Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
The net_buf subsystem is now fully compatible with the new timeout
API, so move the selection of the legacy API to those specific
subsystems that use net_buf and still need converting.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The implementation checks if there are not enough buffers
to add the received data. However, a return was missing
after the error signaling.
Fixes#22657
Coverity-CID: 208191
Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
I think people might be reading differences into 'if' and 'depends on'
that aren't there, like maybe 'if' being needed to "hide" a symbol,
while 'depends on' just adds a dependency.
There are no differences between 'if' and 'depends on'. 'if' is just a
shorthand for 'depends on'. They work the same when it comes to creating
implicit menus too.
The way symbols get "hidden" is through their dependencies not being
satisfied ('if'/'depends on' get copied up as a dependency on the
prompt).
Since 'if' and 'depends on' are the same, an 'if' with just a single
symbol in it can be replaced with a 'depends on'. IMO, it's best to
avoid 'if' there as a style choice too, because it confuses people into
thinking there's deep Kconfig magic going on that requires 'if'.
Going for 'depends on' can also remove some nested 'if's, which
generates nicer symbol information and docs, because nested 'if's really
are so simple/dumb that they just add the dependencies from both 'if's
to all symbols within.
Replace a bunch of single-symbol 'if's with 'depends on' to despam the
Kconfig files a bit and make it clearer how things work. Also do some
other minor related dependency refactoring.
The replacement isn't complete. Will fix up the rest later. Splitting it
a bit to make it more manageable.
(Everything above is true for choices, menus, and comments as well.)
Detected by tweaking the Kconfiglib parsing code. It's impossible to
detect after parsing, because 'if' turns into 'depends on'.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This commit adds a ISO-TP (ISO15765-2) library.
The library makes use of net buffers and spawns a workqueue thread.
The CAN device that is passed to bind and send can be used concurrently
beside this library.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>