no-OS
aducm3029_gpio.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * @file aducm3029/aducm3029_gpio.h
3  * @brief Header containing no_os_gpio_platform_ops used by the GPIO driver.
4  * @author Andrei Porumb (andrei.porumb@analog.com)
5 ********************************************************************************
6  * Copyright 2021(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 ADUCM3029_GPIO_H_
34 #define ADUCM3029_GPIO_H_
35 
36 
38 #define PIN(nb) (1u << ((nb) & 0x0F))
39 
40 #define PORT(nb) (((nb) & 0xF0) >> 4)
41 
45 extern const struct no_os_gpio_platform_ops aducm_gpio_ops;
46 
47 #endif // ADUCM3029_GPIO_H_
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
aducm_gpio_ops
const struct no_os_gpio_platform_ops aducm_gpio_ops
ADuCM3029 specific GPIO platform ops structure.
Definition: aducm3029_gpio.c:289
NO_OS_GPIO_HIGH_Z
@ NO_OS_GPIO_HIGH_Z
Definition: no_os_gpio.h:119
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
aducm3029_gpio_direction_output
int32_t aducm3029_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO and set the GPIO to the specified value.
Definition: aducm3029_gpio.c:159
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
aducm3029_gpio_remove
int32_t aducm3029_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: aducm3029_gpio.c:120
NO_OS_GPIO_IN
#define NO_OS_GPIO_IN
Definition: no_os_gpio.h:48
aducm3029_gpio_get_direction
int32_t aducm3029_gpio_get_direction(struct no_os_gpio_desc *desc, uint8_t *direction)
Get the direction of the specified GPIO.
Definition: aducm3029_gpio.c:191
NO_OS_GPIO_LOW
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:115
aducm3029_gpio_direction_input
int32_t aducm3029_gpio_direction_input(struct no_os_gpio_desc *desc)
Enable the input direction of the specified GPIO.
Definition: aducm3029_gpio.c:140
no_os_error.h
Error codes definition.
PORT
#define PORT(nb)
Definition: aducm3029_gpio.h:40
aducm3029_gpio_get
int32_t aducm3029_gpio_get(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Obtain the GPIO descriptor from the number specified in param.
Definition: aducm3029_gpio.c:64
aducm3029_gpio_set_value
int32_t aducm3029_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: aducm3029_gpio.c:218
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
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
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
aducm_gpio_ops
const struct no_os_gpio_platform_ops aducm_gpio_ops
ADuCM3029 platform specific GPIO platform ops structure.
Definition: aducm3029_gpio.c:289
NULL
#define NULL
Definition: wrapper.h:64
aducm3029_gpio_get_optional
int32_t aducm3029_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: aducm3029_gpio.c:104
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.h
Header file of GPIO Interface.
aducm3029_gpio_get_value
int32_t aducm3029_gpio_get_value(struct no_os_gpio_desc *desc, uint8_t *value)
Get the value of the specified GPIO.
Definition: aducm3029_gpio.c:258
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
aducm3029_gpio.h
PIN
@ PIN
Definition: t_ad9528.h:162
no_os_gpio_desc::number
int32_t number
Definition: no_os_gpio.h:100