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  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice,
12  * this list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  *
18  * 3. Neither the name of Analog Devices, Inc. nor the names of its
19  * contributors may be used to endorse or promote products derived from this
20  * software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR
23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
25  * EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
28  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *******************************************************************************/
33 #ifndef LINUX_GPIO_H_
34 #define LINUX_GPIO_H_
35 
39 extern const struct no_os_gpio_platform_ops linux_gpio_ops;
40 
41 #endif // LINUX_GPIO_H_
no_os_udelay
void no_os_udelay(uint32_t usecs)
Generate microseconds delay.
Definition: linux_delay.c:50
no_os_timer_platform_ops
Structure holding timer function pointers that point to the platform specific function.
Definition: no_os_timer.h:101
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:52
generic_trng_init
int generic_trng_init(struct no_os_trng_desc **desc, struct no_os_trng_init_param *param)
Definition: generic_trng.c:48
no_os_gpio_desc::extra
void * extra
Definition: no_os_gpio.h:106
GPIO_TIMEOUT_MS
#define GPIO_TIMEOUT_MS
Definition: linux_gpio.c:69
timeout
uint32_t timeout
Definition: ad413x.c:49
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:162
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
NO_OS_GPIO_OUT
#define NO_OS_GPIO_OUT
Definition: no_os_gpio.h:47
__attribute
__attribute((weak))
Give token to semaphore semaphore - Pointer toward the semaphore.
Definition: freertos_semaphore.c:70
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:313
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:51
no_os_mutex_init
void no_os_mutex_init(void **mutex)
Initialize mutex. mutex - Pointer toward the mutex.
Definition: freertos_mutex.c:44
no_os_udelay
void no_os_udelay(uint32_t usecs)
Generate microseconds delay.
Definition: freertos_delay.c:44
configTICK_RATE_HZ
#define configTICK_RATE_HZ
Definition: FreeRTOSConfig.h:39
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Generate miliseconds delay.
Definition: freertos_delay.c:55
__attribute
__attribute((weak))
Unlock mutex. mutex - Pointer toward the mutex.
Definition: freertos_mutex.c:70
linux_gpio_desc
Linux platform specific GPIO descriptor.
Definition: linux_gpio.c:58
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:67
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:179
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:125
linux_gpio_ops
const struct no_os_gpio_platform_ops linux_gpio_ops
Linux platform specific GPIO platform ops structure.
Definition: linux_gpio.c:370
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:127
no_os_semaphore_remove
void no_os_semaphore_remove(void *semaphore)
Remove semaphore. semaphore - Pointer toward the semaphore.
Definition: freertos_semaphore.c:81
no_os_spi_platform_ops
Structure holding SPI function pointers that point to the platform specific function.
Definition: no_os_spi.h:222
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:86
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:67
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:69
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:117
no_os_gpio_init_param::number
int32_t number
Definition: no_os_gpio.h:83
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:149
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:104
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:47
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:54
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Generate miliseconds delay.
Definition: linux_delay.c:60
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:89
linux_gpio_desc::value_fd
int value_fd
Definition: linux_gpio.c:62
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:178
generic_timer_ops
const struct no_os_timer_platform_ops generic_timer_ops
generic platform specific timer platform ops structure
Definition: generic_timer.c:176
NO_OS_GPIO_IN
#define NO_OS_GPIO_IN
Definition: no_os_gpio.h:48
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:51
NO_OS_GPIO_LOW
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:115
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
linux_gpio_ops
const struct no_os_gpio_platform_ops linux_gpio_ops
Linux specific GPIO platform ops structure.
Definition: linux_gpio.c:370
no_os_uart_desc
Stucture holding the UART descriptor.
Definition: no_os_uart.h:134
no_os_trng_desc
TRNG Descriptor.
Definition: no_os_trng.h:59
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:93
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:91
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:60
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:139
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:53
no_os_get_time
struct no_os_time no_os_get_time(void)
Get current time.
Definition: freertos_delay.c:64
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:108
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:289
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:103
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:82
no_os_trng_init_param
Init parameter for TRNG.
Definition: no_os_trng.h:70
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:53
no_os_i2c_platform_ops
Structure holding I2C function pointers that point to the platform specific function.
Definition: no_os_i2c.h:121
NO_OS_UNUSED_PARAM
#define NO_OS_UNUSED_PARAM(x)
Definition: no_os_util.h:117
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:79
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
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:123
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:53
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:64
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:83
no_os_semaphore.h
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
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:261
no_os_i2c_desc
Structure holding I2C address descriptor.
Definition: no_os_i2c.h:101
generic_i2c_ops
const struct no_os_i2c_platform_ops generic_i2c_ops
Generic platform I2C ops.
Definition: generic_i2c.c:121
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:49
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:134
no_os_timer_init_param
Structure holding the parameters for timer initialization.
Definition: no_os_timer.h:83
generic_timer_start
int32_t generic_timer_start(struct no_os_timer_desc *desc)
Start a timer.
Definition: generic_timer.c:79
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:95
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:233
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:69
no_os_time::us
unsigned int us
Definition: no_os_delay.h:48
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:65
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:163
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:105
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:77
no_os_i2c_init_param
Structure holding the parameters for I2C initialization.
Definition: no_os_i2c.h:64
NULL
#define NULL
Definition: wrapper.h:64
no_os_uart_init_param
Structure holding the parameters for UART initialization.
Definition: no_os_uart.h:110
generic_gpio_ops
const struct no_os_gpio_platform_ops generic_gpio_ops
Generic platform GPIO ops.
Definition: generic_gpio.c:174
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Generate miliseconds delay.
Definition: generic_delay.c:60
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:119
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:48
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:344
aducm_trng_ops
const struct no_os_trng_platform_ops aducm_trng_ops
Generic TRNG platform ops structure.
Definition: generic_trng.c:77
no_os_gpio_platform_ops
Structure holding gpio function pointers that point to the platform specific function.
Definition: no_os_gpio.h:127
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:70
no_os_semaphore_init
void no_os_semaphore_init(void **semaphore)
Initialize semaphore. semaphore - Pointer toward the semaphore.
Definition: freertos_semaphore.c:43
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:58
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:145
no_os_uart.h
Header file of UART interface.
no_os_timer_desc
Structure holding timer descriptor.
Definition: no_os_timer.h:57
no_os_semaphore_take
void no_os_semaphore_take(void *semaphore)
Take token from semaphore. semaphore - Pointer toward the semaphore.
Definition: freertos_semaphore.c:59
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:129
no_os_trng_platform_ops
Structure holding TRNG function pointers that point to the platform specific function.
Definition: no_os_trng.h:84
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:224
no_os_mutex_remove
void no_os_mutex_remove(void *mutex)
Remove mutex. mutex - Pointer toward the mutex.
Definition: freertos_mutex.c:81
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:151
no_os_mutex_lock
void no_os_mutex_lock(void *mutex)
Lock mutex. mutex - Pointer toward the mutex.
Definition: freertos_mutex.c:60
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:165
no_os_gpio_desc::number
int32_t number
Definition: no_os_gpio.h:100
no_os_udelay
void no_os_udelay(uint32_t usecs)
Generate microseconds delay.
Definition: generic_delay.c:50
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:110
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:65
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:164
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140