Changeset 10ee41a8 in rtems


Ignore:
Timestamp:
01/23/23 13:56:31 (13 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
6136e28b
Parents:
9ecb73f
git-author:
Sebastian Huber <sebastian.huber@…> (01/23/23 13:56:31)
git-committer:
Sebastian Huber <sebastian.huber@…> (01/24/23 08:56:53)
Message:

tm27: Avoid function pointer casts

Add TM27_USE_VECTOR_HANDLER to select the interrupt handler type used by
the <tm27.h> implementation.

Close #4820.

Files:
37 edited

Legend:

Unmodified
Added
Removed
  • bsps/arm/lpc32xx/include/tm27.h

    r9ecb73f r10ee41a8  
    5252#define LPC32XX_TM27_IRQ LPC32XX_IRQ_TIMER_2
    5353
    54 static inline void Install_tm27_vector(void (*handler)(rtems_vector_number))
     54static inline void Install_tm27_vector( rtems_interrupt_handler handler )
    5555{
    5656  static rtems_interrupt_entry entry;
     
    7171  rtems_interrupt_entry_initialize(
    7272    &entry,
    73     (rtems_interrupt_handler) handler,
     73    handler,
    7474    NULL,
    7575    "tm27"
  • bsps/bfin/TLL6527M/include/tm27.h

    r9ecb73f r10ee41a8  
    3535#define MUST_WAIT_FOR_INTERRUPT 0
    3636
     37#define TM27_USE_VECTOR_HANDLER
     38
    3739#define Install_tm27_vector(handler) \
    3840{ \
  • bsps/bfin/eZKit533/include/tm27.h

    r9ecb73f r10ee41a8  
    3333#define MUST_WAIT_FOR_INTERRUPT 0
    3434
     35#define TM27_USE_VECTOR_HANDLER
     36
    3537#define Install_tm27_vector(handler) \
    3638{ \
  • bsps/include/dev/irq/arm-gic-tm27.h

    r9ecb73f r10ee41a8  
    6060#define ARM_GIC_TM27_PRIO_HIGH 0x00
    6161
    62 static inline void Install_tm27_vector(void (*handler)(rtems_vector_number))
     62static inline void Install_tm27_vector( rtems_interrupt_handler handler )
    6363{
    6464  rtems_status_code sc = rtems_interrupt_handler_install(
     
    6666    "tm27 low",
    6767    RTEMS_INTERRUPT_UNIQUE,
    68     (rtems_interrupt_handler) handler,
     68    handler,
    6969    NULL
    7070  );
  • bsps/lm32/lm32_evr/include/tm27.h

    r9ecb73f r10ee41a8  
    2828#define MUST_WAIT_FOR_INTERRUPT 0
    2929
     30#define TM27_USE_VECTOR_HANDLER
     31
    3032#define Install_tm27_vector( handler ) set_vector( (handler), 0, 1 )
    3133
  • bsps/m68k/av5282/include/tm27.h

    r9ecb73f r10ee41a8  
    2727#define MUST_WAIT_FOR_INTERRUPT 0
    2828
     29#define TM27_USE_VECTOR_HANDLER
     30
    2931#define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 )
    3032
  • bsps/m68k/csb360/include/tm27.h

    r9ecb73f r10ee41a8  
    2929#define MUST_WAIT_FOR_INTERRUPT 0
    3030
     31#define TM27_USE_VECTOR_HANDLER
     32
    3133#define Install_tm27_vector( handler ) set_vector( (handler), 34, 1 )
    3234
  • bsps/m68k/gen68360/include/tm27.h

    r9ecb73f r10ee41a8  
    3030#define MUST_WAIT_FOR_INTERRUPT 0
    3131
     32#define TM27_USE_VECTOR_HANDLER
     33
    3234#define Install_tm27_vector( handler ) set_vector( (handler), 34, 1 )
    3335
  • bsps/m68k/genmcf548x/include/tm27.h

    r9ecb73f r10ee41a8  
    2727#define MUST_WAIT_FOR_INTERRUPT 0
    2828
     29#define TM27_USE_VECTOR_HANDLER
     30
    2931#define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 )
    3032
  • bsps/m68k/mcf5206elite/include/tm27.h

    r9ecb73f r10ee41a8  
    2525#define MUST_WAIT_FOR_INTERRUPT 0
    2626
     27#define TM27_USE_VECTOR_HANDLER
     28
    2729#define Install_tm27_vector( handler ) set_vector( (handler), 34, 1 )
    2830
  • bsps/m68k/mcf52235/include/tm27.h

    r9ecb73f r10ee41a8  
    2525#define MUST_WAIT_FOR_INTERRUPT 0
    2626
     27#define TM27_USE_VECTOR_HANDLER
     28
    2729#define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 )
    2830
  • bsps/m68k/mcf5225x/include/tm27.h

    r9ecb73f r10ee41a8  
    2525#define MUST_WAIT_FOR_INTERRUPT 0
    2626
     27#define TM27_USE_VECTOR_HANDLER
     28
    2729#define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 )
    2830
  • bsps/m68k/mcf5235/include/tm27.h

    r9ecb73f r10ee41a8  
    2525#define MUST_WAIT_FOR_INTERRUPT 0
    2626
     27#define TM27_USE_VECTOR_HANDLER
     28
    2729#define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 )
    2830
  • bsps/m68k/mcf5329/include/tm27.h

    r9ecb73f r10ee41a8  
    2525#define MUST_WAIT_FOR_INTERRUPT 0
    2626
     27#define TM27_USE_VECTOR_HANDLER
     28
    2729#define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 )
    2830
  • bsps/m68k/mvme147/include/tm27.h

    r9ecb73f r10ee41a8  
    2626#define MUST_WAIT_FOR_INTERRUPT 0
    2727
     28#define TM27_USE_VECTOR_HANDLER
     29
    2830#define Install_tm27_vector( handler ) set_vector( (handler), \
    2931                                                   SOFT_1_VECTOR, 1 )
  • bsps/m68k/mvme147s/include/tm27.h

    r9ecb73f r10ee41a8  
    2626#define MUST_WAIT_FOR_INTERRUPT 0
    2727
     28#define TM27_USE_VECTOR_HANDLER
     29
    2830#define Install_tm27_vector( handler ) set_vector( (handler), \
    2931                                                   SOFT_1_VECTOR, 1 )
  • bsps/m68k/mvme162/include/tm27.h

    r9ecb73f r10ee41a8  
    2626#define MUST_WAIT_FOR_INTERRUPT 0
    2727
     28#define TM27_USE_VECTOR_HANDLER
     29
    2830#define Install_tm27_vector( handler ) \
    2931            set_vector( (handler), VBR1 * 0x10 + 0x8, 1 ); \
  • bsps/m68k/mvme167/include/tm27.h

    r9ecb73f r10ee41a8  
    2525#define MUST_WAIT_FOR_INTERRUPT 0
    2626
     27#define TM27_USE_VECTOR_HANDLER
     28
    2729#define Install_tm27_vector( handler ) \
    2830            set_vector( (handler), VBR1 * 0x10 + 0x8, 1 ); \
  • bsps/m68k/uC5282/include/tm27.h

    r9ecb73f r10ee41a8  
    3030#define MUST_WAIT_FOR_INTERRUPT 0
    3131
     32#define TM27_USE_VECTOR_HANDLER
     33
    3234#define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 )
    3335
  • bsps/mips/csb350/include/tm27.h

    r9ecb73f r10ee41a8  
    2929#define Install_tm27_vector( handler ) \
    3030   rtems_interrupt_handler_install( \
    31       AU1X00_IRQ_SW0, "benchmark", 0, (rtems_interrupt_handler)handler, NULL );
     31      AU1X00_IRQ_SW0, "benchmark", 0, handler, NULL );
    3232
    3333#define Cause_tm27_intr() \
  • bsps/mips/jmr3904/include/tm27.h

    r9ecb73f r10ee41a8  
    2727   rtems_interrupt_handler_install( \
    2828      TX3904_IRQ_TMR0, "benchmark", 0, \
    29       (rtems_interrupt_handler)handler, NULL );
     29      handler, NULL );
    3030
    3131#define Cause_tm27_intr() \
  • bsps/powerpc/gen5200/include/tm27.h

    r9ecb73f r10ee41a8  
    3535                                              (rtems_irq_is_enabled) nullFunc};
    3636
    37 static inline void Install_tm27_vector(void (*_handler)(void))
     37static inline void Install_tm27_vector( rtems_interrupt_handler handler )
    3838{
    39   clockIrqData.hdl = _handler;
     39  clockIrqData.hdl = handler;
    4040  if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
    4141    printk("Error installing clock interrupt handler!\n");
  • bsps/powerpc/gen83xx/include/tm27.h

    r9ecb73f r10ee41a8  
    4343#define MUST_WAIT_FOR_INTERRUPT 1
    4444
    45 static void (*tm27_interrupt_handler)(rtems_vector_number);
     45static rtems_interrupt_handler tm27_interrupt_handler;
    4646
    4747static int tm27_exception_handler( BSP_Exception_frame *frame, unsigned number)
    4848{
    49         (*tm27_interrupt_handler)( 0);
     49        (*tm27_interrupt_handler)( NULL);
    5050
    5151        return 0;
    5252}
    5353
    54 static void Install_tm27_vector( void (*handler)(rtems_vector_number))
     54static inline void Install_tm27_vector( rtems_interrupt_handler handler )
    5555{
    5656  int rv = 0;
  • bsps/powerpc/motorola_powerpc/include/tm27.h

    r9ecb73f r10ee41a8  
    4040};
    4141
    42 static void Install_tm27_vector(rtems_isr (*_handler)(rtems_vector_number))
     42static inline void Install_tm27_vector( rtems_interrupt_handler handler )
    4343{
    44   clockIrqData.hdl = (rtems_irq_hdl) _handler;
     44  clockIrqData.hdl = handler;
    4545  if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
    4646        printk("Error installing clock interrupt handler!\n");
  • bsps/powerpc/mpc8260ads/include/tm27.h

    r9ecb73f r10ee41a8  
    3030        static rtems_irq_connect_data scIrqData = { \
    3131          PPC_IRQ_SCALL, \
    32           (rtems_irq_hdl) handler, \
     32          handler, \
    3333          NULL, \
    3434          NULL, \
  • bsps/powerpc/mvme5500/include/tm27.h

    r9ecb73f r10ee41a8  
    3333                                              (rtems_irq_is_enabled) nullFunc};
    3434
    35 static inline void Install_tm27_vector(void (*_handler)())
     35static inline void Install_tm27_vector( rtems_interrupt_handler handler )
    3636{
    37   clockIrqData.hdl = _handler;
     37  clockIrqData.hdl = handler;
    3838  if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
    3939        printk("Error installing clock interrupt handler!\n");
  • bsps/powerpc/psim/include/tm27.h

    r9ecb73f r10ee41a8  
    3333                                              (rtems_irq_is_enabled) nullFunc};
    3434
    35 static inline void Install_tm27_vector(void (*_handler)())
     35static inline void Install_tm27_vector( rtems_interrupt_handler handler )
    3636{
    37   clockIrqData.hdl = _handler;
     37  clockIrqData.hdl = handler;
    3838  if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
    3939    printk("Error installing clock interrupt handler!\n");
  • bsps/powerpc/qoriq/include/tm27.h

    r9ecb73f r10ee41a8  
    5454#define IPI_INDEX_HIGH 2
    5555
    56 static inline void Install_tm27_vector(void (*handler)(rtems_vector_number))
     56static inline void Install_tm27_vector( rtems_interrupt_handler handler )
    5757{
    5858  rtems_status_code sc;
     
    6464    "tm17 low",
    6565    RTEMS_INTERRUPT_UNIQUE,
    66     (rtems_interrupt_handler) handler,
     66    handler,
    6767    NULL
    6868  );
     
    7676    "tm17 high",
    7777    RTEMS_INTERRUPT_UNIQUE,
    78     (rtems_interrupt_handler) handler,
     78    handler,
    7979    NULL
    8080  );
  • bsps/powerpc/ss555/include/tm27.h

    r9ecb73f r10ee41a8  
    3333  usiu.sipend |= (1 << 17);                                             \
    3434                                                                        \
    35   tm27IrqData.hdl = (rtems_irq_hdl)handler;                             \
     35  tm27IrqData.hdl = handler;                                            \
    3636  BSP_install_rtems_irq_handler (&tm27IrqData);                         \
    3737}
  • bsps/riscv/riscv/include/tm27.h

    r9ecb73f r10ee41a8  
    5353static rtems_interrupt_entry riscv_tm27_interrupt_entry;
    5454
    55 static inline void Install_tm27_vector(
    56   void ( *handler )( rtems_vector_number )
    57 )
     55static inline void Install_tm27_vector( rtems_interrupt_handler handler )
    5856{
    5957  rtems_vector_number irq;
     
    7270  rtems_interrupt_entry_initialize(
    7371    &riscv_tm27_interrupt_entry,
    74     (rtems_interrupt_handler) handler,
     72    handler,
    7573    NULL,
    7674    "tm27"
  • bsps/sh/gensh4/include/tm27.h

    r9ecb73f r10ee41a8  
    2727#   error "..."
    2828#endif
     29
     30#define TM27_USE_VECTOR_HANDLER
    2931
    3032#define Install_tm27_vector( handler ) \
  • bsps/sparc/erc32/include/tm27.h

    r9ecb73f r10ee41a8  
    6060#define MUST_WAIT_FOR_INTERRUPT 1
    6161
     62#define TM27_USE_VECTOR_HANDLER
     63
    6264#define Install_tm27_vector( handler ) \
    6365  set_vector( (handler), TEST_VECTOR, 1 );
     
    8183#define MUST_WAIT_FOR_INTERRUPT 1
    8284
    83 static inline void Install_tm27_vector(
    84   void ( *handler )( rtems_vector_number )
    85 )
     85static inline void Install_tm27_vector( rtems_interrupt_handler handler )
    8686{
    8787  (void) rtems_interrupt_handler_install(
     
    8989    "tm27 low",
    9090    RTEMS_INTERRUPT_SHARED,
    91     (rtems_interrupt_handler) handler,
     91    handler,
    9292    NULL
    9393  );
     
    9696    "tm27 high",
    9797    RTEMS_INTERRUPT_SHARED,
    98     (rtems_interrupt_handler) handler,
     98    handler,
    9999    NULL
    100100  );
  • bsps/sparc/leon2/include/tm27.h

    r9ecb73f r10ee41a8  
    6060#define MUST_WAIT_FOR_INTERRUPT 1
    6161
     62#define TM27_USE_VECTOR_HANDLER
     63
    6264#define Install_tm27_vector( handler ) \
    6365  set_vector( (handler), TEST_VECTOR, 1 );
     
    8082#define MUST_WAIT_FOR_INTERRUPT 1
    8183
    82 static inline void Install_tm27_vector(
    83   void ( *handler )( rtems_vector_number )
    84 )
     84static inline void Install_tm27_vector( rtems_interrupt_handler handler )
    8585{
    8686  (void) rtems_interrupt_handler_install(
     
    8888    "tm27 low",
    8989    RTEMS_INTERRUPT_SHARED,
    90     (rtems_interrupt_handler) handler,
     90    handler,
    9191    NULL
    9292  );
     
    9595    "tm27 high",
    9696    RTEMS_INTERRUPT_SHARED,
    97     (rtems_interrupt_handler) handler,
     97    handler,
    9898    NULL
    9999  );
  • bsps/sparc/leon3/include/tm27.h

    r9ecb73f r10ee41a8  
    6767#define MUST_WAIT_FOR_INTERRUPT 1
    6868
     69#define TM27_USE_VECTOR_HANDLER
     70
    6971#define Install_tm27_vector( handler ) \
    7072  set_vector( (handler), TEST_VECTOR, 1 );
     
    8991#define MUST_WAIT_FOR_INTERRUPT 1
    9092
    91 static inline void Install_tm27_vector(
    92   void ( *handler )( rtems_vector_number )
    93 )
     93static inline void Install_tm27_vector( rtems_interrupt_handler handler )
    9494{
    9595  static rtems_interrupt_entry entry_low;
     
    109109  rtems_interrupt_entry_initialize(
    110110    &entry_low,
    111     (rtems_interrupt_handler) handler,
     111    handler,
    112112    NULL,
    113113    "tm27 low"
     
    120120  rtems_interrupt_entry_initialize(
    121121    &entry_high,
    122     (rtems_interrupt_handler) handler,
     122    handler,
    123123    NULL,
    124124    "tm27 high"
  • testsuites/rhealstone/rhilatency/ilatency.c

    r9ecb73f r10ee41a8  
    4646uint32_t   Interrupt_enter_time;
    4747
    48 rtems_isr Isr_handler(
    49   rtems_vector_number vector
    50 );
    51 
    5248rtems_task Init(
    5349  rtems_task_argument argument
     
    9288}
    9389
     90#ifdef TM27_USE_VECTOR_HANDLER
     91static rtems_isr Isr_handler( rtems_vector_number arg )
     92#else
     93static void Isr_handler( void *arg )
     94#endif
     95{
     96  (void) arg;
     97
     98  /* See how long it took system to recognize interrupt */
     99  Interrupt_enter_time = benchmark_timer_read();
     100  Clear_tm27_intr();
     101}
     102
    94103rtems_task Task_1(
    95104  rtems_task_argument argument
     
    115124  rtems_test_exit( 0 );
    116125}
    117 
    118 rtems_isr Isr_handler(
    119   rtems_vector_number vector
    120 )
    121 {
    122   /* See how long it took system to recognize interrupt */
    123   Interrupt_enter_time = benchmark_timer_read();
    124   Clear_tm27_intr();
    125 }
  • testsuites/tmtests/tm27/task1.c

    r9ecb73f r10ee41a8  
    6363uint32_t   timer_overhead;
    6464
    65 rtems_isr Isr_handler(
    66   rtems_vector_number vector
    67 );
    68 
    6965static void set_thread_executing( Thread_Control *thread )
    7066{
     
    127123}
    128124
    129 rtems_task Task_1(
    130   rtems_task_argument argument
    131 )
    132 {
    133   Scheduler_priority_Context *scheduler_context =
    134     _Scheduler_priority_Get_context( _Thread_Scheduler_get_home( _Thread_Get_executing() ) );
    135 #if defined(RTEMS_SMP)
    136   rtems_interrupt_level level;
    137 #endif
    138 
    139   Install_tm27_vector( Isr_handler );
    140 
    141   /*
    142    *  No preempt .. no nesting
    143    */
    144 
    145   Interrupt_nest = 0;
    146 
    147   Interrupt_occurred = 0;
    148 
    149   benchmark_timer_initialize();
    150   Cause_tm27_intr();
    151   /* goes to Isr_handler */
    152 
    153 #if (MUST_WAIT_FOR_INTERRUPT == 1)
    154   while ( Interrupt_occurred == 0 );
    155 #endif
    156   Interrupt_return_time = benchmark_timer_read();
    157 
    158   put_time(
    159     "rtems interrupt: entry overhead returns to interrupted task",
    160     Interrupt_enter_time,
    161     1,
    162     0,
    163     timer_overhead
    164   );
    165 
    166   put_time(
    167     "rtems interrupt: exit overhead returns to interrupted task",
    168     Interrupt_return_time,
    169     1,
    170     0,
    171     timer_overhead
    172   );
    173 
    174   /*
    175    *  No preempt .. nested
    176    */
    177 
    178   _Thread_Dispatch_disable();
    179 
    180   Interrupt_nest = 1;
    181 
    182   Interrupt_occurred = 0;
    183   benchmark_timer_initialize();
    184   Cause_tm27_intr();
    185   /* goes to Isr_handler */
    186 
    187 #if (MUST_WAIT_FOR_INTERRUPT == 1)
    188   while ( Interrupt_occurred == 0 );
    189 #endif
    190   Interrupt_return_time = benchmark_timer_read();
    191 
    192   _Thread_Dispatch_enable( _Per_CPU_Get() );
    193 
    194   put_time(
    195     "rtems interrupt: entry overhead returns to nested interrupt",
    196     Interrupt_enter_nested_time,
    197     1,
    198     0,
    199     0
    200   );
    201 
    202   put_time(
    203     "rtems interrupt: exit overhead returns to nested interrupt",
    204     Interrupt_return_nested_time,
    205     1,
    206     0,
    207     0
    208   );
    209 
    210   /*
    211    *  Does a preempt .. not nested
    212    */
    213 
    214 #if defined(RTEMS_SMP)
    215   _ISR_Local_disable(level);
    216 #endif
    217 
    218   set_thread_executing(
    219     (Thread_Control *) _Chain_First(&scheduler_context->Ready[LOW_PRIORITY])
    220   );
    221 
    222   _Thread_Dispatch_necessary = 1;
    223 
    224 #if defined(RTEMS_SMP)
    225   _ISR_Local_enable(level);
    226 #endif
    227 
    228   Interrupt_occurred = 0;
    229   benchmark_timer_initialize();
    230   Cause_tm27_intr();
    231 
    232   /*
    233    *  goes to Isr_handler and then returns
    234    */
    235 
    236   TEST_END();
    237   rtems_test_exit( 0 );
    238 }
    239 
    240 /*
    241  *  NOTE:  When this task is executing, some of the assumptions made
    242  *         regarding the placement of the currently executing task's TCB
    243  *         on the ready chains have been violated.  At least the assumption
    244  *         that this task is at the head of the chain for its priority
    245  *         has been violated.
    246  */
    247 
    248 rtems_task Task_2(
    249   rtems_task_argument argument
    250 )
    251 {
    252   Thread_Control *executing = _Thread_Get_executing();
    253   const Scheduler_Control    *scheduler;
    254   Scheduler_priority_Context *scheduler_context;
    255   ISR_lock_Context state_lock_context;
    256   ISR_lock_Context scheduler_lock_context;
    257 
    258   _Thread_State_acquire( executing, &state_lock_context );
    259   scheduler = _Thread_Scheduler_get_home( executing );
    260   scheduler_context = _Scheduler_priority_Get_context( scheduler );
    261   _Thread_State_release( executing, &state_lock_context );
    262 
    263 #if (MUST_WAIT_FOR_INTERRUPT == 1)
    264   while ( Interrupt_occurred == 0 );
    265 #endif
    266   end_time = benchmark_timer_read();
    267 
    268   put_time(
    269     "rtems interrupt: entry overhead returns to preempting task",
    270     Interrupt_enter_time,
    271     1,
    272     0,
    273     timer_overhead
    274   );
    275 
    276   put_time(
    277     "rtems interrupt: exit overhead returns to preempting task",
    278     end_time,
    279     1,
    280     0,
    281     0
    282   );
    283 
    284   fflush( stdout );
    285 
    286   /*
    287    *  Switch back to the other task to exit the test.
    288    */
    289 
    290   _Thread_State_acquire( executing, &state_lock_context );
    291   _Scheduler_Acquire_critical( scheduler, &scheduler_lock_context );
    292 
    293   set_thread_executing(
    294     (Thread_Control *) _Chain_First(&scheduler_context->Ready[LOW_PRIORITY])
    295   );
    296 
    297   _Thread_Dispatch_necessary = 1;
    298 
    299   _Scheduler_Release_critical( scheduler, &scheduler_lock_context );
    300   _Thread_State_release( executing, &state_lock_context );
    301 
    302   _Thread_Dispatch();
    303 
    304 }
    305 
    306125/*  The Isr_handler() and Isr_handler_inner() routines are structured
    307126 *  so that there will be as little entry overhead as possible included
     
    309128 */
    310129
    311 void Isr_handler_inner( void );
    312 
    313 rtems_isr Isr_handler(
    314   rtems_vector_number vector
    315 )
    316 {
    317   end_time = benchmark_timer_read();
    318 
    319   Interrupt_occurred = 1;
    320   Isr_handler_inner();
    321 }
    322 
    323 void Isr_handler_inner( void )
     130static void Isr_handler_inner( void )
    324131{
    325132
     
    350157  benchmark_timer_initialize();
    351158}
     159
     160#ifdef TM27_USE_VECTOR_HANDLER
     161static rtems_isr Isr_handler( rtems_vector_number arg )
     162#else
     163static void Isr_handler( void *arg )
     164#endif
     165{
     166  (void) arg;
     167
     168  end_time = benchmark_timer_read();
     169
     170  Interrupt_occurred = 1;
     171  Isr_handler_inner();
     172}
     173
     174rtems_task Task_1(
     175  rtems_task_argument argument
     176)
     177{
     178  Scheduler_priority_Context *scheduler_context =
     179    _Scheduler_priority_Get_context( _Thread_Scheduler_get_home( _Thread_Get_executing() ) );
     180#if defined(RTEMS_SMP)
     181  rtems_interrupt_level level;
     182#endif
     183
     184  Install_tm27_vector( Isr_handler );
     185
     186  /*
     187   *  No preempt .. no nesting
     188   */
     189
     190  Interrupt_nest = 0;
     191
     192  Interrupt_occurred = 0;
     193
     194  benchmark_timer_initialize();
     195  Cause_tm27_intr();
     196  /* goes to Isr_handler */
     197
     198#if (MUST_WAIT_FOR_INTERRUPT == 1)
     199  while ( Interrupt_occurred == 0 );
     200#endif
     201  Interrupt_return_time = benchmark_timer_read();
     202
     203  put_time(
     204    "rtems interrupt: entry overhead returns to interrupted task",
     205    Interrupt_enter_time,
     206    1,
     207    0,
     208    timer_overhead
     209  );
     210
     211  put_time(
     212    "rtems interrupt: exit overhead returns to interrupted task",
     213    Interrupt_return_time,
     214    1,
     215    0,
     216    timer_overhead
     217  );
     218
     219  /*
     220   *  No preempt .. nested
     221   */
     222
     223  _Thread_Dispatch_disable();
     224
     225  Interrupt_nest = 1;
     226
     227  Interrupt_occurred = 0;
     228  benchmark_timer_initialize();
     229  Cause_tm27_intr();
     230  /* goes to Isr_handler */
     231
     232#if (MUST_WAIT_FOR_INTERRUPT == 1)
     233  while ( Interrupt_occurred == 0 );
     234#endif
     235  Interrupt_return_time = benchmark_timer_read();
     236
     237  _Thread_Dispatch_enable( _Per_CPU_Get() );
     238
     239  put_time(
     240    "rtems interrupt: entry overhead returns to nested interrupt",
     241    Interrupt_enter_nested_time,
     242    1,
     243    0,
     244    0
     245  );
     246
     247  put_time(
     248    "rtems interrupt: exit overhead returns to nested interrupt",
     249    Interrupt_return_nested_time,
     250    1,
     251    0,
     252    0
     253  );
     254
     255  /*
     256   *  Does a preempt .. not nested
     257   */
     258
     259#if defined(RTEMS_SMP)
     260  _ISR_Local_disable(level);
     261#endif
     262
     263  set_thread_executing(
     264    (Thread_Control *) _Chain_First(&scheduler_context->Ready[LOW_PRIORITY])
     265  );
     266
     267  _Thread_Dispatch_necessary = 1;
     268
     269#if defined(RTEMS_SMP)
     270  _ISR_Local_enable(level);
     271#endif
     272
     273  Interrupt_occurred = 0;
     274  benchmark_timer_initialize();
     275  Cause_tm27_intr();
     276
     277  /*
     278   *  goes to Isr_handler and then returns
     279   */
     280
     281  TEST_END();
     282  rtems_test_exit( 0 );
     283}
     284
     285/*
     286 *  NOTE:  When this task is executing, some of the assumptions made
     287 *         regarding the placement of the currently executing task's TCB
     288 *         on the ready chains have been violated.  At least the assumption
     289 *         that this task is at the head of the chain for its priority
     290 *         has been violated.
     291 */
     292
     293rtems_task Task_2(
     294  rtems_task_argument argument
     295)
     296{
     297  Thread_Control *executing = _Thread_Get_executing();
     298  const Scheduler_Control    *scheduler;
     299  Scheduler_priority_Context *scheduler_context;
     300  ISR_lock_Context state_lock_context;
     301  ISR_lock_Context scheduler_lock_context;
     302
     303  _Thread_State_acquire( executing, &state_lock_context );
     304  scheduler = _Thread_Scheduler_get_home( executing );
     305  scheduler_context = _Scheduler_priority_Get_context( scheduler );
     306  _Thread_State_release( executing, &state_lock_context );
     307
     308#if (MUST_WAIT_FOR_INTERRUPT == 1)
     309  while ( Interrupt_occurred == 0 );
     310#endif
     311  end_time = benchmark_timer_read();
     312
     313  put_time(
     314    "rtems interrupt: entry overhead returns to preempting task",
     315    Interrupt_enter_time,
     316    1,
     317    0,
     318    timer_overhead
     319  );
     320
     321  put_time(
     322    "rtems interrupt: exit overhead returns to preempting task",
     323    end_time,
     324    1,
     325    0,
     326    0
     327  );
     328
     329  fflush( stdout );
     330
     331  /*
     332   *  Switch back to the other task to exit the test.
     333   */
     334
     335  _Thread_State_acquire( executing, &state_lock_context );
     336  _Scheduler_Acquire_critical( scheduler, &scheduler_lock_context );
     337
     338  set_thread_executing(
     339    (Thread_Control *) _Chain_First(&scheduler_context->Ready[LOW_PRIORITY])
     340  );
     341
     342  _Thread_Dispatch_necessary = 1;
     343
     344  _Scheduler_Release_critical( scheduler, &scheduler_lock_context );
     345  _Thread_State_release( executing, &state_lock_context );
     346
     347  _Thread_Dispatch();
     348
     349}
  • testsuites/validation/tx-call-within-isr.c

    r9ecb73f r10ee41a8  
    7777}
    7878
    79 static void CallWithinISRHandler( rtems_vector_number vector )
     79#ifdef TM27_USE_VECTOR_HANDLER
     80static rtems_isr CallWithinISRHandler( rtems_vector_number arg )
     81#else
     82static void CallWithinISRHandler( void *arg )
     83#endif
    8084{
    8185  CallWithinISRContext *ctx;
    8286
    83   (void) vector;
     87  (void) arg;
    8488  ctx = &CallWithinISRInstance;
    8589
     
    149153  (void) handler_arg;
    150154
    151   if ( handler == (rtems_interrupt_handler) CallWithinISRHandler ) {
     155  if ( handler == CallWithinISRHandler ) {
    152156    *(bool *) arg = true;
    153157  }
Note: See TracChangeset for help on using the changeset viewer.