Zephyr API Documentation 4.2.99
A Scalable Open Source RTOS
 4.2.99
sent.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 NXP
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
11
12#ifndef ZEPHYR_INCLUDE_DRIVERS_SENT_H_
13#define ZEPHYR_INCLUDE_DRIVERS_SENT_H_
14
15#include <zephyr/kernel.h>
16#include <zephyr/device.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
30
44
48#define SENT_MAX_DATA_NIBBLES 8
49
53struct sent_frame {
56
57 union {
61 struct {
64
68
72 struct {
76 };
77
80
83};
84
93typedef void (*sent_rx_frame_callback_t)(const struct device *dev, uint8_t channel,
94 uint32_t num_frame, void *user_data);
95
97
102typedef int (*sent_start_listening_t)(const struct device *dev, uint8_t channel);
103
108typedef int (*sent_stop_listening_t)(const struct device *dev, uint8_t channel);
109
113struct sent_rx_callback_config {
117 struct sent_frame *frame;
119 uint32_t max_num_frame;
121 void *user_data;
122};
123
127struct sent_rx_callback_configs {
129 struct sent_rx_callback_config *serial;
131 struct sent_rx_callback_config *fast;
132};
133
138typedef int (*sent_register_callback_t)(const struct device *dev, uint8_t channel,
139 struct sent_rx_callback_configs callback_configs);
140
141__subsystem struct sent_driver_api {
142 sent_start_listening_t start_listening;
143 sent_stop_listening_t stop_listening;
144 sent_register_callback_t register_callback;
145};
146
148
159__syscall int sent_start_listening(const struct device *dev, uint8_t channel);
160
161static inline int z_impl_sent_start_listening(const struct device *dev, uint8_t channel)
162{
163 const struct sent_driver_api *api = (const struct sent_driver_api *)dev->api;
164
165 if (api->start_listening) {
166 return api->start_listening(dev, channel);
167 }
168
169 return -ENOSYS;
170}
171
182__syscall int sent_stop_listening(const struct device *dev, uint8_t channel);
183
184static inline int z_impl_sent_stop_listening(const struct device *dev, uint8_t channel)
185{
186 const struct sent_driver_api *api = (const struct sent_driver_api *)dev->api;
187
188 if (api->stop_listening) {
189 return api->stop_listening(dev, channel);
190 }
191
192 return -ENOSYS;
193}
194
204__syscall int sent_register_callback(const struct device *dev, uint8_t channel,
205 struct sent_rx_callback_configs callback_configs);
206
207static inline int z_impl_sent_register_callback(const struct device *dev, uint8_t channel,
208 struct sent_rx_callback_configs callback_configs)
209{
210 const struct sent_driver_api *api = (const struct sent_driver_api *)dev->api;
211
212 if (api->register_callback) {
213 return api->register_callback(dev, channel, callback_configs);
214 }
215
216 return -ENOSYS;
217}
218
219#ifdef __cplusplus
220}
221#endif
222
226
227#include <zephyr/syscalls/sent.h>
228
229#endif /* ZEPHYR_INCLUDE_DRIVERS_SENT_H_ */
sent_frame_type
SENT frame type.
Definition sent.h:34
#define SENT_MAX_DATA_NIBBLES
Maximum number of data nibbles.
Definition sent.h:48
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:93
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:38
@ SENT_SHORT_SERIAL_FRAME
Short serial message frame.
Definition sent.h:36
@ SENT_ENHANCED_SERIAL_FRAME_8_BIT_ID
Enhanced serial message frame with 8-bit message ID.
Definition sent.h:40
@ SENT_FAST_FRAME
Fast message frame.
Definition sent.h:42
#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:53
struct sent_frame::@073352004002173133105234200026220315236122230346::@052310202357350204237047306111207070070357322354 fast
Fast message.
uint16_t data
Serial message data.
Definition sent.h:66
uint8_t data_nibbles[8]
Array of fast message data nibbles.
Definition sent.h:74
uint8_t crc
CRC checksum for message integrity validation.
Definition sent.h:82
uint8_t id
Serial message ID.
Definition sent.h:63
uint32_t timestamp
Timestamp of when the frame was captured.
Definition sent.h:79
enum sent_frame_type type
Type of SENT frame.
Definition sent.h:55
struct sent_frame::@073352004002173133105234200026220315236122230346::@200101137234253347137231003000335224000042211161 serial
Serial message.