2006-10-24 12:21:16 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2006 Atmel Corporation
|
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2006-10-24 12:21:16 +00:00
|
|
|
*/
|
|
|
|
#include <common.h>
|
|
|
|
|
|
|
|
#include <asm/sysreg.h>
|
|
|
|
|
|
|
|
void enable_interrupts(void)
|
|
|
|
{
|
|
|
|
asm volatile("csrf %0" : : "n"(SYSREG_GM_OFFSET));
|
|
|
|
}
|
|
|
|
|
|
|
|
int disable_interrupts(void)
|
|
|
|
{
|
|
|
|
unsigned long sr;
|
|
|
|
|
|
|
|
sr = sysreg_read(SR);
|
|
|
|
asm volatile("ssrf %0" : : "n"(SYSREG_GM_OFFSET));
|
|
|
|
|
2009-01-23 11:56:32 +00:00
|
|
|
#ifdef CONFIG_AT32UC3A0xxx
|
|
|
|
/* Two NOPs are required after masking interrupts on the
|
|
|
|
* AT32UC3A0512ES. See errata 41.4.5.5. */
|
|
|
|
asm("nop");
|
|
|
|
asm("nop");
|
|
|
|
#endif
|
|
|
|
|
2007-12-17 10:02:44 +00:00
|
|
|
return !SYSREG_BFEXT(GM, sr);
|
2006-10-24 12:21:16 +00:00
|
|
|
}
|