1
0

trap.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. * 2010-03-18 zchong for sep4020
  14. */
  15. #include <rtthread.h>
  16. #include <rthw.h>
  17. #include "sep4020.h"
  18. /**
  19. * @addtogroup SEP4020
  20. */
  21. /*@{*/
  22. extern rt_isr_handler_t isr_table[];
  23. void rt_hw_trap_irq()
  24. {
  25. rt_uint32_t intstat,intnum;
  26. rt_uint8_t i = 0;
  27. rt_isr_handler_t isr_func;
  28. /* get interrupt source */
  29. intstat = INTC_IFSR;
  30. intnum = intstat;
  31. if (intstat == INTGLOBAL) return;
  32. while(intnum != 0x00000001)
  33. {
  34. intnum = intnum>>1;
  35. i++;
  36. }
  37. /* get interrupt service routine */
  38. isr_func = isr_table[i];
  39. /* turn to interrupt service routine */
  40. isr_func(intstat);
  41. }
  42. void rt_hw_trap_fiq()
  43. {
  44. rt_kprintf("fast interrupt request\n");
  45. }
  46. extern struct rt_thread* rt_current_thread;
  47. void rt_hw_trap_abort()
  48. {
  49. rt_kprintf("Abort occured!!! Thread [%s] suspended.\n",rt_current_thread->name);
  50. rt_thread_suspend(rt_current_thread);
  51. rt_schedule();
  52. }
  53. /*@}*/