Zephyr Project API 4.2.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
sent.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 NXP
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
13#ifndef ZEPHYR_INCLUDE_DRIVERS_SENT_H_
14#define ZEPHYR_INCLUDE_DRIVERS_SENT_H_
15
16#include <zephyr/kernel.h>
17#include <zephyr/device.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
45
49#define SENT_MAX_DATA_NIBBLES 8
50
54struct sent_frame {
57
58 union {
62 struct {
65
69
73 struct {
77 };
78
81
84};
85
94typedef void (*sent_rx_frame_callback_t)(const struct device *dev, uint8_t channel,
95 uint32_t num_frame, void *user_data);
96
103typedef int (*sent_start_listening_t)(const struct device *dev, uint8_t channel);
104
109typedef int (*sent_stop_listening_t)(const struct device *dev, uint8_t channel);
110
114struct sent_rx_callback_config {
118 struct sent_frame *frame;
120 uint32_t max_num_frame;
122 void *user_data;
123};
124
128struct sent_rx_callback_configs {
130 struct sent_rx_callback_config *serial;
132 struct sent_rx_callback_config *fast;
133};
134
139typedef int (*sent_register_callback_t)(const struct device *dev, uint8_t channel,
140 struct sent_rx_callback_configs callback_configs);
141
142__subsystem struct sent_driver_api {
143 sent_start_listening_t start_listening;
144 sent_stop_listening_t stop_listening;
145 sent_register_callback_t register_callback;
146};
147
160__syscall int sent_start_listening(const struct device *dev, uint8_t channel);
161
162static inline int z_impl_sent_start_listening(const struct device *dev, uint8_t channel)
163{
164 const struct sent_driver_api *api = (const struct sent_driver_api *)dev->api;
165
166 if (api->start_listening) {
167 return api->start_listening(dev, channel);
168 }
169
170 return -ENOSYS;
171}
172
183__syscall int sent_stop_listening(const struct device *dev, uint8_t channel);
184
185static inline int z_impl_sent_stop_listening(const struct device *dev, uint8_t channel)
186{
187 const struct sent_driver_api *api = (const struct sent_driver_api *)dev->api;
188
189 if (api->stop_listening) {
190 return api->stop_listening(dev, channel);
191 }
192
193 return -ENOSYS;
194}
195
205__syscall int sent_register_callback(const struct device *dev, uint8_t channel,
206 struct sent_rx_callback_configs callback_configs);
207
208static inline int z_impl_sent_register_callback(const struct device *dev, uint8_t channel,
209 struct sent_rx_callback_configs callback_configs)
210{
211 const struct sent_driver_api *api = (const struct sent_driver_api *)dev->api;
212
213 if (api->register_callback) {
214 return api->register_callback(dev, channel, callback_configs);
215 }
216
217 return -ENOSYS;
218}
219
220#ifdef __cplusplus
221}
222#endif
223
228#include <zephyr/syscalls/sent.h>
229
230#endif /* ZEPHYR_INCLUDE_DRIVERS_SENT_H_ */
sent_frame_type
SENT frame type.
Definition sent.h:35
#define SENT_MAX_DATA_NIBBLES
Maximum number of data nibbles.
Definition sent.h:49
int sent_start_listening(const struct device *dev, uint8_t channel)
Enable a specific channel to start receiving from the bus.
void(* sent_rx_frame_callback_t)(const struct device *dev, uint8_t channel, uint32_t num_frame, void *user_data)
Defines the application callback handler function signature for receiving frame.
Definition sent.h:94
int sent_register_callback(const struct device *dev, uint8_t channel, struct sent_rx_callback_configs callback_configs)
Add a callback function to handle messages received for a specific channel.
int sent_stop_listening(const struct device *dev, uint8_t channel)
Disable a specific channel to stop receiving from the bus.
@ SENT_ENHANCED_SERIAL_FRAME_4_BIT_ID
Enhanced serial message frame with 4-bit message ID.
Definition sent.h:39
@ SENT_SHORT_SERIAL_FRAME
Short serial message frame.
Definition sent.h:37
@ SENT_ENHANCED_SERIAL_FRAME_8_BIT_ID
Enhanced serial message frame with 8-bit message ID.
Definition sent.h:41
@ SENT_FAST_FRAME
Fast message frame.
Definition sent.h:43
#define ENOSYS
Function not implemented.
Definition errno.h:82
Public kernel APIs.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition device.h:510
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:516
SENT frame structure.
Definition sent.h:54
uint16_t data
Serial message data.
Definition sent.h:67
uint8_t data_nibbles[8]
Array of fast message data nibbles.
Definition sent.h:75
struct sent_frame::@275::@277 serial
Serial message.
uint8_t crc
CRC checksum for message integrity validation.
Definition sent.h:83
uint8_t id
Serial message ID.
Definition sent.h:64
struct sent_frame::@275::@278 fast
Fast message.
uint32_t timestamp
Timestamp of when the frame was captured.
Definition sent.h:80
enum sent_frame_type type
Type of SENT frame.
Definition sent.h:56