Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 1 | /* IRQ functions |
| 2 | * |
| 3 | * (C) Copyright 2007 |
| 4 | * Daniel Hellstrom, Gaisler Research, daniel@gaisler.com. |
| 5 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 6 | * SPDX-License-Identifier: GPL-2.0+ |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #ifndef __SPARC_IRQ_H__ |
| 10 | #define __SPARC_IRQ_H__ |
| 11 | |
| 12 | #include <asm/psr.h> |
| 13 | |
| 14 | /* Set SPARC Processor Interrupt Level */ |
Måns Rullgård | 44d0677 | 2015-11-06 12:44:01 +0000 | [diff] [blame] | 15 | static inline void set_pil(unsigned int level) |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 16 | { |
| 17 | unsigned int psr = get_psr(); |
| 18 | |
| 19 | put_psr((psr & ~PSR_PIL) | ((level & 0xf) << PSR_PIL_OFS)); |
| 20 | } |
| 21 | |
| 22 | /* Get SPARC Processor Interrupt Level */ |
Måns Rullgård | 44d0677 | 2015-11-06 12:44:01 +0000 | [diff] [blame] | 23 | static inline unsigned int get_pil(void) |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 24 | { |
| 25 | unsigned int psr = get_psr(); |
| 26 | return (psr & PSR_PIL) >> PSR_PIL_OFS; |
| 27 | } |
| 28 | |
| 29 | /* Disables interrupts and return current PIL value */ |
| 30 | extern int intLock(void); |
| 31 | |
| 32 | /* Sets the PIL to oldLevel */ |
| 33 | extern void intUnlock(int oldLevel); |
| 34 | |
Daniel Hellstrom | f33f888 | 2010-01-22 11:57:49 +0100 | [diff] [blame] | 35 | /* Return non-zero if interrupts are currently enabled */ |
| 36 | extern int interrupt_is_enabled(void); |
| 37 | |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 38 | #endif |