92 lines
2.9 KiB
C
92 lines
2.9 KiB
C
/****************************************************************************
|
|
* arch/rgmp/include/irq.h
|
|
*
|
|
* Copyright (C) 2011 Yu Qiang. All rights reserved.
|
|
* Author: Yu Qiang <yuq825@gmail.com>
|
|
*
|
|
* This file is a part of NuttX:
|
|
*
|
|
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
*
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in
|
|
* the documentation and/or other materials provided with the
|
|
* distribution.
|
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
* used to endorse or promote products derived from this software
|
|
* without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
*
|
|
****************************************************************************/
|
|
|
|
#ifndef __ARCH_RGMP_INCLUDE_IRQ_H
|
|
#define __ARCH_RGMP_INCLUDE_IRQ_H
|
|
|
|
#define NR_IRQS 0
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#include <arch/types.h>
|
|
|
|
#include <rgmp/trap.h>
|
|
#include <rgmp/arch/arch.h>
|
|
|
|
struct xcptcontext
|
|
{
|
|
struct rgmp_context ctx;
|
|
|
|
/* For signal using */
|
|
|
|
unsigned int save_eip;
|
|
unsigned int save_eflags;
|
|
void *sigdeliver;
|
|
};
|
|
|
|
void push_xcptcontext(struct xcptcontext *xcp);
|
|
void pop_xcptcontext(struct xcptcontext *xcp);
|
|
|
|
extern int nest_irq;
|
|
|
|
/* Name: up_irq_save, up_irq_restore, and friends.
|
|
*
|
|
* NOTE: This function should never be called from application code and,
|
|
* as a general rule unless you really know what you are doing, this
|
|
* function should not be called directly from operation system code either:
|
|
* Typically, the wrapper functions, enter_critical_section() and
|
|
* leave_critical section(), are probably what you really want.
|
|
*/
|
|
|
|
static inline irqstate_t up_irq_save(void)
|
|
{
|
|
unsigned long flags;
|
|
local_irq_save(flags);
|
|
return flags;
|
|
}
|
|
|
|
static inline void up_irq_restore(irqstate_t flags)
|
|
{
|
|
local_irq_restore(flags);
|
|
}
|
|
|
|
#endif /* !__ASSEMBLY__ */
|
|
|
|
#endif
|