interrupts.c 583 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (C) 2006 Atmel Corporation
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <asm/sysreg.h>
  8. int interrupt_init(void)
  9. {
  10. return 0;
  11. }
  12. void enable_interrupts(void)
  13. {
  14. asm volatile("csrf %0" : : "n"(SYSREG_GM_OFFSET));
  15. }
  16. int disable_interrupts(void)
  17. {
  18. unsigned long sr;
  19. sr = sysreg_read(SR);
  20. asm volatile("ssrf %0" : : "n"(SYSREG_GM_OFFSET));
  21. #ifdef CONFIG_AT32UC3A0xxx
  22. /* Two NOPs are required after masking interrupts on the
  23. * AT32UC3A0512ES. See errata 41.4.5.5. */
  24. asm("nop");
  25. asm("nop");
  26. #endif
  27. return !SYSREG_BFEXT(GM, sr);
  28. }