rtos_bindings.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. //*****************************************************************************
  2. //
  3. // rtos_bindings.h - Macros ulIntIDended to aid porting of StellarisWare modules
  4. // for use with an RTOS.
  5. //
  6. // Copyright (c) 2012 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. // This is part of revision 9453 of the Stellaris Peripheral Driver Library.
  38. //
  39. //*****************************************************************************
  40. #ifndef RTOS_BINDINGS_H_
  41. #define RTOS_BINDINGS_H_
  42. #ifdef USE_RTOS
  43. //*****************************************************************************
  44. //
  45. // If an RTOS is in use, implement a header file called "stellaris_rtos.h"
  46. // which contains RTOS-specific versions of each of the macros defined below
  47. // and make sure it appears on the include path set when you build your
  48. // project.
  49. //
  50. // Note that there is no default implementation of this header file included
  51. // in StellarisWare - it is your responsibility to create it specifically for
  52. // your RTOS.
  53. //
  54. //*****************************************************************************
  55. #include "stellaris_rtos.h"
  56. #else
  57. //*****************************************************************************
  58. //
  59. // When no RTOS is in use, the follow macros compile to either nothing or a
  60. // minimal implementation that works in a bare-metal environment.
  61. //
  62. // Each of these macros must be redefined in stellaris_rtos.h if you are using
  63. // StellarisWare under an RTOS.
  64. //
  65. //*****************************************************************************
  66. //*****************************************************************************
  67. //
  68. // A simple macro used to yield within polling loops. In the default, non-RTOS
  69. // implementation, this compiles to nothing.
  70. //
  71. //*****************************************************************************
  72. #define OS_YIELD()
  73. //*****************************************************************************
  74. //
  75. // A simple macro around the SysCtlDelay function. The parameter is the number
  76. // of 3 cycle loops to wait before returning (as for SysCtlDelay). In an RTOS
  77. // implementation, this could be replaced with an OS delay call with
  78. // appropriate parameter scaling.
  79. //
  80. //*****************************************************************************
  81. #define OS_DELAY(ul3Cycles) MAP_SysCtlDelay(ul3Cycles)
  82. //*****************************************************************************
  83. //
  84. // Wrappers around low level interrupt control functions. For information
  85. // on each of these functions, please see the appropriate API documentation
  86. // for the DriverLib Interrupt driver.
  87. //
  88. // The macros defined here represent interrupt-control functions that may be
  89. // called from within StellarisWare code. It is expected that application
  90. // code will use RTOS-specific functions to control interrupt priority, to
  91. // pend interrupts and to perform runtime vector manipulation. As a result,
  92. // no macros are defined to wrap any of these functions from interrupt.c.
  93. //
  94. //*****************************************************************************
  95. #define OS_INT_MASTER_ENABLE() MAP_IntMasterEnable()
  96. #define OS_INT_MASTER_DISABLE() MAP_IntMasterDisable()
  97. #define OS_INT_DISABLE(ulIntID) MAP_IntDisable(ulIntID)
  98. #define OS_INT_ENABLE(ulIntID) MAP_IntEnable(ulIntID)
  99. #endif // USE_RTOS
  100. #endif // RTOS_BINDINGS_H_