RTEMS 6.1-rc4
Loading...
Searching...
No Matches
Macros | Functions
gpio.c File Reference

GPIO Driver. More...

#include <rtems/rtems/status.h>
#include <stdint.h>
#include <bsp/rpi-gpio.h>
#include <bsp/raspberrypi.h>

Macros

#define BSP_GPIO_BASE   BCM2711_GPIO_BASE
 
#define BSP_GPIO_SIZE   BCM2711_GPIO_SIZE
 
#define BSP_GPIO_PIN_COUNT   BCM2711_GPIO_PIN_COUNT
 
#define GPFSEL0   BCM2835_REG(BSP_GPIO_BASE + 0x00)
 
#define GPSET0   BCM2835_REG(BSP_GPIO_BASE + 0x1c)
 
#define GPCLR0   BCM2835_REG(BSP_GPIO_BASE + 0x28)
 
#define GPIO_PUP_PDN_CTRL_REG0   BCM2835_REG(BSP_GPIO_BASE + 0xe4)
 
#define FSELn_SIZE   3
 
#define CLRn_SIZE   1
 
#define SETn_SIZE   1
 
#define REG_SET   1
 

Functions

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 alternative functions as defined.
 
rtems_status_code raspberrypi_gpio_clear_pin (const unsigned int pin)
 Clear a GPIO pin.
 
rtems_status_code raspberrypi_gpio_set_pin (const unsigned int pin)
 Set a GPIO pin.
 
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.
 

Detailed Description

GPIO Driver.

Function Documentation

◆ raspberrypi_gpio_clear_pin()

rtems_status_code raspberrypi_gpio_clear_pin ( const unsigned int  pin)

Clear a GPIO pin.

Parameters
pinThe GPIO pin.
Return values
RTEMS_SUCCESSFULGPIO pin clear successfully.
RTEMS_INVALID_NUMBERThis status code indicates that a specified number was invalid.

◆ raspberrypi_gpio_set_function()

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 alternative functions as defined.

Parameters
pinThe GPIO pin.
valueThe optional functions are GPIO_INPUT, GPIO_OUTPUT, GPIO_AF5, GPIO_AF4, GPIO_AF0, GPIO_AF1, GPIO_AF2, GPIO_AF3.
Return values
RTEMS_SUCCESSFULGPIO function successfully configured.
RTEMS_INVALID_NUMBERThis status code indicates that a specified number was invalid.

◆ raspberrypi_gpio_set_pin()

rtems_status_code raspberrypi_gpio_set_pin ( const unsigned int  pin)

Set a GPIO pin.

Parameters
pinThe GPIO pin.
Return values
RTEMS_SUCCESSFULGPIO pin set successfully.
RTEMS_INVALID_NUMBERThis status code indicates that a specified number was invalid.

◆ raspberrypi_gpio_set_pull()

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.

Parameters
pinThe GPIO pin.
valueThe optional value are GPIO_PULL_NONE, GPIO_PULL_UP, GPIO_PULL_DOWN.
Return values
RTEMS_SUCCESSFULGPIO pull set successfully.
RTEMS_INVALID_NUMBERThis status code indicates that a specified number was invalid.