F2837xD_PieCtrl.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. //###########################################################################
  2. //
  3. // FILE: F2837xD_PieCtrl.c
  4. //
  5. // TITLE: F2837xD Device PIE Control Register Initialization Functions.
  6. //
  7. //###########################################################################
  8. // $TI Release: F2837xD Support Library v3.05.00.00 $
  9. // $Release Date: Tue Jun 26 03:15:23 CDT 2018 $
  10. // $Copyright:
  11. // Copyright (C) 2013-2018 Texas Instruments Incorporated - http://www.ti.com/
  12. //
  13. // Redistribution and use in source and binary forms, with or without
  14. // modification, are permitted provided that the following conditions
  15. // are met:
  16. //
  17. // Redistributions of source code must retain the above copyright
  18. // notice, this list of conditions and the following disclaimer.
  19. //
  20. // Redistributions in binary form must reproduce the above copyright
  21. // notice, this list of conditions and the following disclaimer in the
  22. // documentation and/or other materials provided with the
  23. // distribution.
  24. //
  25. // Neither the name of Texas Instruments Incorporated nor the names of
  26. // its contributors may be used to endorse or promote products derived
  27. // from this software without specific prior written permission.
  28. //
  29. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  30. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  31. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  32. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  33. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  34. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  35. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  36. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  37. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  38. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  39. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40. // $
  41. //###########################################################################
  42. //
  43. // Included Files
  44. //
  45. #include "F2837xD_device.h" // F2837xD Headerfile Include File
  46. #include "F2837xD_Examples.h" // F2837xD Examples Include File
  47. //
  48. // InitPieCtrl - This function initializes the PIE control registers to a
  49. // known state.
  50. //
  51. void InitPieCtrl(void)
  52. {
  53. //
  54. // Disable Interrupts at the CPU level:
  55. //
  56. DINT;
  57. //
  58. // Disable the PIE
  59. //
  60. PieCtrlRegs.PIECTRL.bit.ENPIE = 0;
  61. //
  62. // Clear all PIEIER registers:
  63. //
  64. PieCtrlRegs.PIEIER1.all = 0;
  65. PieCtrlRegs.PIEIER2.all = 0;
  66. PieCtrlRegs.PIEIER3.all = 0;
  67. PieCtrlRegs.PIEIER4.all = 0;
  68. PieCtrlRegs.PIEIER5.all = 0;
  69. PieCtrlRegs.PIEIER6.all = 0;
  70. PieCtrlRegs.PIEIER7.all = 0;
  71. PieCtrlRegs.PIEIER8.all = 0;
  72. PieCtrlRegs.PIEIER9.all = 0;
  73. PieCtrlRegs.PIEIER10.all = 0;
  74. PieCtrlRegs.PIEIER11.all = 0;
  75. PieCtrlRegs.PIEIER12.all = 0;
  76. //
  77. // Clear all PIEIFR registers:
  78. //
  79. PieCtrlRegs.PIEIFR1.all = 0;
  80. PieCtrlRegs.PIEIFR2.all = 0;
  81. PieCtrlRegs.PIEIFR3.all = 0;
  82. PieCtrlRegs.PIEIFR4.all = 0;
  83. PieCtrlRegs.PIEIFR5.all = 0;
  84. PieCtrlRegs.PIEIFR6.all = 0;
  85. PieCtrlRegs.PIEIFR7.all = 0;
  86. PieCtrlRegs.PIEIFR8.all = 0;
  87. PieCtrlRegs.PIEIFR9.all = 0;
  88. PieCtrlRegs.PIEIFR10.all = 0;
  89. PieCtrlRegs.PIEIFR11.all = 0;
  90. PieCtrlRegs.PIEIFR12.all = 0;
  91. }
  92. //
  93. // EnableInterrupts - This function enables the PIE module and CPU __interrupts
  94. //
  95. void EnableInterrupts()
  96. {
  97. //
  98. // Enable the PIE
  99. //
  100. PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
  101. //
  102. // Enables PIE to drive a pulse into the CPU
  103. //
  104. PieCtrlRegs.PIEACK.all = 0xFFFF;
  105. //
  106. // Enable Interrupts at the CPU level
  107. //
  108. EINT;
  109. }
  110. //
  111. // End of file
  112. //