EventCombinerP.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. * Copyright (c) 2017-present, Texas Instruments Incorporated
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. *
  9. * * Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. *
  12. * * Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. *
  16. * * Neither the name of Texas Instruments Incorporated nor the names of
  17. * its contributors may be used to endorse or promote products derived
  18. * from this software without specific prior written permission.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  21. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  22. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  23. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  24. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  25. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  26. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  27. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  28. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  29. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  30. * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. */
  32. /** ============================================================================
  33. * @file EventCombinerP.h
  34. *
  35. * @brief Event Combiner routines for the RTOS Porting Interface
  36. *
  37. *
  38. * ============================================================================
  39. */
  40. #ifndef ti_osal_EventCombinerP__include
  41. #define ti_osal_EventCombinerP__include
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45. #include <stdint.h>
  46. #include <stdbool.h>
  47. #include <stddef.h>
  48. #include <ti/osal/HwiP.h>
  49. int32_t EventCombinerP_disableEvent(uint32_t eventId);
  50. /*!
  51. * @brief Function to disable an event inside event combiner
  52. *
  53. * @param addr Start address of the cache line/s
  54. *
  55. * @param size size (in bytes) of the memory to invalidate
  56. *
  57. */
  58. int32_t EventCombinerP_enableEvent(uint32_t eventId);
  59. /*!
  60. * @brief Function to Enable an event inside event combiner
  61. *
  62. * @param eventId The event id (4-127)
  63. *
  64. */
  65. int32_t EventCombinerP_dispatchPlug(uint32_t eventId, void (*eventIsrRoutine)(uint32_t),uintptr_t arg,bool unmask );
  66. /*!
  67. * @brief Function to plug an ISR handler to an event inside event combiner
  68. *
  69. * @param eventId The event id (4-127)
  70. *
  71. * @param eventIsrRoutine The ISR routine for servicing the event
  72. *
  73. * @param arg The argument to the ISR routine
  74. *
  75. * @param unmask Unmask the event
  76. */
  77. HwiP_Handle EventCombinerP_getHwi(uint32_t groupNum);
  78. /*!
  79. * @brief Function to return the Hwi Handle corresponding to an event combiner group number
  80. *
  81. * @param groupNum The event combiner group id (0-3)
  82. *
  83. */
  84. int32_t EventCombinerP_getIntNum(uint32_t groupNum);
  85. /*!
  86. * @brief Function to return the interrupt vector number corresponding to
  87. * a group number (0-3)
  88. *
  89. * @param groupNum The event combiner group id (0-3)
  90. *
  91. */
  92. int32_t EventCombinerP_SingleRegisterInt(int32_t groupNum, int32_t intNum);
  93. /*!
  94. * @brief Function to register single event combiner group to a vector number
  95. *
  96. * @param groupNum The event combiner group id (0-3)
  97. *
  98. * @param intNum The interrupt vector id (4-15)
  99. *
  100. */
  101. int32_t EventCombinerP_GroupRegisterInt(int32_t intNum[]);
  102. /*!
  103. * @brief Function to register single event combiner group to a vector number
  104. *
  105. * @param intNum [] List of interrupt vector ids (4-15) per ECM group(0-3)
  106. *
  107. */
  108. #define OSAL_EVTCOMBINE_GROUPREG_SUCCESS (0)
  109. #define OSAL_EVTCOMBINE_ERR_GROUPREG_REGISTER_ERR (-1)
  110. #define OSAL_EVTCOMBINE_ERR_GROUPREG_INVALID_INTNUM (-2)
  111. /* These are the system default interrupt numbers if the Event Combiner has already not been registered
  112. * If applications register Event Combiners during startup, these values may not be used (in SYSBIOS case)
  113. * If not, these are the interrupts reserved for Event Combiner group events (0-3).
  114. * These defaults are stored in Osal_HwAttrs.ECM_intNum[] and can be obtained by the
  115. * application at run time through the OSAL API Osal_getHwAttrs(). These values also can be modified
  116. * using Osal_setHwAttrs(Osal_HwAttrs,OSAL_HWATTR_SET_ECM_INT)
  117. */
  118. #define OSAL_ECM_GROUP0_INT 4
  119. #define OSAL_ECM_GROUP1_INT 5
  120. #define OSAL_ECM_GROUP2_INT 6
  121. #define OSAL_ECM_GROUP3_INT 7
  122. #ifdef __cplusplus
  123. }
  124. #endif
  125. #endif /* ti_osalEventCombinerP__include */