RTEMS 6.1-rc7
Loading...
Searching...
No Matches
rpi-gpio.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_RPI_GPIO_H
37#define LIBBSP_AARCH64_RASPBERRYPI_BSP_RPI_GPIO_H
38
39#include <bspopts.h>
40#include <rtems/rtems/status.h>
41
46typedef enum {
47 GPIO_INPUT,
48 GPIO_OUTPUT,
49 GPIO_AF5,
50 GPIO_AF4,
51 GPIO_AF0,
52 GPIO_AF1,
53 GPIO_AF2,
54 GPIO_AF3,
56
57typedef enum {
58 GPIO_PULL_NONE,
59 GPIO_PULL_UP,
60 GPIO_PULL_DOWN,
61} raspberrypi_gpio_pull;
62
76 const unsigned int pin,
78);
79
89rtems_status_code raspberrypi_gpio_set_pin(const unsigned int pin);
90
100rtems_status_code raspberrypi_gpio_clear_pin(const unsigned int pin);
101
114 const unsigned int pin,
115 const raspberrypi_gpio_pull value
116);
117
118#endif /* LIBBSP_AARCH64_RASPBERRYPI_BSP_RPI_GPIO_H */
rtems_status_code raspberrypi_gpio_set_pull(const unsigned int pin, const raspberrypi_gpio_pull value)
Control the actuation of the internal pull-up/down resistors.
Definition: gpio.c:104
raspberrypi_gpio_function
Raspberry Pi GPIO functions.
Definition: rpi-gpio.h:46
rtems_status_code raspberrypi_gpio_set_pin(const unsigned int pin)
Set a GPIO pin.
Definition: gpio.c:99
rtems_status_code raspberrypi_gpio_set_function(const unsigned int pin, const raspberrypi_gpio_function value)
Set the operation of the general-purpose I/O pins. Each of the 58 GPIO pins has at least two alternat...
Definition: gpio.c:86
rtems_status_code raspberrypi_gpio_clear_pin(const unsigned int pin)
Clear a GPIO pin.
Definition: gpio.c:94
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:85
This header file provides the status codes of Classic API directives and support functions.