OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [librtems++/] [include/] [rtems++/] [rtemsInterrupt.h] - Diff between revs 30 and 173

Only display areas with differences | Details | Blame | View Log

Rev 30 Rev 173
/*
/*
  ------------------------------------------------------------------------
  ------------------------------------------------------------------------
  $Id: rtemsInterrupt.h,v 1.2 2001-09-27 12:02:05 chris Exp $
  $Id: rtemsInterrupt.h,v 1.2 2001-09-27 12:02:05 chris Exp $
  ------------------------------------------------------------------------
  ------------------------------------------------------------------------
 
 
  COPYRIGHT (c) 1997
  COPYRIGHT (c) 1997
  Objective Design Systems Ltd Pty (ODS)
  Objective Design Systems Ltd Pty (ODS)
  All rights reserved (R) Objective Design Systems Ltd Pty
  All rights reserved (R) Objective Design Systems Ltd Pty
 
 
  The license and distribution terms for this file may be found in the
  The license and distribution terms for this file may be found in the
  file LICENSE in this distribution or at
  file LICENSE in this distribution or at
  http://www.OARcorp.com/rtems/license.html.
  http://www.OARcorp.com/rtems/license.html.
 
 
  ------------------------------------------------------------------------
  ------------------------------------------------------------------------
 
 
  rtemsInterrupt class.
  rtemsInterrupt class.
 
 
  This class catches an interrupt and passes control to the user's
  This class catches an interrupt and passes control to the user's
  derived class throught the handler method.
  derived class throught the handler method.
 
 
  The interrupt is released back to the previous handler when this
  The interrupt is released back to the previous handler when this
  object destructs.
  object destructs.
 
 
  The old handler can be chained to after the interrupt is
  The old handler can be chained to after the interrupt is
  caught. Watch the stack usage!
  caught. Watch the stack usage!
 
 
  More than one instance of this class can catch the same vector. The
  More than one instance of this class can catch the same vector. The
  application will have to chain to the other objects if required. If
  application will have to chain to the other objects if required. If
  the old handler is not an instance of this class the chain is passed
  the old handler is not an instance of this class the chain is passed
  as "void (*)(void)". If it is an instance of this class, the handler
  as "void (*)(void)". If it is an instance of this class, the handler
  method is directly called.
  method is directly called.
 
 
  The isr catch extends the documented return codes with :
  The isr catch extends the documented return codes with :
 
 
    RTEMS_RESOURCE_IN_USE = interrupt already caught
    RTEMS_RESOURCE_IN_USE = interrupt already caught
 
 
  ------------------------------------------------------------------------ */
  ------------------------------------------------------------------------ */
 
 
#if !defined(_rtemsInterrupt_h_)
#if !defined(_rtemsInterrupt_h_)
#define _rtemsInterrupt_h_
#define _rtemsInterrupt_h_
 
 
#include <rtems++/rtemsStatusCode.h>
#include <rtems++/rtemsStatusCode.h>
 
 
/* ----
/* ----
    rtemsInterrupt
    rtemsInterrupt
*/
*/
 
 
class rtemsInterrupt
class rtemsInterrupt
  : public rtemsStatusCode
  : public rtemsStatusCode
{
{
public:
public:
  rtemsInterrupt();
  rtemsInterrupt();
  virtual ~rtemsInterrupt();
  virtual ~rtemsInterrupt();
 
 
  // catch the interrupt
  // catch the interrupt
  virtual const rtems_status_code isr_catch(const rtems_vector_number vector);
  virtual const rtems_status_code isr_catch(const rtems_vector_number vector);
 
 
  // release the interrupt back to the previous handle
  // release the interrupt back to the previous handle
  virtual const rtems_status_code release();
  virtual const rtems_status_code release();
 
 
  // the old handler
  // the old handler
  const rtems_isr_entry old_isr_handler() const { return old_handler; }
  const rtems_isr_entry old_isr_handler() const { return old_handler; }
 
 
protected:
protected:
 
 
  // called after the interrupt is caught and it goes off
  // called after the interrupt is caught and it goes off
  virtual void handler() = 0;
  virtual void handler() = 0;
 
 
  // chain to the previous handler, 
  // chain to the previous handler, 
  inline void chain() const;
  inline void chain() const;
 
 
private:
private:
  const rtemsInterrupt& operator=(const rtemsInterrupt& );
  const rtemsInterrupt& operator=(const rtemsInterrupt& );
  rtemsInterrupt(const rtemsInterrupt& );
  rtemsInterrupt(const rtemsInterrupt& );
 
 
  // the vector caught
  // the vector caught
  rtems_vector_number vector;
  rtems_vector_number vector;
 
 
  // true when the interrupt is caught
  // true when the interrupt is caught
  bool caught;
  bool caught;
 
 
  // returned when catching the interrupt
  // returned when catching the interrupt
  rtems_isr_entry old_handler;
  rtems_isr_entry old_handler;
 
 
  // old interrupt table entry
  // old interrupt table entry
  rtemsInterrupt *old_interrupt;
  rtemsInterrupt *old_interrupt;
 
 
  // common handler to redirect the interrupts
  // common handler to redirect the interrupts
  static void redirector(rtems_vector_number vector);
  static void redirector(rtems_vector_number vector);
};
};
 
 
void rtemsInterrupt::chain() const
void rtemsInterrupt::chain() const
{
{
  if (old_interrupt)
  if (old_interrupt)
    old_interrupt->handler();
    old_interrupt->handler();
  else if (old_handler)
  else if (old_handler)
    ((void(*)()) old_handler)();
    ((void(*)()) old_handler)();
}
}
 
 
#endif  // _rtemsInterrupt_h_
#endif  // _rtemsInterrupt_h_
 
 
 
 
 
 
 
 
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.