blob: 5d0f7564e9b8e8656b7b9c2ebb07ee89e28a1a9d [file] [log] [blame]
Daniel Hellstromc2f02da2008-03-28 09:47:00 +01001/* IRQ functions
2 *
3 * (C) Copyright 2007
4 * Daniel Hellstrom, Gaisler Research, daniel@gaisler.com.
5 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Daniel Hellstromc2f02da2008-03-28 09:47:00 +01007 */
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ård44d06772015-11-06 12:44:01 +000015static inline void set_pil(unsigned int level)
Daniel Hellstromc2f02da2008-03-28 09:47:00 +010016{
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ård44d06772015-11-06 12:44:01 +000023static inline unsigned int get_pil(void)
Daniel Hellstromc2f02da2008-03-28 09:47:00 +010024{
25 unsigned int psr = get_psr();
26 return (psr & PSR_PIL) >> PSR_PIL_OFS;
27}
28
29/* Disables interrupts and return current PIL value */
30extern int intLock(void);
31
32/* Sets the PIL to oldLevel */
33extern void intUnlock(int oldLevel);
34
Daniel Hellstromf33f8882010-01-22 11:57:49 +010035/* Return non-zero if interrupts are currently enabled */
36extern int interrupt_is_enabled(void);
37
Daniel Hellstromc2f02da2008-03-28 09:47:00 +010038#endif