rti_config.h 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * File : rti_config.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. * 2018-06-05 flybreak first version
  23. */
  24. #ifndef __RTI_CONFIG_H__
  25. #define __RTI_CONFIG_H__
  26. #include "rtconfig.h"
  27. #include "rtdevice.h"
  28. /* RTI interrupt configuration */
  29. #if defined(ARCH_ARM_CORTEX_M3) || defined(ARCH_ARM_CORTEX_M4) || defined(ARCH_ARM_CORTEX_M7)
  30. #define RTI_GET_ISR_ID() ((*(rt_uint32_t *)(0xE000ED04)) & 0x1FF) // Get the currently active interrupt Id. (i.e. read Cortex-M ICSR[8:0] = active vector)
  31. #elif defined(ARCH_ARM_CORTEX_M0)
  32. #if defined(__ICCARM__)
  33. #define RTI_GET_ISR_ID() (__get_IPSR()) // Workaround for IAR, which might do a byte-access to 0xE000ED04. Read IPSR instead.
  34. #else
  35. #define RTI_GET_ISR_ID() ((*(rt_uint32_t *)(0xE000ED04)) & 0x3F) // Get the currently active interrupt Id. (i.e. read Cortex-M ICSR[5:0] = active vector)
  36. #endif
  37. #else
  38. #error "This kernel is not currently supported, You can implement this function yourself"
  39. #define RTI_GET_ISR_ID() // Get the currently active interrupt Id from the user-provided function.
  40. #endif
  41. /* RTI buffer configuration */
  42. #ifndef PKG_USING_RTI
  43. #define RTI_BUFFER_SIZE 2048 // Number of bytes that RTI uses for the buffer.
  44. #else
  45. #define RTI_BUFFER_SIZE PKG_RTI_BUFFER_SIZE
  46. #endif
  47. /* RTI Id configuration */
  48. #ifndef PKG_USING_RTI
  49. #define RTI_RAM_BASE_ADDRESS 0x20000000 // Default value for the lowest Id reported by the application.
  50. #define RTI_ID_SHIFT 2 // Number of bits to shift the Id to save bandwidth. (i.e. 2 when Ids are 4 byte aligned)
  51. #else
  52. #define RTI_RAM_BASE_ADDRESS PKG_RTI_RAM_BASE
  53. #define RTI_ID_SHIFT PKG_RTI_ID_SHIFT
  54. #endif
  55. /* The application name to be displayed in RTI */
  56. #ifndef RTI_APP_NAME
  57. #ifndef PKG_USING_RTI
  58. #define RTI_APP_NAME "RT-Thread RTI"
  59. #else
  60. #define RTI_APP_NAME PKG_RTI_APP_NAME
  61. #endif
  62. #endif
  63. #ifndef RTI_SYS_DESC0
  64. #ifndef PKG_USING_RTI
  65. #define RTI_SYS_DESC0 "I#15=SysTick"
  66. #else
  67. #define RTI_SYS_DESC0 PKG_RTI_SYS_DESC0
  68. #endif
  69. #endif
  70. #ifndef RTI_SYS_DESC1
  71. #ifndef PKG_USING_RTI
  72. #define RTI_SYS_DESC1 ""
  73. #else
  74. #define RTI_SYS_DESC1 PKG_RTI_SYS_DESC1
  75. #endif
  76. #endif
  77. extern unsigned int SystemCoreClock;
  78. #define rt_uint64_t unsigned long long
  79. #define RTI_GET_TIMESTAMP() clock_cpu_gettime()
  80. #define RTI_SYS_FREQ (SystemCoreClock)
  81. #define RTI_CPU_FREQ (SystemCoreClock)
  82. #define RTI_MAX_STRING_LEN 128
  83. #define RTI_DATE_PACKAGE_SIZE 1024
  84. #endif