Zephyr Project API
3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
uart.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2022 Trackunit Corporation
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
#include <
zephyr/kernel.h
>
8
#include <
zephyr/types.h
>
9
#include <
zephyr/device.h
>
10
#include <
zephyr/drivers/uart.h
>
11
#include <
zephyr/sys/ring_buffer.h
>
12
#include <
zephyr/sys/atomic.h
>
13
14
#include <
zephyr/modem/pipe.h
>
15
#include <
zephyr/modem/stats.h
>
16
17
#ifndef ZEPHYR_MODEM_BACKEND_UART_
18
#define ZEPHYR_MODEM_BACKEND_UART_
19
20
#ifdef __cplusplus
21
extern
"C"
{
22
#endif
23
24
struct
modem_backend_uart_isr
{
25
struct
ring_buf
receive_rdb
[2];
26
struct
ring_buf
transmit_rb
;
27
atomic_t
transmit_buf_len
;
28
atomic_t
receive_buf_len
;
29
uint8_t
receive_rdb_used
;
30
uint32_t
transmit_buf_put_limit
;
31
};
32
33
struct
modem_backend_uart_async
{
34
uint8_t
*
receive_bufs
[2];
35
uint32_t
receive_buf_size
;
36
struct
ring_buf
receive_rb
;
37
struct
k_spinlock
receive_rb_lock
;
38
uint8_t
*
transmit_buf
;
39
uint32_t
transmit_buf_size
;
40
struct
k_work
rx_disabled_work
;
41
atomic_t
state
;
42
};
43
44
struct
modem_backend_uart
{
45
const
struct
device
*
uart
;
46
struct
modem_pipe
pipe
;
47
struct
k_work_delayable
receive_ready_work
;
48
struct
k_work
transmit_idle_work
;
49
50
#if CONFIG_MODEM_STATS
51
struct
modem_stats_buffer receive_buf_stats;
52
struct
modem_stats_buffer transmit_buf_stats;
53
#endif
54
55
union
{
56
struct
modem_backend_uart_isr
isr
;
57
struct
modem_backend_uart_async
async;
58
};
59
};
60
61
struct
modem_backend_uart_config
{
62
const
struct
device
*
uart
;
63
uint8_t
*
receive_buf
;
64
uint32_t
receive_buf_size
;
65
uint8_t
*
transmit_buf
;
66
uint32_t
transmit_buf_size
;
67
};
68
69
struct
modem_pipe *
modem_backend_uart_init
(
struct
modem_backend_uart
*backend,
70
const
struct
modem_backend_uart_config
*config);
71
72
#ifdef __cplusplus
73
}
74
#endif
75
76
#endif
/* ZEPHYR_MODEM_BACKEND_UART_ */
atomic_t
long atomic_t
Definition
atomic_types.h:15
device.h
uart.h
Public APIs for UART drivers.
types.h
kernel.h
Public kernel APIs.
modem_backend_uart_init
struct modem_pipe * modem_backend_uart_init(struct modem_backend_uart *backend, const struct modem_backend_uart_config *config)
stats.h
pipe.h
ring_buffer.h
isr
static void isr(const void *args)
Definition
main.c:32
uint32_t
__UINT32_TYPE__ uint32_t
Definition
stdint.h:90
uint8_t
__UINT8_TYPE__ uint8_t
Definition
stdint.h:88
device
Runtime device structure (in ROM) per driver instance.
Definition
device.h:403
k_spinlock
Kernel Spin Lock.
Definition
spinlock.h:45
k_work_delayable
A structure used to submit work after a delay.
Definition
kernel.h:3908
k_work
A structure used to submit work.
Definition
kernel.h:3880
modem_backend_uart_async
Definition
uart.h:33
modem_backend_uart_async::transmit_buf_size
uint32_t transmit_buf_size
Definition
uart.h:39
modem_backend_uart_async::receive_buf_size
uint32_t receive_buf_size
Definition
uart.h:35
modem_backend_uart_async::receive_bufs
uint8_t * receive_bufs[2]
Definition
uart.h:34
modem_backend_uart_async::receive_rb_lock
struct k_spinlock receive_rb_lock
Definition
uart.h:37
modem_backend_uart_async::rx_disabled_work
struct k_work rx_disabled_work
Definition
uart.h:40
modem_backend_uart_async::state
atomic_t state
Definition
uart.h:41
modem_backend_uart_async::receive_rb
struct ring_buf receive_rb
Definition
uart.h:36
modem_backend_uart_async::transmit_buf
uint8_t * transmit_buf
Definition
uart.h:38
modem_backend_uart_config
Definition
uart.h:61
modem_backend_uart_config::receive_buf_size
uint32_t receive_buf_size
Definition
uart.h:64
modem_backend_uart_config::transmit_buf_size
uint32_t transmit_buf_size
Definition
uart.h:66
modem_backend_uart_config::uart
const struct device * uart
Definition
uart.h:62
modem_backend_uart_config::transmit_buf
uint8_t * transmit_buf
Definition
uart.h:65
modem_backend_uart_config::receive_buf
uint8_t * receive_buf
Definition
uart.h:63
modem_backend_uart_isr
Definition
uart.h:24
modem_backend_uart_isr::receive_buf_len
atomic_t receive_buf_len
Definition
uart.h:28
modem_backend_uart_isr::transmit_buf_put_limit
uint32_t transmit_buf_put_limit
Definition
uart.h:30
modem_backend_uart_isr::transmit_buf_len
atomic_t transmit_buf_len
Definition
uart.h:27
modem_backend_uart_isr::transmit_rb
struct ring_buf transmit_rb
Definition
uart.h:26
modem_backend_uart_isr::receive_rdb_used
uint8_t receive_rdb_used
Definition
uart.h:29
modem_backend_uart_isr::receive_rdb
struct ring_buf receive_rdb[2]
Definition
uart.h:25
modem_backend_uart
Definition
uart.h:44
modem_backend_uart::uart
const struct device * uart
Definition
uart.h:45
modem_backend_uart::receive_ready_work
struct k_work_delayable receive_ready_work
Definition
uart.h:47
modem_backend_uart::transmit_idle_work
struct k_work transmit_idle_work
Definition
uart.h:48
modem_backend_uart::pipe
struct modem_pipe pipe
Definition
uart.h:46
ring_buf
A structure to represent a ring buffer.
Definition
ring_buffer.h:41
atomic.h
include
zephyr
modem
backend
uart.h
Generated on Sun Sep 15 2024 17:01:30 for Zephyr Project API by
1.9.8