rthw.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. *
  20. * Change Logs:
  21. * Date Author Notes
  22. * 2006-03-18 Bernard the first version
  23. * 2006-04-25 Bernard add rt_hw_context_switch_interrupt declaration
  24. * 2006-09-24 Bernard add rt_hw_context_switch_to declaration
  25. * 2012-12-29 Bernard add rt_hw_exception_install declaration
  26. */
  27. #ifndef __RT_HW_H__
  28. #define __RT_HW_H__
  29. #include <rtthread.h>
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. /*
  34. * CPU interfaces
  35. */
  36. void rt_hw_cpu_icache_enable(void);
  37. void rt_hw_cpu_icache_disable(void);
  38. rt_base_t rt_hw_cpu_icache_status(void);
  39. void rt_hw_cpu_dcache_enable(void);
  40. void rt_hw_cpu_dcache_disable(void);
  41. rt_base_t rt_hw_cpu_dcache_status(void);
  42. void rt_hw_cpu_reset(void);
  43. void rt_hw_cpu_shutdown(void);
  44. rt_uint8_t *rt_hw_stack_init(void *entry,
  45. void *parameter,
  46. rt_uint8_t *stack_addr,
  47. void *exit);
  48. /*
  49. * Interrupt handler definition
  50. */
  51. typedef void (*rt_isr_handler_t)(int vector, void *param);
  52. struct rt_irq_desc
  53. {
  54. rt_isr_handler_t handler;
  55. void *param;
  56. #ifdef RT_USING_INTERRUPT_INFO
  57. char name[RT_NAME_MAX];
  58. rt_uint32_t counter;
  59. #endif
  60. };
  61. /*
  62. * Interrupt interfaces
  63. */
  64. void rt_hw_interrupt_init(void);
  65. void rt_hw_interrupt_mask(int vector);
  66. void rt_hw_interrupt_umask(int vector);
  67. rt_isr_handler_t rt_hw_interrupt_install(int vector,
  68. rt_isr_handler_t handler,
  69. void *param,
  70. char *name);
  71. rt_base_t rt_hw_interrupt_disable(void);
  72. void rt_hw_interrupt_enable(rt_base_t level);
  73. /*
  74. * Context interfaces
  75. */
  76. void rt_hw_context_switch(rt_uint32_t from, rt_uint32_t to);
  77. void rt_hw_context_switch_to(rt_uint32_t to);
  78. void rt_hw_context_switch_interrupt(rt_uint32_t from, rt_uint32_t to);
  79. void rt_hw_console_output(const char *str);
  80. void rt_hw_backtrace(rt_uint32_t *fp, rt_uint32_t thread_entry);
  81. void rt_hw_show_memory(rt_uint32_t addr, rt_uint32_t size);
  82. /*
  83. * Exception interfaces
  84. */
  85. void rt_hw_exception_install(rt_err_t (*exception_handle)(void *context));
  86. #ifdef __cplusplus
  87. }
  88. #endif
  89. #endif