application.c 966 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * File : app.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://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2010-06-25 Bernard first version
  13. */
  14. /**
  15. * @addtogroup JZ47xx
  16. */
  17. /*@{*/
  18. #include <rtthread.h>
  19. #include <jz4755.h>
  20. static struct rt_thread thread1;
  21. static rt_uint8_t thread1_stack[1024];
  22. void thread_entry(void* parameter)
  23. {
  24. while (1)
  25. {
  26. rt_kprintf("IPR: 0x%08x, SR : 0x%08x, CAUSE: 0x%08x\n", INTC_IPR, read_c0_status(), read_c0_cause());
  27. rt_thread_delay(100);
  28. }
  29. }
  30. int rt_application_init()
  31. {
  32. rt_err_t result;
  33. result = rt_thread_init(&thread1, "t1",
  34. thread_entry, RT_NULL,
  35. &thread1_stack[0], sizeof(thread1_stack),
  36. 200, 10);
  37. if (result == RT_EOK)
  38. rt_thread_startup(&thread1);
  39. return 0;
  40. }
  41. /*@}*/