[PATCH] Fix beagle bsp irq issue

Gedare Bloom gedare at rtems.org
Sun Jun 18 20:51:44 UTC 2017


On Sun, Jun 18, 2017 at 9:04 AM, Sichen Zhao <zsc19940506 at outlook.com> wrote:
> No, i don't think it should return an error.
> The interrupt server uses one pseudo interrupt number. It only works if these functions don't do anything odd and don't return an error for a vector that is out of range.
>
I'm not convinced, but I guess disabling a vector that is out of range
can be documented as doing nothing and returning successful. This
should be reflected in the somewhere in documentation.

> Christian has the same issue, and he explained it:
>
> https://lists.rtems.org/pipermail/devel/2017-June/018162.html
>
> Best Regards
> Sichen Zhao
>
> ________________________________________
> From: devel <devel-bounces at rtems.org> on behalf of Gedare Bloom <gedare at rtems.org>
> Sent: Sunday, June 18, 2017 19:54
> To: Sichen Zhao
> Cc: punit vara; Christian Mauderer; devel at rtems.org
> Subject: Re: [PATCH] Fix beagle bsp irq issue
>
> On Sat, Jun 17, 2017 at 10:31 AM, Sichen Zhao <1473996754 at qq.com> wrote:
>> Enable/disable vector routines now check for a valid vector.
>> Without these guards, the enable/disable vector routines
>> will not work with the interrupt server.
>> ---
>>  c/src/lib/libbsp/arm/beagle/irq.c | 22 ++++++++++++++--------
>>  1 file changed, 14 insertions(+), 8 deletions(-)
>>
>> diff --git a/c/src/lib/libbsp/arm/beagle/irq.c b/c/src/lib/libbsp/arm/beagle/irq.c
>> index d080a5e..35750ba 100644
>> --- a/c/src/lib/libbsp/arm/beagle/irq.c
>> +++ b/c/src/lib/libbsp/arm/beagle/irq.c
>> @@ -98,11 +98,14 @@ static uint32_t omap_get_mir_reg(rtems_vector_number vector, uint32_t *const mas
>>  rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
>>  {
>>    uint32_t mask, cur;
>> -  uint32_t mir_reg = omap_get_mir_reg(vector, &mask);
>>
>> -  cur = mmio_read(omap_intr.base + mir_reg);
>> -  mmio_write(omap_intr.base + mir_reg, cur & ~mask);
>> -  flush_data_cache();
>> +  if (bsp_interrupt_is_valid_vector(vector)) {
>> +    uint32_t mir_reg = omap_get_mir_reg(vector, &mask);
>> +
>> +    cur = mmio_read(omap_intr.base + mir_reg);
>> +    mmio_write(omap_intr.base + mir_reg, cur & ~mask);
>> +    flush_data_cache();
>> +  }
>>
>>    return RTEMS_SUCCESSFUL;
>
> Should this return an error in case vector is not valid?
>
>>  }
>> @@ -110,11 +113,14 @@ rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
>>  rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
>>  {
>>    uint32_t mask, cur;
>> -  uint32_t mir_reg = omap_get_mir_reg(vector, &mask);
>>
>> -  cur = mmio_read(omap_intr.base + mir_reg);
>> -  mmio_write(omap_intr.base + mir_reg, cur | mask);
>> -  flush_data_cache();
>> +  if (bsp_interrupt_is_valid_vector(vector)) {
>> +    uint32_t mir_reg = omap_get_mir_reg(vector, &mask);
>> +
>> +    cur = mmio_read(omap_intr.base + mir_reg);
>> +    mmio_write(omap_intr.base + mir_reg, cur | mask);
>> +    flush_data_cache();
>> +  }
>>
>>    return RTEMS_SUCCESSFUL;
>
> ditto
>
>>  }
>> --
>> 2.7.4
>>
>>
>>
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel



More information about the devel mailing list