no-OS
linux_gpio.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * @file linux/linux_gpio.h
3  * @brief Header containing no_os_gpio_platform_ops used by the GPIO driver.
4  * @author Dragos Bogdan (dragos.bogdan@analog.com)
5 ********************************************************************************
6  * Copyright 2020(c) Analog Devices, Inc.
7  *
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions are met:
12  * - Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * - Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in
16  * the documentation and/or other materials provided with the
17  * distribution.
18  * - Neither the name of Analog Devices, Inc. nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  * - The use of this software may or may not infringe the patent rights
22  * of one or more patent holders. This license does not release you
23  * from the requirement that you obtain separate licenses from these
24  * patent holders to use this software.
25  * - Use of the software either in source or binary form, must be run
26  * on or directly connected to an Analog Devices Inc. component.
27  *
28  * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
29  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
30  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
31  * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
32  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33  * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
34  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 *******************************************************************************/
39 #ifndef LINUX_GPIO_H_
40 #define LINUX_GPIO_H_
41 
45 extern const struct no_os_gpio_platform_ops linux_gpio_ops;
46 
47 #endif // LINUX_GPIO_H_
no_os_udelay
void no_os_udelay(uint32_t usecs)
Generate microseconds delay.
Definition: linux_delay.c:56
no_os_timer_platform_ops
Structure holding timer function pointers that point to the platform specific function.
Definition: no_os_timer.h:107
generic_gpio_get
int32_t generic_gpio_get(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Obtain the GPIO decriptor.
Definition: generic_gpio.c:58
generic_trng_init
int generic_trng_init(struct no_os_trng_desc **desc, struct no_os_trng_init_param *param)
Definition: generic_trng.c:54
no_os_gpio_desc::extra
void * extra
Definition: no_os_gpio.h:112
GPIO_TIMEOUT_MS
#define GPIO_TIMEOUT_MS
Definition: linux_gpio.c:75
timeout
uint32_t timeout
Definition: ad413x.c:55
no_os_alloc.h
generic_gpio_get_value
int32_t generic_gpio_get_value(struct no_os_gpio_desc *desc, uint8_t *value)
Get the value of the specified GPIO.
Definition: generic_gpio.c:168
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:85
NO_OS_GPIO_OUT
#define NO_OS_GPIO_OUT
Definition: no_os_gpio.h:53
__attribute
__attribute((weak))
Give token to semaphore semaphore - Pointer toward the semaphore.
Definition: freertos_semaphore.c:76
linux_gpio_direction_output
int32_t linux_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: linux_gpio.c:319
generic_i2c_init
int32_t generic_i2c_init(struct no_os_i2c_desc **desc, const struct no_os_i2c_init_param *param)
Initialize the I2C communication peripheral.
Definition: generic_i2c.c:57
no_os_mutex_init
void no_os_mutex_init(void **mutex)
Initialize mutex. mutex - Pointer toward the mutex.
Definition: freertos_mutex.c:50
no_os_udelay
void no_os_udelay(uint32_t usecs)
Generate microseconds delay.
Definition: freertos_delay.c:50
configTICK_RATE_HZ
#define configTICK_RATE_HZ
Definition: FreeRTOSConfig.h:45
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Generate miliseconds delay.
Definition: freertos_delay.c:61
__attribute
__attribute((weak))
Unlock mutex. mutex - Pointer toward the mutex.
Definition: freertos_mutex.c:76
linux_gpio_desc
Linux platform specific GPIO descriptor.
Definition: linux_gpio.c:64
no_os_spi.h
Header file of SPI Interface.
generic_timer_remove
int32_t generic_timer_remove(struct no_os_timer_desc *desc)
Free the memory allocated by timer_setup().
Definition: generic_timer.c:73
no_os_axi_io_write
int32_t no_os_axi_io_write(uint32_t base, uint32_t offset, uint32_t data)
AXI IO through UIO specific write function.
Definition: linux_axi_io.c:185
no_os_uart_init
int32_t no_os_uart_init(struct no_os_uart_desc **desc, struct no_os_uart_init_param *param)
Initialize the UART communication peripheral.
Definition: generic_uart.c:131
linux_gpio_ops
const struct no_os_gpio_platform_ops linux_gpio_ops
Linux platform specific GPIO platform ops structure.
Definition: linux_gpio.c:376
generic_gpio_get_direction
int32_t generic_gpio_get_direction(struct no_os_gpio_desc *desc, uint8_t *direction)
Get the direction of the specified GPIO.
Definition: generic_gpio.c:133
no_os_semaphore_remove
void no_os_semaphore_remove(void *semaphore)
Remove semaphore. semaphore - Pointer toward the semaphore.
Definition: freertos_semaphore.c:87
no_os_spi_platform_ops
Structure holding SPI function pointers that point to the platform specific function.
Definition: no_os_spi.h:203
no_os_delay.h
Header file of Delay functions.
no_os_trng_platform_ops::init
int(* init)(struct no_os_trng_desc **, const struct no_os_trng_init_param *)
Definition: no_os_trng.h:92
generic_gpio_get_optional
int32_t generic_gpio_get_optional(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Get the value of an optional GPIO.
Definition: generic_gpio.c:73
no_os_axi_io_write
int32_t no_os_axi_io_write(uint32_t base, uint32_t offset, uint32_t data)
AXI IO generic write function.
Definition: generic_axi_io.c:75
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:123
no_os_gpio_init_param::number
int32_t number
Definition: no_os_gpio.h:89
generic_timer_count_clk_set
int32_t generic_timer_count_clk_set(struct no_os_timer_desc *desc, uint32_t freq_hz)
Set the timer clock frequency.
Definition: generic_timer.c:155
generic_timer_counter_get
int32_t generic_timer_counter_get(struct no_os_timer_desc *desc, uint32_t *counter)
Get the value of the counter register for the timer.
Definition: generic_timer.c:110
no_os_timer.h
Timer control module header.
no_os_axi_io.h
Header file of AXI IO.
no_os_time
Structure holding time data (seconds, microseconds).
Definition: no_os_delay.h:53
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:60
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Generate miliseconds delay.
Definition: linux_delay.c:66
no_os_uart_read_nonblocking
int32_t no_os_uart_read_nonblocking(struct no_os_uart_desc *desc, uint8_t *data, uint32_t bytes_number)
Submit reading buffer to the UART driver.
Definition: generic_uart.c:95
linux_gpio_desc::value_fd
int value_fd
Definition: linux_gpio.c:68
linux_gpio_remove
int32_t linux_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: linux_gpio.c:184
generic_timer_ops
const struct no_os_timer_platform_ops generic_timer_ops
generic platform specific timer platform ops structure
Definition: generic_timer.c:182
NO_OS_GPIO_IN
#define NO_OS_GPIO_IN
Definition: no_os_gpio.h:54
generic_spi_init
int32_t generic_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: generic_spi.c:57
NO_OS_GPIO_LOW
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:121
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:132
linux_gpio_ops
const struct no_os_gpio_platform_ops linux_gpio_ops
Linux specific GPIO platform ops structure.
Definition: linux_gpio.c:376
no_os_uart_desc
Stucture holding the UART descriptor.
Definition: no_os_uart.h:140
no_os_trng_desc
TRNG Descriptor.
Definition: no_os_trng.h:65
no_os_error.h
Error codes definition.
generic_spi_ops
const struct no_os_spi_platform_ops generic_spi_ops
Generic platform SPI ops.
Definition: generic_spi.c:99
no_os_trng.h
Header file of true random number generator.
generic_timer_stop
int32_t generic_timer_stop(struct no_os_timer_desc *desc)
Stop a timer from counting.
Definition: generic_timer.c:97
no_os_mutex_unlock
void no_os_mutex_unlock(void *mutex)
Function for unlocking mutex.
linux_gpio_desc::direction_fd
int direction_fd
Definition: linux_gpio.c:66
no_os_uart_remove
int32_t no_os_uart_remove(struct no_os_uart_desc *desc)
Free the resources allocated by no_os_uart_init().
Definition: generic_uart.c:145
no_os_mutex.h
generic_timer_init
int32_t generic_timer_init(struct no_os_timer_desc **desc, const struct no_os_timer_init_param *param)
Initialize hardware timer and the handler structure associated with it.
Definition: generic_timer.c:59
no_os_get_time
struct no_os_time no_os_get_time(void)
Get current time.
Definition: freertos_delay.c:70
no_os_uart_write_nonblocking
int32_t no_os_uart_write_nonblocking(struct no_os_uart_desc *desc, const uint8_t *data, uint32_t bytes_number)
Submit writting buffer to the UART driver.
Definition: generic_uart.c:114
linux_gpio_direction_input
int32_t linux_gpio_direction_input(struct no_os_gpio_desc *desc)
Enable the input direction of the specified GPIO.
Definition: linux_gpio.c:295
no_os_timer_platform_ops::init
int32_t(* init)(struct no_os_timer_desc **, const struct no_os_timer_init_param *)
Definition: no_os_timer.h:109
generic_i2c_write
int32_t generic_i2c_write(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
Write data to a slave device.
Definition: generic_i2c.c:88
no_os_trng_init_param
Init parameter for TRNG.
Definition: no_os_trng.h:76
no_os_uart_read
int32_t no_os_uart_read(struct no_os_uart_desc *desc, uint8_t *data, uint32_t bytes_number)
Read data from UART device.
Definition: generic_uart.c:59
no_os_i2c_platform_ops
Structure holding I2C function pointers that point to the platform specific function.
Definition: no_os_i2c.h:127
NO_OS_UNUSED_PARAM
#define NO_OS_UNUSED_PARAM(x)
Definition: no_os_util.h:115
generic_spi_write_and_read
int32_t generic_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: generic_spi.c:85
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:177
no_os_i2c_platform_ops::i2c_ops_init
int32_t(* i2c_ops_init)(struct no_os_i2c_desc **, const struct no_os_i2c_init_param *)
Definition: no_os_i2c.h:129
no_os_axi_io_read
int32_t no_os_axi_io_read(uint32_t base, uint32_t offset, uint32_t *data)
AXI IO generic read function.
Definition: generic_axi_io.c:59
generic_trng_fill_buffer
int generic_trng_fill_buffer(struct no_os_trng_desc *desc, uint8_t *buff, uint32_t len)
Definition: generic_trng.c:70
generic_gpio_remove
int32_t generic_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: generic_gpio.c:89
no_os_semaphore.h
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:102
linux_gpio_get_value
int32_t linux_gpio_get_value(struct no_os_gpio_desc *desc, uint8_t *value)
Get the value of the specified GPIO.
Definition: linux_gpio.c:267
no_os_i2c_desc
Structure holding I2C address descriptor.
Definition: no_os_i2c.h:107
generic_i2c_ops
const struct no_os_i2c_platform_ops generic_i2c_ops
Generic platform I2C ops.
Definition: generic_i2c.c:127
no_os_gpio_get
int32_t no_os_gpio_get(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Obtain the GPIO decriptor.
Definition: no_os_gpio.c:55
generic_timer_count_clk_get
int32_t generic_timer_count_clk_get(struct no_os_timer_desc *desc, uint32_t *freq_hz)
Get the timer clock frequency.
Definition: generic_timer.c:140
no_os_timer_init_param
Structure holding the parameters for timer initialization.
Definition: no_os_timer.h:89
generic_timer_start
int32_t generic_timer_start(struct no_os_timer_desc *desc)
Start a timer.
Definition: generic_timer.c:85
no_os_i2c.h
Header file of I2C Interface.
generic_gpio_direction_input
int32_t generic_gpio_direction_input(struct no_os_gpio_desc *desc)
Enable the input direction of the specified GPIO.
Definition: generic_gpio.c:101
no_os_semaphore_give
void no_os_semaphore_give(void *semaphore)
linux_gpio_set_value
int32_t linux_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: linux_gpio.c:239
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:75
no_os_time::us
unsigned int us
Definition: no_os_delay.h:54
generic_i2c_remove
int32_t generic_i2c_remove(struct no_os_i2c_desc *desc)
Free the resources allocated by no_os_i2c_init().
Definition: generic_i2c.c:71
no_os_axi_io_read
int32_t no_os_axi_io_read(uint32_t base, uint32_t offset, uint32_t *data)
AXI IO through UIO/devmem read function.
Definition: linux_axi_io.c:169
generic_i2c_read
int32_t generic_i2c_read(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
Read data from a slave device.
Definition: generic_i2c.c:111
linux_gpio_get
int32_t linux_gpio_get(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Obtain the GPIO decriptor.
Definition: linux_gpio.c:83
no_os_i2c_init_param
Structure holding the parameters for I2C initialization.
Definition: no_os_i2c.h:70
NULL
#define NULL
Definition: wrapper.h:64
no_os_uart_init_param
Structure holding the parameters for UART initialization.
Definition: no_os_uart.h:116
generic_gpio_ops
const struct no_os_gpio_platform_ops generic_gpio_ops
Generic platform GPIO ops.
Definition: generic_gpio.c:180
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Generate miliseconds delay.
Definition: generic_delay.c:66
generic_timer_counter_set
int32_t generic_timer_counter_set(struct no_os_timer_desc *desc, uint32_t new_val)
Set the timer counter register value.
Definition: generic_timer.c:125
fgets
char * fgets(char *dst, int num, FILE *stream)
Definition: no_os_platform.c:757
no_os_time::s
unsigned int s
Definition: no_os_delay.h:54
linux_gpio_get_direction
int32_t linux_gpio_get_direction(struct no_os_gpio_desc *desc, uint8_t *direction)
Get the direction of the specified GPIO.
Definition: linux_gpio.c:350
aducm_trng_ops
const struct no_os_trng_platform_ops aducm_trng_ops
Generic TRNG platform ops structure.
Definition: generic_trng.c:83
no_os_gpio_platform_ops
Structure holding gpio function pointers that point to the platform specific function.
Definition: no_os_gpio.h:133
no_os_uart_write
int32_t no_os_uart_write(struct no_os_uart_desc *desc, const uint8_t *data, uint32_t bytes_number)
Write data to UART device.
Definition: generic_uart.c:76
no_os_semaphore_init
void no_os_semaphore_init(void **semaphore)
Initialize semaphore. semaphore - Pointer toward the semaphore.
Definition: freertos_semaphore.c:49
no_os_gpio.h
Header file of GPIO Interface.
generic_trng_remove
int generic_trng_remove(struct no_os_trng_desc *desc)
Definition: generic_trng.c:64
generic_gpio_set_value
int32_t generic_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: generic_gpio.c:151
no_os_uart.h
Header file of UART interface.
no_os_timer_desc
Structure holding timer descriptor.
Definition: no_os_timer.h:63
no_os_semaphore_take
void no_os_semaphore_take(void *semaphore)
Take token from semaphore. semaphore - Pointer toward the semaphore.
Definition: freertos_semaphore.c:65
no_os_util.h
Header file of utility functions.
no_os_gpio_platform_ops::gpio_ops_get
int32_t(* gpio_ops_get)(struct no_os_gpio_desc **, const struct no_os_gpio_init_param *)
Definition: no_os_gpio.h:135
no_os_trng_platform_ops
Structure holding TRNG function pointers that point to the platform specific function.
Definition: no_os_trng.h:90
no_os_spi_platform_ops::init
int32_t(* init)(struct no_os_spi_desc **, const struct no_os_spi_init_param *)
Definition: no_os_spi.h:205
no_os_mutex_remove
void no_os_mutex_remove(void *mutex)
Remove mutex. mutex - Pointer toward the mutex.
Definition: freertos_mutex.c:87
no_os_uart_get_errors
uint32_t no_os_uart_get_errors(struct no_os_uart_desc *desc)
Get number of UART errors.
Definition: generic_uart.c:157
no_os_mutex_lock
void no_os_mutex_lock(void *mutex)
Lock mutex. mutex - Pointer toward the mutex.
Definition: freertos_mutex.c:66
linux_gpio_get_optional
int32_t linux_gpio_get_optional(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Get the value of an optional GPIO.
Definition: linux_gpio.c:171
no_os_gpio_desc::number
int32_t number
Definition: no_os_gpio.h:106
no_os_udelay
void no_os_udelay(uint32_t usecs)
Generate microseconds delay.
Definition: generic_delay.c:56
errno.h
Error macro definition for ARM Compiler.
generic_gpio_direction_output
int32_t generic_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: generic_gpio.c:116
generic_spi_remove
int32_t generic_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: generic_spi.c:71
generic_timer_get_elapsed_time_nsec
int32_t generic_timer_get_elapsed_time_nsec(struct no_os_timer_desc *desc, uint64_t *elapsed_time)
Get the elapsed time in nsec for the timer.
Definition: generic_timer.c:170
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:131