[PATCH] Fixes GPIO APIs Naming Convention and Comments

sudarshan.rajagopalan sudarshan.rajagopalan at vecna.com
Mon Oct 12 20:26:40 UTC 2015


Sure, André. Me too released when I started working on the GPIO driver. 
Although, great work with the generic GPIO API implementation for RTEMS. 
:) Really like the way it uses chained linked list to call the user ISR 
when a gpio bank(or port) interrupt is generated.

I do have few other questions/queries to ask about the RTEMS GPIO API 
implementations. Will make a new post for this.

Thanks and Regards,
Sudarshan


On 2015-10-12 16:07, André Marques wrote:
> Hello Sudarshan,
> 
> Às 18:37 de 12-10-2015, sudarshan.rajagopalan escreveu:
> 
>> 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 for the patch! I noticed that some functions were missing the
> _gpio_ before but forgot about it completely.
>  I will also update my GSOC documentation wiki page and test cases
> when someone commits this.
> 
>  On another note (speaking to the community) maybe my GPIO
> documentation could be moved (and improved in the way) to the user
> manual?
> 
>> 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
>> 
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel [1]
> 
>  --André Marques.
> 
> 
> 
> Links:
> ------
> [1] http://lists.rtems.org/mailman/listinfo/devel



More information about the devel mailing list