summaryrefslogtreecommitdiff
path: root/src/irq.c
diff options
context:
space:
mode:
authorbernard.xiong <[email protected]>2009-07-02 22:48:23 +0000
committerbernard.xiong <[email protected]>2009-07-02 22:48:23 +0000
commitbda4730a9482c23083006abea939ee8d95d6ecff (patch)
tree83005121824bd50ac74e63688c0d5eac148665f8 /src/irq.c
parent80c72e66de0b00b1a6de3e3508366a4c3eee458d (diff)
import RT-Thread RTOS 0.3.x to Google SVN
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'src/irq.c')
-rw-r--r--src/irq.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/irq.c b/src/irq.c
new file mode 100644
index 0000000000..cdad403976
--- /dev/null
+++ b/src/irq.c
@@ -0,0 +1,69 @@
+/*
+ * File : irq.c
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2006, RT-Thread Development Team
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://openlab.rt-thread.com/license/LICENSE
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2006-02-24 Bernard first version
+ * 2006-05-03 Bernard add IRQ_DEBUG
+ */
+
+#include <rthw.h>
+#include <rtthread.h>
+
+/* #define IRQ_DEBUG */
+
+/**
+ * @addtogroup Kernel
+ */
+
+/*@{*/
+
+volatile rt_uint32_t rt_interrupt_nest;
+
+/**
+ * This function will be invoked by BSP, when enter interrupt service routine
+ *
+ * @note please don't invoke this routine in application
+ *
+ * @see rt_interrupt_leave
+ */
+void rt_interrupt_enter()
+{
+ rt_base_t level;
+
+#ifdef IRQ_DEBUG
+ rt_kprintf("irq comming..., irq nest:%d\n", rt_interrupt_nest);
+#endif
+
+ level = rt_hw_interrupt_disable();
+ rt_interrupt_nest ++;
+ rt_hw_interrupt_enable(level);
+}
+
+/**
+ * This function will be invoked by BSP, when leave interrupt service routine
+ *
+ * @note please don't invoke this routine in application
+ *
+ * @see rt_interrupt_enter
+ */
+void rt_interrupt_leave()
+{
+ rt_base_t level;
+
+#ifdef IRQ_DEBUG
+ rt_kprintf("irq leave, irq nest:%d\n", rt_interrupt_nest);
+#endif
+
+ level = rt_hw_interrupt_disable();
+ rt_interrupt_nest --;
+ rt_hw_interrupt_enable(level);
+}
+
+/*@}*/