RTEMS 6.1-rc1
versal-uart.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * Copyright (C) 2021 Gedare Bloom <gedare@rtems.org>
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35
36#ifndef LIBBSP_ARM_XILINX_VERSAL_UART_H
37#define LIBBSP_ARM_XILINX_VERSAL_UART_H
38
39#include <rtems/termiostypes.h>
40
41#ifdef __cplusplus
42extern "C" {
43#endif /* __cplusplus */
44
54typedef struct {
56 volatile struct versal_uart *regs;
57 volatile size_t tx_queued;
58 volatile bool transmitting;
59 bool first_send;
62
63extern const rtems_termios_device_handler versal_uart_handler;
64
65#define VERSAL_UART_DEFAULT_BAUD 115200
66
67int versal_uart_initialize(rtems_termios_device_context *base);
68
69int versal_uart_read_polled(rtems_termios_device_context *base);
70
71void versal_uart_write_polled(
73 char c
74);
75
80
81int versal_cal_baud_rate(
82 uint32_t baudrate,
83 uint32_t maxerror,
84 uint32_t* ibdiv,
85 uint32_t* fbdiv
86);
87
88#ifdef __cplusplus
89}
90#endif /* __cplusplus */
91
92#endif /* LIBBSP_ARM_XILINX_VERSAL_UART_H */
ISR_Vector_number rtems_vector_number
This integer type represents interrupt vector numbers.
Definition: intr.h:102
Termios device context.
Definition: termiosdevice.h:68
Termios device handler.
Definition: termiosdevice.h:100
Definition: versal-uart.h:54
Definition: versal-uart-regs.h:51
void versal_uart_reset_tx_flush(rtems_termios_device_context *base)
Definition: versal-uart-polled.c:180