RTEMS 6.1-rc4
Loading...
Searching...
No Matches
raspberrypi-uart.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * Copyright (C) 2023 Utkarsh Verma
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_AARCH64_RASPBERRYPI_BSP_RASPBERRYPI_UART_H
37#define LIBBSP_AARCH64_RASPBERRYPI_BSP_RASPBERRYPI_UART_H
38
39#include <bspopts.h>
40#include <bsp/irq.h>
41#include <bsp/raspberrypi.h>
42#include <bsp/rpi-gpio.h>
44
45/*
46 * This macro exists to serve as a common point of definition for the
47 * parameters of the UARTs present in the Raspberry Pi 4. It is used in
48 * multiple locations with different rendering macros to prevent duplication
49 * of information.
50 */
51#define RASPBERRYPI_CONSOLE_DEVICES(CONSOLE_DEVICE_DEFINITION_RENDERER) \
52 CONSOLE_DEVICE_DEFINITION_RENDERER( \
53 0, "/dev/ttyAMA0", BCM2711_UART0_BASE,BCM2711_UART0_SIZE, \
54 BSP_PL011_CLOCK_FREQ, BCM2711_IRQ_PL011_UART, arm_pl011_context, \
55 &arm_pl011_fns, arm_pl011_write_polled, 15, 14, GPIO_AF0) \
56 CONSOLE_DEVICE_DEFINITION_RENDERER( \
57 2, "/dev/ttyAMA1", BCM2711_UART2_BASE, BCM2711_UART2_SIZE, \
58 BSP_PL011_CLOCK_FREQ, BCM2711_IRQ_PL011_UART, arm_pl011_context, \
59 &arm_pl011_fns, arm_pl011_write_polled, 1, 0, GPIO_AF4) \
60 CONSOLE_DEVICE_DEFINITION_RENDERER( \
61 3, "/dev/ttyAMA2", BCM2711_UART3_BASE, BCM2711_UART3_SIZE, \
62 BSP_PL011_CLOCK_FREQ, BCM2711_IRQ_PL011_UART, arm_pl011_context, \
63 &arm_pl011_fns, arm_pl011_write_polled, 5, 4, GPIO_AF4) \
64 CONSOLE_DEVICE_DEFINITION_RENDERER( \
65 4, "/dev/ttyAMA3", BCM2711_UART4_BASE, BCM2711_UART4_SIZE, \
66 BSP_PL011_CLOCK_FREQ, BCM2711_IRQ_PL011_UART, arm_pl011_context, \
67 &arm_pl011_fns, arm_pl011_write_polled, 9, 8, GPIO_AF4) \
68 CONSOLE_DEVICE_DEFINITION_RENDERER( \
69 5, "/dev/ttyAMA4", BCM2711_UART5_BASE, BCM2711_UART5_SIZE, \
70 BSP_PL011_CLOCK_FREQ, BCM2711_IRQ_PL011_UART, arm_pl011_context, \
71 &arm_pl011_fns, arm_pl011_write_polled, 13, 12, GPIO_AF4)
72#endif /* LIBBSP_AARCH64_RASPBERRYPI_BSP_RASPBERRYPI_UART_H */
ARM PL011 Support Package.