1 /* -------------------------------- Arctic Core ------------------------------
\r
2 * Arctic Core - the open source AUTOSAR platform http://arccore.com
\r
4 * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
\r
6 * This source code is free software; you can redistribute it and/or modify it
\r
7 * under the terms of the GNU General Public License version 2 as published by the
\r
8 * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
\r
10 * This program is distributed in the hope that it will be useful, but
\r
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
\r
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
\r
14 * -------------------------------- Arctic Core ------------------------------*/
\r
19 #include "Std_Types.h"
\r
20 typedef uint32_t imask_t;
\r
22 #define Irq_Disable() asm volatile (" sei");
\r
23 #define Irq_Enable() asm volatile (" cli");
\r
25 #define Irq_SuspendAll() Irq_Disable()
\r
26 #define Irq_ResumeAll() Irq_Enable()
\r
28 #define Irq_SuspendOs() Irq_Disable()
\r
29 #define Irq_ResumeOs() Irq_Enable()
\r
31 #define Irq_Save(flags) flags = _Irq_Disable_save()
\r
32 #define Irq_Restore(flags) _Irq_Disable_restore(flags)
\r
34 /*-----------------------------------------------------------------*/
\r
36 static inline unsigned long _Irq_Disable_save(void)
\r
38 unsigned long result;
\r
39 asm volatile ("tfr CCR, %0" : "=r" (result) : );
\r
44 /*-----------------------------------------------------------------*/
\r
46 static inline void _Irq_Disable_restore(unsigned long flags)
\r
48 asm volatile ("tfr %0, CCR" : : "r" (flags) );
\r
51 #define ilog2(x) __builtin_ffs(x)
\r