Zephyr API Documentation 4.4.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
12
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
31
45
49#define SENT_MAX_DATA_NIBBLES 8
50
54struct sent_frame {
57
59 union {
63 struct {
66
70
74 struct {
78 };
79
82
85};
86
95typedef void (*sent_rx_frame_callback_t)(const struct device *dev, uint8_t channel,
96 uint32_t num_frame, void *user_data);
97
99
104typedef int (*sent_start_listening_t)(const struct device *dev, uint8_t channel);
105
110typedef int (*sent_stop_listening_t)(const struct device *dev, uint8_t channel);
111
115struct sent_rx_callback_config {
119 struct sent_frame *frame;
121 uint32_t max_num_frame;
123 void *user_data;
124};
125
129struct sent_rx_callback_configs {
131 struct sent_rx_callback_config *serial;
133 struct sent_rx_callback_config *fast;
134};
135
140typedef int (*sent_register_callback_t)(const struct device *dev, uint8_t channel,
141 struct sent_rx_callback_configs callback_configs);
142
143__subsystem struct sent_driver_api {
144 sent_start_listening_t start_listening;
145 sent_stop_listening_t stop_listening;
146 sent_register_callback_t register_callback;
147};
148
150
161__syscall int sent_start_listening(const struct device *dev, uint8_t channel);
162
163static inline int z_impl_sent_start_listening(const struct device *dev, uint8_t channel)
164{
165 const struct sent_driver_api *api = DEVICE_API_GET(sent, dev);
166
167 if (api->start_listening) {
168 return api->start_listening(dev, channel);
169 }
170
171 return -ENOSYS;
172}
173
184__syscall int sent_stop_listening(const struct device *dev, uint8_t channel);
185
186static inline int z_impl_sent_stop_listening(const struct device *dev, uint8_t channel)
187{
188 const struct sent_driver_api *api = DEVICE_API_GET(sent, dev);
189
190 if (api->stop_listening) {
191 return api->stop_listening(dev, channel);
192 }
193
194 return -ENOSYS;
195}
196
206__syscall int sent_register_callback(const struct device *dev, uint8_t channel,
207 struct sent_rx_callback_configs callback_configs);
208
209static inline int z_impl_sent_register_callback(const struct device *dev, uint8_t channel,
210 struct sent_rx_callback_configs callback_configs)
211{
212 const struct sent_driver_api *api = DEVICE_API_GET(sent, dev);
213
214 if (api->register_callback) {
215 return api->register_callback(dev, channel, callback_configs);
216 }
217
218 return -ENOSYS;
219}
220
221#ifdef __cplusplus
222}
223#endif
224
228
229#include <zephyr/syscalls/sent.h>
230
231#endif /* ZEPHYR_INCLUDE_DRIVERS_SENT_H_ */
#define DEVICE_API_GET(_class, _dev)
Expands to the pointer of a device's API for a given class.
Definition device.h:1425
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:95
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:513
SENT frame structure.
Definition sent.h:54
struct sent_frame::@073352004002173133105234200026220315236122230346::@052310202357350204237047306111207070070357322354 fast
Fast message.
uint16_t data
Serial message data.
Definition sent.h:68
uint8_t data_nibbles[8]
Array of fast message data nibbles.
Definition sent.h:76
uint8_t crc
CRC checksum for message integrity validation.
Definition sent.h:84
uint8_t id
Serial message ID.
Definition sent.h:65
uint32_t timestamp
Timestamp of when the frame was captured.
Definition sent.h:81
enum sent_frame_type type
Type of SENT frame.
Definition sent.h:56
struct sent_frame::@073352004002173133105234200026220315236122230346::@200101137234253347137231003000335224000042211161 serial
Serial message.