|
K-FSW ec10f94
Modular flight software on Zephyr, for small satellites
|
#include <stdbool.h>#include <stdint.h>Data Structures | |
| struct | kfsw_can_info |
Macros | |
| #define | KFSW_CAN_INTERFACE_NAME_SIZE 10U |
| #define | KFSW_CAN_BITRATE_125K 125000U |
| #define | KFSW_CAN_BITRATE_250K 250000U |
| #define | KFSW_CAN_BITRATE_500K 500000U |
| #define | KFSW_CAN_BITRATE_800K 800000U |
| #define | KFSW_CAN_BITRATE_1M 1000000U |
Functions | |
| int | kfsw_can_open (void) |
| void | kfsw_can_get_info (struct kfsw_can_info *info) |
| bool | kfsw_can_bitrate_supported (uint32_t bitrate) |
| int | kfsw_can_set_bitrate (uint32_t bitrate) |
CSP over CAN.
The controller comes from the kfsw,csp-can chosen node, on a board or through SocketCAN on a host.
| #define KFSW_CAN_BITRATE_125K 125000U |
Bitrates an operator may select.
Anything else is refused.
| #define KFSW_CAN_INTERFACE_NAME_SIZE 10U |
Longest interface name libcsp's text parser accepts, plus a terminator.
| bool kfsw_can_bitrate_supported | ( | uint32_t | bitrate | ) |
Check whether a bitrate is supported.
Exposed so a parameter validator can reject a bitrate before the controller is opened.
| void kfsw_can_get_info | ( | struct kfsw_can_info * | info | ) |
Read the CAN configuration and interface state.
| int kfsw_can_open | ( | void | ) |
Open the chosen CAN controller and register it with libcsp.
Called by the CSP lifecycle after the router exists and before it starts. Returns 0 on success, a negative errno if the controller is missing or refuses the configured bitrate.
| int kfsw_can_set_bitrate | ( | uint32_t | bitrate | ) |
Apply a new bitrate, restarting the controller.
This function only reports whether the controller accepted the change.
Returns 0 on success, -EINVAL for an unsupported bitrate, -ENODEV when no controller is open.