![]() |
|
|||
File indexing completed on 2025-05-11 08:22:42
0001 /* SPDX-License-Identifier: BSD-2-Clause */ 0002 0003 /** 0004 * @file 0005 * 0006 * @ingroup RTEMSBSPsAArch64RaspberryPi 0007 * 0008 * @brief Raspberry Pi 4B specific GPIO definitions. 0009 */ 0010 0011 /* 0012 * Copyright (C) 2023 Utkarsh Verma 0013 * 0014 * Redistribution and use in source and binary forms, with or without 0015 * modification, are permitted provided that the following conditions 0016 * are met: 0017 * 1. Redistributions of source code must retain the above copyright 0018 * notice, this list of conditions and the following disclaimer. 0019 * 2. Redistributions in binary form must reproduce the above copyright 0020 * notice, this list of conditions and the following disclaimer in the 0021 * documentation and/or other materials provided with the distribution. 0022 * 0023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 0024 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 0025 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 0026 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 0027 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 0028 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 0029 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 0030 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 0031 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 0032 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 0033 * POSSIBILITY OF SUCH DAMAGE. 0034 */ 0035 0036 #ifndef LIBBSP_AARCH64_RASPBERRYPI_BSP_RPI_GPIO_H 0037 #define LIBBSP_AARCH64_RASPBERRYPI_BSP_RPI_GPIO_H 0038 0039 #include <bspopts.h> 0040 #include <rtems/rtems/status.h> 0041 0042 /** 0043 * @brief Raspberry Pi GPIO functions. 0044 */ 0045 0046 typedef enum { 0047 GPIO_INPUT, 0048 GPIO_OUTPUT, 0049 GPIO_AF5, 0050 GPIO_AF4, 0051 GPIO_AF0, 0052 GPIO_AF1, 0053 GPIO_AF2, 0054 GPIO_AF3, 0055 } raspberrypi_gpio_function; 0056 0057 typedef enum { 0058 GPIO_PULL_NONE, 0059 GPIO_PULL_UP, 0060 GPIO_PULL_DOWN, 0061 } raspberrypi_gpio_pull; 0062 0063 /** 0064 * @brief Set the operation of the general-purpose I/O pins. Each of the 58 0065 * GPIO pins has at least two alternative functions as defined. 0066 * 0067 * @param pin The GPIO pin. 0068 * @param value The optional functions are GPIO_INPUT, GPIO_OUTPUT, GPIO_AF5, 0069 * GPIO_AF4, GPIO_AF0, GPIO_AF1, GPIO_AF2, GPIO_AF3. 0070 * 0071 * @retval RTEMS_SUCCESSFUL GPIO function successfully configured. 0072 * @retval RTEMS_INVALID_NUMBER This status code indicates that a specified 0073 * number was invalid. 0074 */ 0075 rtems_status_code raspberrypi_gpio_set_function( 0076 const unsigned int pin, 0077 const raspberrypi_gpio_function value 0078 ); 0079 0080 /** 0081 * @brief Set a GPIO pin. 0082 * 0083 * @param pin The GPIO pin. 0084 * 0085 * @retval RTEMS_SUCCESSFUL GPIO pin set successfully. 0086 * @retval RTEMS_INVALID_NUMBER This status code indicates that a specified 0087 * number was invalid. 0088 */ 0089 rtems_status_code raspberrypi_gpio_set_pin(const unsigned int pin); 0090 0091 /** 0092 * @brief Clear a GPIO pin. 0093 * 0094 * @param pin The GPIO pin. 0095 * 0096 * @retval RTEMS_SUCCESSFUL GPIO pin clear successfully. 0097 * @retval RTEMS_INVALID_NUMBER This status code indicates that a specified 0098 * number was invalid. 0099 */ 0100 rtems_status_code raspberrypi_gpio_clear_pin(const unsigned int pin); 0101 0102 /** 0103 * @brief Control the actuation of the internal pull-up/down resistors. 0104 * 0105 * @param pin The GPIO pin. 0106 * @param value The optional value are GPIO_PULL_NONE, GPIO_PULL_UP, 0107 * GPIO_PULL_DOWN. 0108 * 0109 * @retval RTEMS_SUCCESSFUL GPIO pull set successfully. 0110 * @retval RTEMS_INVALID_NUMBER This status code indicates that a specified 0111 * number was invalid. 0112 */ 0113 rtems_status_code raspberrypi_gpio_set_pull( 0114 const unsigned int pin, 0115 const raspberrypi_gpio_pull value 0116 ); 0117 0118 #endif /* LIBBSP_AARCH64_RASPBERRYPI_BSP_RPI_GPIO_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |