exception.c 859 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* Basic functions for adding/removing custom exception handlers
  2. *
  3. * Copyright 2004-2009 Analog Devices Inc.
  4. *
  5. * Licensed under the GPL-2 or later
  6. */
  7. #include <linux/module.h>
  8. #include <asm/irq_handler.h>
  9. int bfin_request_exception(unsigned int exception, void (*handler)(void))
  10. {
  11. void (*curr_handler)(void);
  12. if (exception > 0x3F)
  13. return -EINVAL;
  14. curr_handler = ex_table[exception];
  15. if (curr_handler != ex_replaceable)
  16. return -EBUSY;
  17. ex_table[exception] = handler;
  18. return 0;
  19. }
  20. EXPORT_SYMBOL(bfin_request_exception);
  21. int bfin_free_exception(unsigned int exception, void (*handler)(void))
  22. {
  23. void (*curr_handler)(void);
  24. if (exception > 0x3F)
  25. return -EINVAL;
  26. curr_handler = ex_table[exception];
  27. if (curr_handler != handler)
  28. return -EBUSY;
  29. ex_table[exception] = ex_replaceable;
  30. return 0;
  31. }
  32. EXPORT_SYMBOL(bfin_free_exception);