rtos_bindings.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. //*****************************************************************************
  2. //
  3. // rtos_bindings.h - Macros intended to aid porting of MSP432E4 driverlib
  4. // modules for use with an RTOS.
  5. //
  6. // Copyright (c) 2012-2017 Texas Instruments Incorporated. All rights reserved.
  7. // Software License Agreement
  8. //
  9. // Redistribution and use in source and binary forms, with or without
  10. // modification, are permitted provided that the following conditions
  11. // are met:
  12. //
  13. // Redistributions of source code must retain the above copyright
  14. // notice, this list of conditions and the following disclaimer.
  15. //
  16. // Redistributions in binary form must reproduce the above copyright
  17. // notice, this list of conditions and the following disclaimer in the
  18. // documentation and/or other materials provided with the
  19. // distribution.
  20. //
  21. // Neither the name of Texas Instruments Incorporated nor the names of
  22. // its contributors may be used to endorse or promote products derived
  23. // from this software without specific prior written permission.
  24. //
  25. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  26. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  27. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  28. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  29. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  30. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  31. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  32. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  33. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  34. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  35. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  36. //
  37. //*****************************************************************************
  38. #ifndef __DRIVERLIB_RTOS_BINDINGS_H__
  39. #define __DRIVERLIB_RTOS_BINDINGS_H__
  40. #ifdef USE_RTOS
  41. //*****************************************************************************
  42. //
  43. // If an RTOS is in use, implement a header file called "msp432e4_rtos.h"
  44. // which contains RTOS-specific versions of each of the macros defined below
  45. // and make sure it appears on the include path set when you build your
  46. // project.
  47. //
  48. // Note that there is no default implementation of this header file included
  49. // in MSP432E4 SDK - it is your responsibility to create it specifically for
  50. // your RTOS.
  51. //
  52. //*****************************************************************************
  53. #include "msp432e4_rtos.h"
  54. #else
  55. //*****************************************************************************
  56. //
  57. // When no RTOS is in use, the follow macros compile to either nothing or a
  58. // minimal implementation that works in a bare-metal environment.
  59. //
  60. // Each of these macros must be redefined in msp432e4_rtos.h if you are using
  61. // MSP432E4 SDK under an RTOS.
  62. //
  63. //*****************************************************************************
  64. //*****************************************************************************
  65. //
  66. // A simple macro used to yield within polling loops. In the default, non-RTOS
  67. // implementation, this compiles to nothing.
  68. //
  69. //*****************************************************************************
  70. #define OS_YIELD()
  71. //*****************************************************************************
  72. //
  73. // A simple macro around the SysCtlDelay function. The parameter is the number
  74. // of 3 cycle loops to wait before returning (as for SysCtlDelay). In an RTOS
  75. // implementation, this could be replaced with an OS delay call with
  76. // appropriate parameter scaling.
  77. //
  78. //*****************************************************************************
  79. #define OS_DELAY(ul3Cycles) MAP_SysCtlDelay(ul3Cycles)
  80. //*****************************************************************************
  81. //
  82. // Wrappers around low level interrupt control functions. For information
  83. // on each of these functions, please see the appropriate API documentation
  84. // for the DriverLib Interrupt driver.
  85. //
  86. // The macros defined here represent interrupt-control functions that may be
  87. // called from within MSP432E4 driverlib code. It is expected that application
  88. // code will use RTOS-specific functions to control interrupt priority, to
  89. // pend interrupts and to perform runtime vector manipulation. As a result,
  90. // no macros are defined to wrap any of these functions from interrupt.c.
  91. //
  92. //*****************************************************************************
  93. #define OS_INT_MASTER_ENABLE() MAP_IntMasterEnable()
  94. #define OS_INT_MASTER_DISABLE() MAP_IntMasterDisable()
  95. #define OS_INT_DISABLE(ui32IntID) MAP_IntDisable(ui32IntID)
  96. #define OS_INT_ENABLE(ui32IntID) MAP_IntEnable(ui32IntID)
  97. #endif // USE_RTOS
  98. #endif // __DRIVERLIB_RTOS_BINDINGS_H__