ihndlr_gba.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * Copyright (C) 2001-2005 by egnite Software GmbH. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. * 3. Neither the name of the copyright holders nor the names of
  14. * contributors may be used to endorse or promote products derived
  15. * from this software without specific prior written permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  18. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  19. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  20. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  21. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  22. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  23. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  24. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  25. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  26. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  27. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28. * SUCH DAMAGE.
  29. *
  30. * For additional information see http://www.ethernut.de/
  31. *
  32. */
  33. /*
  34. * $Log$
  35. * Revision 1.4 2008/08/11 06:59:12 haraldkipp
  36. * BSD types replaced by stdint types (feature request #1282721).
  37. *
  38. * Revision 1.3 2005/10/24 17:59:19 haraldkipp
  39. * Use correct header file, arm, not gba.
  40. *
  41. * Revision 1.2 2005/08/02 17:46:45 haraldkipp
  42. * Major API documentation update.
  43. *
  44. * Revision 1.1 2005/07/26 18:02:26 haraldkipp
  45. * Moved from dev.
  46. *
  47. * Revision 1.1 2005/04/05 17:53:24 haraldkipp
  48. * Initial check in.
  49. *
  50. */
  51. #include <arch/arm.h>
  52. #include <dev/irqreg.h>
  53. #include <stdio.h>
  54. /*!
  55. * \addtogroup xgNutArchArmDevIrqGba
  56. */
  57. /*@{*/
  58. IRQ_HANDLER sig_VBLANK;
  59. IRQ_HANDLER sig_HBLANK;
  60. IRQ_HANDLER sig_VCOUNT;
  61. IRQ_HANDLER sig_TMR0;
  62. IRQ_HANDLER sig_TMR1;
  63. IRQ_HANDLER sig_TMR2;
  64. IRQ_HANDLER sig_TMR3;
  65. IRQ_HANDLER sig_SIO;
  66. IRQ_HANDLER sig_DMA0;
  67. IRQ_HANDLER sig_DMA1;
  68. IRQ_HANDLER sig_DMA2;
  69. IRQ_HANDLER sig_DMA3;
  70. IRQ_HANDLER sig_KEYPAD;
  71. IRQ_HANDLER sig_GAMEPAK;
  72. void IrqHandler(void)
  73. {
  74. register uint16_t irqf = inw(REG_IF);
  75. if(irqf & INT_SIO) {
  76. CallHandler(&sig_SIO);
  77. }
  78. #if 0
  79. if(irqf & INT_VBLANK) {
  80. CallHandler(&sig_VBLANK);
  81. }
  82. if(irqf & INT_HBLANK) {
  83. CallHandler(&sig_HBLANK);
  84. }
  85. if(irqf & INT_VCOUNT) {
  86. CallHandler(&sig_VCOUNT);
  87. }
  88. if(irqf & INT_TMR0) {
  89. CallHandler(&sig_TMR0);
  90. }
  91. if(irqf & INT_TMR1) {
  92. CallHandler(&sig_TMR1);
  93. }
  94. if(irqf & INT_TMR2) {
  95. CallHandler(&sig_TMR2);
  96. }
  97. #endif
  98. if(irqf & INT_TMR3) {
  99. CallHandler(&sig_TMR3);
  100. }
  101. #if 0
  102. if(irqf & INT_DMA0) {
  103. CallHandler(&sig_DMA0);
  104. }
  105. if(irqf & INT_DMA1) {
  106. CallHandler(&sig_DMA1);
  107. }
  108. if(irqf & INT_DMA2) {
  109. CallHandler(&sig_DMA2);
  110. }
  111. if(irqf & INT_DMA3) {
  112. CallHandler(&sig_DMA3);
  113. }
  114. if(irqf & INT_KEYPAD) {
  115. CallHandler(&sig_KEYPAD);
  116. }
  117. if(irqf & INT_GAMEPAK) {
  118. CallHandler(&sig_GAMEPAK);
  119. }
  120. #endif
  121. }
  122. void InitIrqHandler(void)
  123. {
  124. outdw(INT_VECTOR, (uint32_t)IrqHandler);
  125. }
  126. /*@}*/