no-OS
xilinx_gpio.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * @file xilinx/xilinx_gpio.h
3  * @brief Header containing extra types used in the gpio driver
4  * @author scuciurean (sergiu.cuciurean@analog.com)
5 ********************************************************************************
6  * Copyright 2019(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 
34 #ifndef XILINX_GPIO_H_
35 #define XILINX_GPIO_H_
36 
37 /******************************************************************************/
38 /***************************** Include Files **********************************/
39 /******************************************************************************/
40 
41 #include <stdint.h>
42 #include <stdbool.h>
43 
44 /******************************************************************************/
45 /*************************** Types Declarations *******************************/
46 /******************************************************************************/
47 
57 };
58 
68  uint32_t device_id;
69 };
70 
75 struct xil_gpio_desc {
79  void *config;
81  void *instance;
82 };
83 
87 extern const struct no_os_gpio_platform_ops xil_gpio_ops;
88 
89 #endif
no_os_gpio_desc::extra
void * extra
Definition: no_os_gpio.h:106
no_os_alloc.h
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
no_os_get_time
struct no_os_time no_os_get_time(void)
Get current time.
Definition: xilinx_delay.c:81
xil_gpio_get_optional
int32_t xil_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: xilinx_gpio.c:170
GPIO_PS
@ GPIO_PS
Definition: xilinx_gpio.h:56
no_os_delay.h
Header file of Delay functions.
xil_gpio_ops
const struct no_os_gpio_platform_ops xil_gpio_ops
Xilinx platform specific GPIO platform ops structure.
Definition: xilinx_gpio.c:450
xil_gpio_desc::type
enum xil_gpio_type type
Definition: xilinx_gpio.h:77
xil_gpio_get_value
int32_t xil_gpio_get_value(struct no_os_gpio_desc *desc, uint8_t *value)
Get the value of the specified GPIO.
Definition: xilinx_gpio.c:410
xil_gpio_type
xil_gpio_type
Xilinx platform architecture sections.
Definition: xilinx_gpio.h:52
no_os_gpio_init_param::number
int32_t number
Definition: no_os_gpio.h:83
xil_gpio_init_param::device_id
uint32_t device_id
Definition: xilinx_gpio.h:68
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
xil_gpio_direction_output
int32_t xil_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: xilinx_gpio.c:251
NO_OS_GPIO_IN
#define NO_OS_GPIO_IN
Definition: no_os_gpio.h:48
xil_gpio_desc::instance
void * instance
Definition: xilinx_gpio.h:81
no_os_error.h
Error codes definition.
xil_gpio_set_value
int32_t xil_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: xilinx_gpio.c:362
xil_gpio_desc::config
void * config
Definition: xilinx_gpio.h:79
xilinx_gpio.h
no_os_div_u64_rem
uint64_t no_os_div_u64_rem(uint64_t dividend, uint32_t divisor, uint32_t *remainder)
xil_gpio_get_direction
int32_t xil_gpio_get_direction(struct no_os_gpio_desc *desc, uint8_t *direction)
Get the direction of the specified GPIO.
Definition: xilinx_gpio.c:316
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
xil_gpio_ops
const struct no_os_gpio_platform_ops xil_gpio_ops
Xilinx platform specific gpio platform ops structure.
Definition: xilinx_gpio.c:450
no_os_malloc
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:43
no_os_axi_io_write
int32_t no_os_axi_io_write(uint32_t base, uint32_t offset, uint32_t data)
AXI IO Xilinx specific write function.
Definition: xilinx_axi_io.c:67
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
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Generate miliseconds delay.
Definition: xilinx_delay.c:68
NULL
#define NULL
Definition: wrapper.h:64
no_os_time::s
unsigned int s
Definition: no_os_delay.h:48
no_os_udelay
void no_os_udelay(uint32_t usecs)
Generate microseconds delay.
Definition: xilinx_delay.c:54
xil_gpio_init_param
Structure holding the initialization parameters for Xilinx platform specific GPIO parameters.
Definition: xilinx_gpio.h:64
xil_gpio_remove
int32_t xil_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: xilinx_gpio.c:186
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_gpio_init_param::extra
void * extra
Definition: no_os_gpio.h:89
no_os_gpio.h
Header file of GPIO Interface.
GPIO_PL
@ GPIO_PL
Definition: xilinx_gpio.h:54
_gpio_init
int32_t _gpio_init(struct no_os_gpio_desc *desc, const struct no_os_gpio_init_param *param)
Prepare the GPIO decriptor.
Definition: xilinx_gpio.c:63
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
xil_gpio_get
int32_t xil_gpio_get(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Obtain the GPIO decriptor.
Definition: xilinx_gpio.c:135
no_os_gpio_desc::number
int32_t number
Definition: no_os_gpio.h:100
xil_gpio_init_param::type
enum xil_gpio_type type
Definition: xilinx_gpio.h:66
xil_gpio_direction_input
int32_t xil_gpio_direction_input(struct no_os_gpio_desc *desc)
Enable the input direction of the specified GPIO.
Definition: xilinx_gpio.c:202
xil_gpio_desc
Xilinx platform specific GPIO descriptor.
Definition: xilinx_gpio.h:75
no_os_axi_io_read
int32_t no_os_axi_io_read(uint32_t base, uint32_t offset, uint32_t *data)
AXI IO Xilinx specific read function.
Definition: xilinx_axi_io.c:53
no_os_div_u64
uint64_t no_os_div_u64(uint64_t dividend, uint32_t divisor)