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
102
107typedef int (*sent_start_listening_t)(const struct device *dev, uint8_t channel);
108
113typedef int (*sent_stop_listening_t)(const struct device *dev, uint8_t channel);
114
128
138
143typedef int (*sent_register_callback_t)(const struct device *dev, uint8_t channel,
144 struct sent_rx_callback_configs callback_configs);
145
157
161
172__syscall int sent_start_listening(const struct device *dev, uint8_t channel);
173
174static inline int z_impl_sent_start_listening(const struct device *dev, uint8_t channel)
175{
176 const struct sent_driver_api *api = DEVICE_API_GET(sent, dev);
177
178 if (api->start_listening) {
179 return api->start_listening(dev, channel);
180 }
181
182 return -ENOSYS;
183}
184
195__syscall int sent_stop_listening(const struct device *dev, uint8_t channel);
196
197static inline int z_impl_sent_stop_listening(const struct device *dev, uint8_t channel)
198{
199 const struct sent_driver_api *api = DEVICE_API_GET(sent, dev);
200
201 if (api->stop_listening) {
202 return api->stop_listening(dev, channel);
203 }
204
205 return -ENOSYS;
206}
207
217__syscall int sent_register_callback(const struct device *dev, uint8_t channel,
218 struct sent_rx_callback_configs callback_configs);
219
220static inline int z_impl_sent_register_callback(const struct device *dev, uint8_t channel,
221 struct sent_rx_callback_configs callback_configs)
222{
223 const struct sent_driver_api *api = DEVICE_API_GET(sent, dev);
224
225 if (api->register_callback) {
226 return api->register_callback(dev, channel, callback_configs);
227 }
228
229 return -ENOSYS;
230}
231
232#ifdef __cplusplus
233}
234#endif
235
239
240#include <zephyr/syscalls/sent.h>
241
242#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:1449
int(* sent_register_callback_t)(const struct device *dev, uint8_t channel, struct sent_rx_callback_configs callback_configs)
Callback API upon adding RX callback See sent_register_callback() for argument description.
Definition sent.h:143
int(* sent_start_listening_t)(const struct device *dev, uint8_t channel)
Callback API upon starting receive frame See sent_start_listening() for argument description.
Definition sent.h:107
int(* sent_stop_listening_t)(const struct device *dev, uint8_t channel)
Callback API upon stopping receive frame See sent_stop_listening() for argument description.
Definition sent.h:113
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:83
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
<span class="mlabel">Driver Operations</span> SENT driver operations
Definition sent.h:149
sent_register_callback_t register_callback
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition sent.h:155
sent_stop_listening_t stop_listening
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition sent.h:153
sent_start_listening_t start_listening
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition sent.h:151
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.
Configuration structure for RX callback.
Definition sent.h:118
struct sent_frame * frame
Pointer to the buffer for storing received frames.
Definition sent.h:122
uint32_t max_num_frame
Maximum number of frames to store.
Definition sent.h:124
void * user_data
Pointer to user data passed to the callback.
Definition sent.h:126
sent_rx_frame_callback_t callback
Callback function invoked on frame reception.
Definition sent.h:120
Composite configuration structure for RX callback registration.
Definition sent.h:132
struct sent_rx_callback_config * fast
Configuration for the fast message callback.
Definition sent.h:136
struct sent_rx_callback_config * serial
Configuration for the serial message callback.
Definition sent.h:134