[PATCH] Fixes GPIO APIs Naming Convention and Comments

Ben Gras beng at shrike-systems.com
Tue Oct 13 07:11:30 UTC 2015


All,

This change renames these gpio-specific functions:

rtems_bsp_enable_interrupt
rtems_bsp_disable_interrupt
rtems_bsp_select_specific_io

to

rtems_gpio_bsp_enable_interrupt
rtems_gpio_bsp_disable_interrupt
rtems_gpio_bsp_select_specific_io


+1, Definitely an improvement.


On Mon, Oct 12, 2015 at 7:37 PM, sudarshan.rajagopalan
<sudarshan.rajagopalan at vecna.com> wrote:
>
> Just found few function names to be inconsistent towards the naming
> convention, and also few API documentation in the RTEMS GPIO files. Please
> commit this if required.
>
> Thanks and Regards,
> Sudarshan Rajagopalan
>
> From e17ce266ba4cfaec0159c5477697847629946ced Mon Sep 17 00:00:00 2001
> From: Sudarshan Rajagopalan <sudarshan.rajagopalan at vecna.com>
> Date: Mon, 12 Oct 2015 12:47:35 -0400
> Subject: [PATCH] Fixes GPIO APIs Naming Convention and Comments
>
> ---
>  c/src/lib/libbsp/arm/beagle/gpio/bbb-gpio.c      |  8 ++++----
>  c/src/lib/libbsp/arm/raspberrypi/gpio/rpi-gpio.c |  4 ++--
>  c/src/lib/libbsp/shared/gpio.c                   |  6 +++---
>  c/src/lib/libbsp/shared/include/gpio.h           | 20 ++++++++++++--------
>  4 files changed, 21 insertions(+), 17 deletions(-)
>
> diff --git a/c/src/lib/libbsp/arm/beagle/gpio/bbb-gpio.c
> b/c/src/lib/libbsp/arm/beagle/gpio/bbb-gpio.c
> index 8cf690f..9737dec 100644
> --- a/c/src/lib/libbsp/arm/beagle/gpio/bbb-gpio.c
> +++ b/c/src/lib/libbsp/arm/beagle/gpio/bbb-gpio.c
> @@ -299,7 +299,7 @@ uint32_t
> rtems_gpio_bsp_interrupt_line(rtems_vector_number vector)
>    return event_status;
>  }
>
> -rtems_status_code rtems_bsp_enable_interrupt(
> +rtems_status_code rtems_gpio_bsp_enable_interrupt(
>    uint32_t bank,
>    uint32_t pin,
>    rtems_gpio_interrupt interrupt
> @@ -354,7 +354,7 @@ rtems_status_code rtems_bsp_enable_interrupt(
>    return RTEMS_SUCCESSFUL;
>  }
>
> -rtems_status_code rtems_bsp_disable_interrupt(
> +rtems_status_code rtems_gpio_bsp_disable_interrupt(
>    uint32_t bank,
>    uint32_t pin,
>    rtems_gpio_interrupt interrupt
> @@ -528,7 +528,7 @@ uint32_t
> rtems_gpio_bsp_interrupt_line(rtems_vector_number vector)
>    return -1;
>  }
>
> -rtems_status_code rtems_bsp_enable_interrupt(
> +rtems_status_code rtems_gpio_bsp_enable_interrupt(
>    uint32_t bank,
>    uint32_t pin,
>    rtems_gpio_interrupt interrupt
> @@ -536,7 +536,7 @@ rtems_status_code rtems_bsp_enable_interrupt(
>    return RTEMS_NOT_DEFINED;
>  }
>
> -rtems_status_code rtems_bsp_disable_interrupt(
> +rtems_status_code rtems_gpio_bsp_disable_interrupt(
>    uint32_t bank,
>    uint32_t pin,
>    rtems_gpio_interrupt interrupt
> diff --git a/c/src/lib/libbsp/arm/raspberrypi/gpio/rpi-gpio.c
> b/c/src/lib/libbsp/arm/raspberrypi/gpio/rpi-gpio.c
> index a782d11..4fb2c93 100644
> --- a/c/src/lib/libbsp/arm/raspberrypi/gpio/rpi-gpio.c
> +++ b/c/src/lib/libbsp/arm/raspberrypi/gpio/rpi-gpio.c
> @@ -183,7 +183,7 @@ uint32_t
> rtems_gpio_bsp_interrupt_line(rtems_vector_number vector)
>    return event_status;
>  }
>
> -rtems_status_code rtems_bsp_enable_interrupt(
> +rtems_status_code rtems_gpio_bsp_enable_interrupt(
>    uint32_t bank,
>    uint32_t pin,
>    rtems_gpio_interrupt interrupt
> @@ -227,7 +227,7 @@ rtems_status_code rtems_bsp_enable_interrupt(
>    return RTEMS_SUCCESSFUL;
>  }
>
> -rtems_status_code rtems_bsp_disable_interrupt(
> +rtems_status_code rtems_gpio_bsp_disable_interrupt(
>    uint32_t bank,
>    uint32_t pin,
>    rtems_gpio_interrupt interrupt
> diff --git a/c/src/lib/libbsp/shared/gpio.c b/c/src/lib/libbsp/shared/gpio.c
> index 80e2727..b806556 100644
> --- a/c/src/lib/libbsp/shared/gpio.c
> +++ b/c/src/lib/libbsp/shared/gpio.c
> @@ -1341,7 +1341,7 @@ rtems_status_code rtems_gpio_request_pin(
>          return RTEMS_UNSATISFIED;
>        }
>
> -      sc = rtems_bsp_select_specific_io(
> +      sc = rtems_gpio_bsp_select_specific_io(
>               bank,
>               pin,
>               bsp_data->io_function,
> @@ -1805,7 +1805,7 @@ rtems_status_code rtems_gpio_enable_interrupt(
>      }
>    }
>
> -  sc = rtems_bsp_enable_interrupt(bank, pin, interrupt);
> +  sc = rtems_gpio_bsp_enable_interrupt(bank, pin, interrupt);
>
>    if ( sc != RTEMS_SUCCESSFUL ) {
>      RELEASE_LOCK(gpio_bank_state[bank].lock);
> @@ -1919,7 +1919,7 @@ rtems_status_code
> rtems_gpio_disable_interrupt(uint32_t pin_number)
>      return RTEMS_NOT_CONFIGURED;
>    }
>
> -  sc = rtems_bsp_disable_interrupt(bank, pin,
> interrupt_state->active_interrupt);
> +  sc = rtems_gpio_bsp_disable_interrupt(bank, pin,
> interrupt_state->active_interrupt);
>
>    if ( sc != RTEMS_SUCCESSFUL ) {
>      RELEASE_LOCK(gpio_bank_state[bank].lock);
> diff --git a/c/src/lib/libbsp/shared/include/gpio.h
> b/c/src/lib/libbsp/shared/include/gpio.h
> index 54de5f1..7d8f67b 100644
> --- a/c/src/lib/libbsp/shared/include/gpio.h
> +++ b/c/src/lib/libbsp/shared/include/gpio.h
> @@ -736,12 +736,16 @@ extern uint32_t rtems_gpio_bsp_multi_read(uint32_t
> bank, uint32_t bitmask);
>   *        does not support the feature, by returning RTEMS_NOT_DEFINED.
>   *
>   * @param[in] bank GPIO bank number.
> - * @param[in] bitmask Bitmask of GPIO pins to clear in the given bank.
> + * @param[in] pins Array filled with BSP specific pin numbers. All pins
> belong
> + *                 to the same select bank.
> + * @param[in] pin_count Number of pin configurations in the @var pins
> array.
> + * @param[in] arg Pointer to a BSP defined structure with BSP-specific
> + *                data. This field is handled by the BSP.
>   *
> - * @retval RTEMS_SUCCESSFUL All pins were cleared successfully.
> - * @retval RTEMS_NOT_DEFINED The BSP does not support BSP specific
> operations
> - *                           for groups.
> - * @retval RTEMS_UNSATISFIED Could not clear at least one of the pins.
> + * @retval RTEMS_SUCCESSFUL Operation completed with success.
> + * @retval RTEMS_NOT_DEFINED Group has no BSP specific pins, or the BSP
> does not
> + *                           support BSP specific operations for groups.
> + * @retval RTEMS_UNSATISFIED Could not operate on at least one of the pins.
>   */
>  extern rtems_status_code rtems_gpio_bsp_specific_group_operation(
>    uint32_t bank,
> @@ -859,7 +863,7 @@ extern rtems_status_code rtems_gpio_bsp_select_output(
>   * @retval RTEMS_SUCCESSFUL Function was assigned successfully.
>   * @retval RTEMS_UNSATISFIED Could not assign the function to the pin.
>   */
> -extern rtems_status_code rtems_bsp_select_specific_io(
> +extern rtems_status_code rtems_gpio_bsp_select_specific_io(
>    uint32_t bank,
>    uint32_t pin,
>    uint32_t function,
> @@ -918,7 +922,7 @@ extern rtems_vector_number
> rtems_gpio_bsp_get_vector(uint32_t bank);
>   * @retval RTEMS_SUCCESSFUL Interrupt successfully enabled for this pin.
>   * @retval RTEMS_UNSATISFIED Could not enable the interrupt on the pin.
>   */
> -extern rtems_status_code rtems_bsp_enable_interrupt(
> +extern rtems_status_code rtems_gpio_bsp_enable_interrupt(
>    uint32_t bank,
>    uint32_t pin,
>    rtems_gpio_interrupt interrupt
> @@ -935,7 +939,7 @@ extern rtems_status_code rtems_bsp_enable_interrupt(
>   * @retval RTEMS_SUCCESSFUL Interrupt successfully disabled for this pin.
>   * @retval RTEMS_UNSATISFIED Could not disable interrupts on this pin.
>   */
> -extern rtems_status_code rtems_bsp_disable_interrupt(
> +extern rtems_status_code rtems_gpio_bsp_disable_interrupt(
>    uint32_t bank,
>    uint32_t pin,
>    rtems_gpio_interrupt interrupt
> --
> 1.9.1
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel



More information about the devel mailing list