rthw.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * File : rthw.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006 - 2012, 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. * 2006-03-18 Bernard the first version
  13. * 2006-04-25 Bernard add rt_hw_context_switch_interrupt declaration
  14. * 2006-09-24 Bernard add rt_hw_context_switch_to declaration
  15. * 2012-12-29 Bernard add rt_hw_exception_install declaration
  16. */
  17. #ifndef __RT_HW_H__
  18. #define __RT_HW_H__
  19. #include <rtthread.h>
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /*
  24. * CPU interfaces
  25. */
  26. void rt_hw_cpu_icache_enable(void);
  27. void rt_hw_cpu_icache_disable(void);
  28. rt_base_t rt_hw_cpu_icache_status(void);
  29. void rt_hw_cpu_dcache_enable(void);
  30. void rt_hw_cpu_dcache_disable(void);
  31. rt_base_t rt_hw_cpu_dcache_status(void);
  32. void rt_hw_cpu_reset(void);
  33. void rt_hw_cpu_shutdown(void);
  34. rt_uint8_t *rt_hw_stack_init(void *entry,
  35. void *parameter,
  36. rt_uint8_t *stack_addr,
  37. void *exit);
  38. /*
  39. * Interrupt handler definition
  40. */
  41. typedef void (*rt_isr_handler_t)(int vector, void *param);
  42. struct rt_irq_desc {
  43. rt_isr_handler_t handler;
  44. void *param;
  45. #ifdef RT_USING_INTERRUPT_INFO
  46. char name[RT_NAME_MAX];
  47. rt_uint32_t counter;
  48. #endif
  49. };
  50. /*
  51. * Interrupt interfaces
  52. */
  53. void rt_hw_interrupt_init(void);
  54. void rt_hw_interrupt_mask(int vector);
  55. void rt_hw_interrupt_umask(int vector);
  56. rt_isr_handler_t rt_hw_interrupt_install(int vector,
  57. rt_isr_handler_t handler,
  58. void *param,
  59. char *name);
  60. rt_base_t rt_hw_interrupt_disable(void);
  61. void rt_hw_interrupt_enable(rt_base_t level);
  62. /*
  63. * Context interfaces
  64. */
  65. void rt_hw_context_switch(rt_uint32_t from, rt_uint32_t to);
  66. void rt_hw_context_switch_to(rt_uint32_t to);
  67. void rt_hw_context_switch_interrupt(rt_uint32_t from, rt_uint32_t to);
  68. void rt_hw_console_output(const char *str);
  69. void rt_hw_backtrace(rt_uint32_t *fp, rt_uint32_t thread_entry);
  70. void rt_hw_show_memory(rt_uint32_t addr, rt_uint32_t size);
  71. /*
  72. * Exception interfaces
  73. */
  74. void rt_hw_exception_install(rt_err_t (*exception_handle)(void* context));
  75. #ifdef __cplusplus
  76. }
  77. #endif
  78. #endif