Changeset c6810c8 in rtems for c/src/lib/libbsp/arm/tms570


Ignore:
Timestamp:
Jun 19, 2017, 12:09:28 PM (2 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
ae3e6af8
Parents:
b361cb6c
git-author:
Sebastian Huber <sebastian.huber@…> (06/19/17 12:09:28)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/20/17 05:42:25)
Message:

bsps: Improve interrupt vector enable/disable API

Change bsp_interrupt_vector_enable() and bsp_interrupt_vector_disable()
to not return a status code. Add bsp_interrupt_assert() and use it to
validate the vector number in the vector enable/disable implementations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/tms570/irq/irq.c

    rb361cb6c rc6810c8  
    2828#include <bsp/irq.h>
    2929#include <rtems/score/armv4.h>
    30 
    31 /**
    32  * @brief Check if isr vector is valid
    33  *
    34  * Check if isr vector is valid by using BSP_INTERRUPT_VECTOR_MAX and
    35  * BSP_INTERRUPT_VECTOR_MIN defined in irq.h
    36  *
    37  * @param[in] vector interrupt vector to be checked.
    38  * @retval TRUE vector is valid.
    39  * @retval FALSE vector is invalid
    40  */
    41 static inline bool tms570_irq_is_valid(
    42   rtems_vector_number vector
    43 )
    44 {
    45   return (vector <= BSP_INTERRUPT_VECTOR_MAX) &&
    46          (vector > BSP_INTERRUPT_VECTOR_MIN);
    47 }
    4830
    4931unsigned int priorityTable[BSP_INTERRUPT_VECTOR_MAX+1];
     
    6547)
    6648{
    67   if ( tms570_irq_is_valid(vector) ) {
     49  if ( bsp_interrupt_is_valid_vector(vector) ) {
    6850    priorityTable[vector] = priority;
    6951  }
     
    8567)
    8668{
    87   if ( tms570_irq_is_valid(vector) ) {
     69  if ( bsp_interrupt_is_valid_vector(vector) ) {
    8870   return priorityTable[vector];
    8971 }
     
    11597 * @retval RTEMS_SUCCESSFUL interrupt source enabled.
    11698 */
    117 rtems_status_code bsp_interrupt_vector_enable(
     99void bsp_interrupt_vector_enable(
    118100  rtems_vector_number vector
    119101)
    120102{
    121   if( !tms570_irq_is_valid(vector) ) {
    122     return RTEMS_INVALID_ID;
    123   }
    124 
     103  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
    125104  TMS570_VIM.REQENASET[vector >> 5] = 1 << (vector & 0x1f);
    126 
    127   return RTEMS_SUCCESSFUL;
    128105}
    129106
     
    137114 * @retval RTEMS_SUCCESSFUL interrupt source disabled.
    138115 */
    139 rtems_status_code bsp_interrupt_vector_disable(
     116void bsp_interrupt_vector_disable(
    140117  rtems_vector_number vector
    141118)
    142119{
    143   if( !tms570_irq_is_valid(vector) ) {
    144     return RTEMS_INVALID_ID;
    145   }
    146 
     120  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
    147121  TMS570_VIM.REQENACLR[vector >> 5] = 1 << (vector & 0x1f);
    148 
    149   return RTEMS_SUCCESSFUL;
    150122}
    151123
Note: See TracChangeset for help on using the changeset viewer.