1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- #ifndef ZEPHYR_INCLUDE_NET_SOCKET_CAN_H_
- #define ZEPHYR_INCLUDE_NET_SOCKET_CAN_H_
- #include <zephyr/types.h>
- #include <net/net_ip.h>
- #include <net/net_if.h>
- #include <drivers/can.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define CAN_RAW 1
- #define SOL_CAN_BASE 100
- #define SOL_CAN_RAW (SOL_CAN_BASE + CAN_RAW)
- enum {
- CAN_RAW_FILTER = 1,
- };
- #define CAN_MTU CAN_MAX_DLEN
- struct sockaddr_can {
- sa_family_t can_family;
- int can_ifindex;
- };
- struct canbus_api {
-
- struct net_if_api iface_api;
-
- int (*send)(const struct device *dev, struct net_pkt *pkt);
-
- void (*close)(const struct device *dev, int filter_id);
-
- int (*setsockopt)(const struct device *dev, void *obj, int level,
- int optname,
- const void *optval, socklen_t optlen);
-
- int (*getsockopt)(const struct device *dev, void *obj, int level,
- int optname,
- const void *optval, socklen_t *optlen);
- };
- BUILD_ASSERT(offsetof(struct canbus_api, iface_api) == 0);
- #ifdef __cplusplus
- }
- #endif
- #endif
|