Changeset b7d1f290 in rtems


Ignore:
Timestamp:
Jul 23, 2008, 6:50:00 AM (11 years ago)
Author:
Till Straumann <strauman@…>
Branches:
4.10, 4.11, 4.9, master
Children:
36ba3fc
Parents:
479f2555
Message:

2008-07-22 Till Straumann <strauman@…>

  • ppc403/clock/clock.c: Added (conditionally compiled) code so that a BSP can choose to hook the timer exception directly rather than going through the interrupt dispatcher.
Location:
c/src/lib/libcpu/powerpc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libcpu/powerpc/ChangeLog

    r479f2555 rb7d1f290  
     12008-07-22      Till Straumann <strauman@slac.stanford.edu>
     2
     3        * ppc403/clock/clock.c: Added (conditionally compiled)
     4        code so that a BSP can choose to hook the timer exception
     5        directly rather than going through the interrupt dispatcher.
     6
    172008-07-21      Till Straumann <strauman@slac.stanford.edu>
    28
  • c/src/lib/libcpu/powerpc/ppc403/clock/clock.c

    r479f2555 rb7d1f290  
    4444#include <rtems/bspIo.h>
    4545#include <rtems/powerpc/powerpc.h>
     46
    4647/*
    4748 * check, which exception handling code is present
    4849 */
     50
     51#include <bsp.h>
     52
     53#ifdef BSP_PPC403_CLOCK_HOOK_EXCEPTION
     54#include <libcpu/raw_exception.h>
     55#include <bsp/vectors.h>
     56#include <bsp/ppc_exc_bspsupp.h>
     57#define PPC_HAS_CLASSIC_EXCEPTIONS FALSE
     58#else
    4959#if !defined(ppc405)
    5060#define PPC_HAS_CLASSIC_EXCEPTIONS TRUE
     
    5262#define PPC_HAS_CLASSIC_EXCEPTIONS FALSE
    5363#include <bsp/irq.h>
     64#endif
    5465#endif
    5566
     
    92103#if PPC_HAS_CLASSIC_EXCEPTIONS
    93104rtems_isr Clock_isr(rtems_vector_number vector)
     105#elif defined(BSP_PPC403_CLOCK_HOOK_EXCEPTION)
     106int  Clock_isr(struct _BSP_Exception_frame *f, unsigned int vector)
    94107#else
    95108void Clock_isr(void* handle)
     
    97110{
    98111    uint32_t   clicks_til_next_interrupt;
     112#if defined(BSP_PPC403_CLOCK_ISR_IRQ_LEVEL)
     113        uint32_t   l_orig = _ISR_Get_level();
     114#endif
    99115    if (!auto_restart)
    100116    {
     
    148164 
    149165    Clock_driver_ticks++;
    150  
     166
     167        /* Give BSP a chance to say if they want to re-enable interrupts */
     168 
     169#if defined(BSP_PPC403_CLOCK_ISR_IRQ_LEVEL)
     170        _ISR_Set_level(BSP_PPC403_CLOCK_ISR_IRQ_LEVEL);
     171#endif
     172
    151173    rtems_clock_tick();
    152 }
    153 
    154 #if !PPC_HAS_CLASSIC_EXCEPTIONS
     174
     175#if defined(BSP_PPC403_CLOCK_ISR_IRQ_LEVEL)
     176        _ISR_Set_level(l_orig)
     177#endif
     178
     179#if defined(BSP_PPC403_CLOCK_HOOK_EXCEPTION)
     180        return 0;
     181#endif
     182}
     183
     184#if !PPC_HAS_CLASSIC_EXCEPTIONS && !defined(BSP_PPC403_CLOCK_HOOK_EXCEPTION)
    155185int ClockIsOn(const rtems_irq_connect_data* unused)
    156186{
     
    164194
    165195void ClockOff(
    166 #if PPC_HAS_CLASSIC_EXCEPTIONS
     196#if PPC_HAS_CLASSIC_EXCEPTIONS || defined(BSP_PPC403_CLOCK_HOOK_EXCEPTION)
    167197              void
    168198#else
     
    181211
    182212void ClockOn(
    183 #if PPC_HAS_CLASSIC_EXCEPTIONS
     213#if PPC_HAS_CLASSIC_EXCEPTIONS || defined(BSP_PPC403_CLOCK_HOOK_EXCEPTION)
    184214              void
    185215#else
     
    267297#if PPC_HAS_CLASSIC_EXCEPTIONS
    268298                   rtems_isr_entry clock_isr
     299#elif defined(BSP_PPC403_CLOCK_HOOK_EXCEPTION)
     300           ppc_exc_handler_t clock_isr
    269301#else
    270302                   void (*clock_isr)(void *)
     
    290322    rtems_isr_entry previous_isr;
    291323    rtems_interrupt_catch(clock_isr, PPC_IRQ_PIT, &previous_isr);
     324    ClockOn();
     325 }
     326#elif defined(BSP_PPC403_CLOCK_HOOK_EXCEPTION)
     327 {
     328        ppc_exc_set_handler( BSP_PPC403_CLOCK_HOOK_EXCEPTION, clock_isr );
    292329    ClockOn();
    293330 }
     
    313350#if PPC_HAS_CLASSIC_EXCEPTIONS
    314351                rtems_isr_entry new_clock_isr
     352#elif defined(BSP_PPC403_CLOCK_HOOK_EXCEPTION)
     353                ppc_exc_handler_t clock_isr
    315354#else
    316355                void (*new_clock_isr)(void *)
     
    327366   rtems_interrupt_catch(new_clock_isr, PPC_IRQ_PIT, &previous_isr);
    328367   ClockOn();
     368 }
     369#elif defined(BSP_PPC403_CLOCK_HOOK_EXCEPTION)
     370 {
     371        ppc_exc_set_handler( BSP_PPC403_CLOCK_HOOK_EXCEPTION, clock_isr );
     372    ClockOn();
    329373 }
    330374#else
     
    371415 
    372416  (void) set_vector(0, PPC_IRQ_PIT, 1);
     417#elif defined(BSP_PPC403_CLOCK_HOOK_EXCEPTION)
     418  ClockOff();
     419  ppc_exc_set_handler( BSP_PPC403_CLOCK_HOOK_EXCEPTION, 0 );
    373420#else
    374421 {
     
    424471#if PPC_HAS_CLASSIC_EXCEPTIONS
    425472        Clock_isr(PPC_IRQ_PIT);
     473#elif defined(BSP_PPC403_CLOCK_HOOK_EXCEPTION)
     474        Clock_isr(NULL, BSP_PPC403_CLOCK_HOOK_EXCEPTION);
    426475#else
    427476        Clock_isr(NULL);
Note: See TracChangeset for help on using the changeset viewer.