nRF Connect SDK API
3.4.99
Toggle main menu visibility
Loading...
Searching...
No Matches
rtfw.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2026 Nordic Semiconductor
3
*
4
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5
*/
6
7
#ifndef RTFW_RTFW_H_
8
#define RTFW_RTFW_H_
9
10
#include <stdbool.h>
11
#include <stddef.h>
12
#include <stdint.h>
13
#include <zephyr/sys/util.h>
14
21
22
#ifdef __cplusplus
23
extern
"C"
{
24
#endif
25
30
#define RTFW_EVENT_COMMAND_PROCESSED 1U
31
33
#define RTFW_EVENT_TYPE_FRAMEWORK_MAX 0xffU
35
#define RTFW_EVENT_TYPE_USER_BASE 0x100U
36
37
#define RTFW_FAULT_EVENT_OVERFLOW BIT(0)
38
#define RTFW_FAULT_BACKEND_APPLY BIT(1)
39
46
struct
rtfw_command
{
47
uint32_t
id
;
48
uint32_t
data_len
;
49
uint8_t
data
[CONFIG_RTFW_COMMAND_DATA_SIZE];
50
};
51
59
struct
rtfw_event
{
60
uint32_t
type
;
61
uint32_t
value
;
62
uint32_t
timestamp
;
63
};
64
74
struct
rtfw_status
{
75
struct
rtfw_command
requested
;
76
struct
rtfw_command
attempted
;
77
struct
rtfw_command
applied
;
78
int32_t
apply_result
;
79
bool
pending
;
80
uint32_t
dropped_events
;
82
uint32_t
max_queue_depth
;
83
uint32_t
faults
;
84
};
85
96
typedef
int (*
rtfw_command_handler_t
)(
const
struct
rtfw_command
*command,
97
void
*user_data);
98
108
typedef
void (*
rtfw_fastpath_handler_t
)(
void
*user_data);
109
117
typedef
void (*
rtfw_pend_source_irq_t
)(
void
*user_data);
118
127
typedef
void (*
rtfw_event_cb_t
)(
const
struct
rtfw_event
*event,
void
*user_data);
128
138
struct
rtfw_config
{
139
rtfw_command_handler_t
command_handler
;
140
rtfw_fastpath_handler_t
fastpath_handler
;
141
rtfw_pend_source_irq_t
pend_source_irq
;
142
rtfw_event_cb_t
event_handler
;
143
void
*
fastpath_user_data
;
144
void
*
event_user_data
;
145
};
146
164
int
rtfw_init
(
const
struct
rtfw_config
*config);
165
182
int
rtfw_submit
(
const
struct
rtfw_command
*command);
183
192
int
rtfw_get_status
(
struct
rtfw_status
*status);
193
201
void
rtfw_fastpath_run
(
void
);
202
216
int
rtfw_event_push
(
const
struct
rtfw_event
*event);
217
218
#ifdef __cplusplus
219
}
220
#endif
221
223
224
#endif
/* RTFW_RTFW_H_ */
rtfw_init
int rtfw_init(const struct rtfw_config *config)
Initialize the reusable framework.
rtfw_fastpath_handler_t
void(* rtfw_fastpath_handler_t)(void *user_data)
Service a client-owned source in the zero-latency fast path.
Definition
rtfw.h:108
rtfw_event_push
int rtfw_event_push(const struct rtfw_event *event)
Push one event from the single producer fast path.
rtfw_pend_source_irq_t
void(* rtfw_pend_source_irq_t)(void *user_data)
Pend the client-owned source interrupt.
Definition
rtfw.h:117
rtfw_get_status
int rtfw_get_status(struct rtfw_status *status)
Read a coherent requested/attempted/applied state snapshot.
rtfw_submit
int rtfw_submit(const struct rtfw_command *command)
Publish a latest-wins command and pend the backend source IRQ.
rtfw_fastpath_run
void rtfw_fastpath_run(void)
Enter the registered zero-latency fast path.
rtfw_event_cb_t
void(* rtfw_event_cb_t)(const struct rtfw_event *event, void *user_data)
Consume an event outside the zero-latency fast path.
Definition
rtfw.h:127
rtfw_command_handler_t
int(* rtfw_command_handler_t)(const struct rtfw_command *command, void *user_data)
Process a command in the zero-latency fast path.
Definition
rtfw.h:96
rtfw_command::data_len
uint32_t data_len
Definition
rtfw.h:48
rtfw_command::id
uint32_t id
Definition
rtfw.h:47
rtfw_command::data
uint8_t data[CONFIG_RTFW_COMMAND_DATA_SIZE]
Definition
rtfw.h:49
rtfw_command
Fixed-size command exchanged with an RTFW backend.
Definition
rtfw.h:46
rtfw_config::fastpath_user_data
void * fastpath_user_data
Definition
rtfw.h:143
rtfw_config::pend_source_irq
rtfw_pend_source_irq_t pend_source_irq
Definition
rtfw.h:141
rtfw_config::fastpath_handler
rtfw_fastpath_handler_t fastpath_handler
Definition
rtfw.h:140
rtfw_config::event_handler
rtfw_event_cb_t event_handler
Definition
rtfw.h:142
rtfw_config::event_user_data
void * event_user_data
Definition
rtfw.h:144
rtfw_config::command_handler
rtfw_command_handler_t command_handler
Definition
rtfw.h:139
rtfw_config
RTFW client configuration.
Definition
rtfw.h:138
rtfw_event::timestamp
uint32_t timestamp
Definition
rtfw.h:62
rtfw_event::type
uint32_t type
Definition
rtfw.h:60
rtfw_event::value
uint32_t value
Definition
rtfw.h:61
rtfw_event
Event produced by a backend's zero-latency fast path.
Definition
rtfw.h:59
rtfw_status::dropped_events
uint32_t dropped_events
Definition
rtfw.h:80
rtfw_status::apply_result
int32_t apply_result
Definition
rtfw.h:78
rtfw_status::requested
struct rtfw_command requested
Definition
rtfw.h:75
rtfw_status::max_queue_depth
uint32_t max_queue_depth
Definition
rtfw.h:82
rtfw_status::pending
bool pending
Definition
rtfw.h:79
rtfw_status::faults
uint32_t faults
Definition
rtfw.h:83
rtfw_status::attempted
struct rtfw_command attempted
Definition
rtfw.h:76
rtfw_status::applied
struct rtfw_command applied
Definition
rtfw.h:77
rtfw_status
Coherent framework status snapshot.
Definition
rtfw.h:74
include
rtfw
rtfw.h
Generated on
for nRF Connect SDK API by
1.17.0