Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
pipelink.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Trackunit Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#include <zephyr/modem/pipe.h>
8#include <zephyr/devicetree.h>
9#include <zephyr/sys/util.h>
10
11#ifndef ZEPHYR_MODEM_PIPELINK_
12#define ZEPHYR_MODEM_PIPELINK_
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
32
36struct modem_pipelink;
37
46typedef void (*modem_pipelink_callback)(struct modem_pipelink *link,
47 enum modem_pipelink_event event,
48 void *user_data);
49
53struct modem_pipelink {
54 struct modem_pipe *pipe;
56 void *user_data;
57 bool connected;
58 struct k_spinlock spinlock;
59};
60
69void modem_pipelink_attach(struct modem_pipelink *link,
71 void *user_data);
72
79bool modem_pipelink_is_connected(struct modem_pipelink *link);
80
87struct modem_pipe *modem_pipelink_get_pipe(struct modem_pipelink *link);
88
93void modem_pipelink_release(struct modem_pipelink *link);
94
98void modem_pipelink_init(struct modem_pipelink *link, struct modem_pipe *pipe);
99
101void modem_pipelink_notify_connected(struct modem_pipelink *link);
102
104void modem_pipelink_notify_disconnected(struct modem_pipelink *link);
105
115#define MODEM_PIPELINK_DT_SYM(node_id, name) \
116 _CONCAT_4(__modem_pipelink_, DT_DEP_ORD(node_id), _, name)
117
125#define MODEM_PIPELINK_DT_DECLARE(node_id, name) \
126 extern struct modem_pipelink MODEM_PIPELINK_DT_SYM(node_id, name)
127
133#define MODEM_PIPELINK_DT_DEFINE(node_id, name) \
134 struct modem_pipelink MODEM_PIPELINK_DT_SYM(node_id, name)
135
141#define MODEM_PIPELINK_DT_GET(node_id, name) \
142 (&MODEM_PIPELINK_DT_SYM(node_id, name))
143
151#define MODEM_PIPELINK_DT_INST_DECLARE(inst, name) \
152 MODEM_PIPELINK_DT_DECLARE(DT_DRV_INST(inst), name)
153
154#define MODEM_PIPELINK_DT_INST_DEFINE(inst, name) \
155 MODEM_PIPELINK_DT_DEFINE(DT_DRV_INST(inst), name)
156
157#define MODEM_PIPELINK_DT_INST_GET(inst, name) \
158 MODEM_PIPELINK_DT_GET(DT_DRV_INST(inst), name)
159
164#ifdef __cplusplus
165}
166#endif
167
168#endif /* ZEPHYR_MODEM_PIPELINK_ */
Devicetree main header.
Kernel Spin Lock.
Definition spinlock.h:45
Misc utilities.