The CAN_BUS_UNKNOWN CAN controller state is only used to indicate that
the current CAN controller state could not be read.
Remove it and change the signature of the can_get_state() API function
to return an integer indicating success or failure.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Increase the default CANopenNode stack sizes a bit. The current stack
sizes are too small for e.g. ST STM32F3, likely other platforms as well.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Rename a few CAN API functions for clarity and consistency with other
Zephyr RTOS APIs.
CAN_DEFINE_MSGQ() becomes CAN_MSGQ_DEFINE() to match K_MSGQ_DEFINE().
can_attach_isr() becomes can_add_rx_filter() since a filter callback
function is not an interrupt service routine (although it is called in
isr context). The word "attach" is replaced with "add" since filters are
added, not attached. This matches the terminology used is other Zephyr
APIs better.
can_detach() becomes can_remove_rx_filter() to pair with
can_add_rx_filter().
can_attach_msgq() becomes can_add_rx_filter_msgq() and documentation is
updated to mention its relationship with can_add_rx_filter().
can_register_state_change_isr() becomes can_set_state_change_callback()
since a state change callback function is not an interrupt service
routine (although it is called in isr context). The word "register" is
replaced with "set" since only one state change callback can be in
place.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Change the can_tx_callback_t function signature to use an "int" (not an
uint32_t) for representing transmission errors.
The "error" callback function parameter is functionally equivalent to
the return value from can_send() and thus needs to use the same data
type and needs to be able to hold negative errno values.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Deprecate the use of CAN-specific error return values and replace them
with standard errno values.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Switch from using can_configure() to using can_set_mode() for disabling
CAN controller transmissions.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Set a thread name for the tx_workq thread, so that it shows up in
"kernel stacks" when the shell or thread debugging are enabled.
Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
The previous CONFIG_CAN_MAX_FILTER is specific to certain drivers.
Using the new API makes the CAN open driver independent of the used
CAN hardware / driver.
Signed-off-by: Martin Jäger <martin@libre.solar>
Rename the top-level header file from <canbus/canopen.h> to
<canopennode.h>.
Rename CANopenNode related Kconfig options from CONFIG_CANOPEN* to
CONFIG_CANOPENNODE*.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Move the Zephyr-specific interface and support code for CANopenNode into
the modules directory. Consolidate the CMakeLists.txt files into one.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>