trap.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * File : trap.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://openlab.rt-thread.com/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2006-08-25 Bernard first version
  13. */
  14. #include <rtthread.h>
  15. #include <rthw.h>
  16. #include "AT91SAM7X256.h"
  17. /**
  18. * @addtogroup AT91SAM7
  19. */
  20. /*@{*/
  21. void rt_hw_trap_irq(void)
  22. {
  23. int irqno;
  24. extern struct rt_irq_desc irq_desc[];
  25. /* get interrupt number */
  26. irqno = AT91C_BASE_AIC->AIC_ISR;
  27. /* invoke isr with parameters */
  28. irq_desc[irqno].handler(irqno, irq_desc[irqno].param);
  29. /* end of interrupt */
  30. AT91C_BASE_AIC->AIC_EOICR = 0;
  31. }
  32. void rt_hw_trap_fiq(void)
  33. {
  34. rt_kprintf("fast interrupt request\n");
  35. }
  36. extern struct rt_thread* rt_current_thread;
  37. void rt_hw_trap_abort(void)
  38. {
  39. rt_kprintf("Abort occured!!! Thread [%s] suspended.\n",rt_current_thread->name);
  40. rt_thread_suspend(rt_current_thread);
  41. rt_schedule();
  42. }
  43. /*@}*/