欢迎访问电子工程网!   登录 | 免费注册 ]   

chenningpo的个人空间 http://www.eechina.com/space-uid-73326.html [收藏] [复制] [分享] [RSS]

博客

STM8中断向量表

已有 2484 次阅读2013-4-26 20:43 | 关键词: STM8中断向量表

分类: 技术资料转载备份2012-03-29 19:28 971人阅读 评论(5) 收藏 举报
  1. // Copyright (c) 2009, Wolver Wang, Innov Inc. R&D Center  
  2. // wolver@21com.com  
  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. // 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. All advertising materials mentioning features or use of this software  
  14. //    must display the following acknowledgement:  
  15. //      This product includes software developed by Wolver Wang.  
  16. // 4. The name of the author may not be used to endorse or promote  
  17. //    products derived from this software without specific prior  
  18. //    written permission.  
  19. //  
  20. // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS  
  21. // OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED  
  22. // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE  
  23. // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY  
  24. // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL  
  25. // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE  
  26. // GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS  
  27. // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,  
  28. // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING  
  29. // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  
  30. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
  31. ///  
  32.   
  33.   
  34.   
  35.   
  36. // Go to Project/settings/linker => select catergory 'input".   
  37. // Here by right click on Segment/section name, you can create   
  38. // a new segment 'UserApp' and then create a section '.usr_tab'   
  39. // under this segment. Then allocate the address to this segment/section.   
  40.   
  41.   
  42. // Includes ------------------------------------------------------------------  
  43.   
  44. //----------------------------------------------------------------------------  
  45.   
  46.   
  47. // Exported macro ------------------------------------------------------------  
  48.   
  49. //----------------------------------------------------------------------------  
  50.   
  51.   
  52.   
  53. // Exported types ------------------------------------------------------------  
  54.   
  55. typedef void @near (*interrupt_handler_t)(void);  
  56.   
  57. struct interrupt_vector {  
  58.         unsigned int interrupt_instruction;  
  59.         interrupt_handler_t interrupt_handler;  
  60. };  
  61.   
  62. // Exported functions -------------------------------------------------------   
  63.   
  64. extern @near void _stext();                                                                                                                                                                     // startup routine  
  65.   
  66. extern @near @interrupt void TRAP_IRQHandler(void);                                                                // TRAP  
  67. extern @near @interrupt void TLI_IRQHandler(void);                                                                        // TLI  
  68. extern @near @interrupt void AWU_IRQHandler(void);                                                                        // AWU  
  69. extern @near @interrupt void CLK_IRQHandler(void);                                                                        // CLOCK  
  70. extern @near @interrupt void EXTI_PORTA_IRQHandler(void);                                        // EXTI PORTA  
  71. extern @near @interrupt void EXTI_PORTB_IRQHandler(void);                                        // EXTI PORTB  
  72. extern @near @interrupt void EXTI_PORTC_IRQHandler(void);                                        // EXTI PORTC  
  73. extern @near @interrupt void EXTI_PORTD_IRQHandler(void);                                        // EXTI PORTD  
  74. extern @near @interrupt void EXTI_PORTE_IRQHandler(void);                                        // EXTI PORTE  
  75. extern @near @interrupt void CAN_RX_IRQHandler(void);                                                        // CAN RX  
  76. extern @near @interrupt void CAN_TX_IRQHandler(void);                                                        // CAN TX/SCE  
  77. extern @near @interrupt void SPI_IRQHandler(void);                                                                 // SPI  
  78. extern @near @interrupt void TIM1_UPD_OVF_TRG_BRK_IRQHandler(void);// TIM1 UPD/OVF/TRG/BRK  
  79. extern @near @interrupt void TIM1_CAP_COM_IRQHandler(void);                                 // TIM1 CAP/COM  
  80. extern @near @interrupt void TIM2_UPD_OVF_BRK_IRQHandler(void);                // TIM2 UPD/OVF/BRK  
  81. extern @near @interrupt void TIM2_CAP_COM_IRQHandler(void);                                 // TIM2 CAP/COM  
  82. extern @near @interrupt void TIM3_UPD_OVF_BRK_IRQHandler(void);                 // TIM3 UPD/OVF/BRK  
  83. extern @near @interrupt void TIM3_CAP_COM_IRQHandler(void);                                 // TIM3 CAP/COM  
  84. extern @near @interrupt void USART_TX_IRQHandler(void);                                                 // USART TX  
  85. extern @near @interrupt void USART_RX_IRQHandler(void);                                                 // USART RX  
  86. extern @near @interrupt void I2C_IRQHandler(void);                                                                 // I2C  
  87. extern @near @interrupt void LINUART_TX_IRQHandler(void);                                         // LINUART TX  
  88. extern @near @interrupt void LINUART_RX_IRQHandler(void);                                         // LINUART RX  
  89. extern @near @interrupt void ADC_IRQHandler(void);                                                                 // ADC  
  90. extern @near @interrupt void TIM4_UPD_OVF_IRQHandler(void);                                 // TIM4 UPD/OVF  
  91. extern @near @interrupt void FLASH_IRQHandler(void);                                                         // FLASH CHECK  
  92. extern @near @interrupt void NonHandledInterrupt (void);                                                // Unexpected events  
  93.   
  94.   
  95. // Exported constants --------------------------------------------------------  
  96.   
  97. // Redirected constant section to usr_tab: 0x8100-0x8180  
  98. #pragma section const {usr_tab}  
  99. struct interrupt_vector const UserISR_IRQ[32]  = {  
  100.         {0x8200, (interrupt_handler_t)_stext},                                                                                                         // reset  
  101.         {0x8200, (interrupt_handler_t)TRAP_IRQHandler},                                                                 // trap  - Software interrupt  
  102.         {0x8200, (interrupt_handler_t)TLI_IRQHandler},                                                                         // irq0  - External Top Level interrupt (TLI)    
  103.         {0x8200, (interrupt_handler_t)AWU_IRQHandler},                                                                         // irq1  - Auto Wake Up from Halt interrupt     
  104.         {0x8200, (interrupt_handler_t)CLK_IRQHandler},                                                                         // irq2  - Clock Controller interrupt    
  105.         {0x8200, (interrupt_handler_t)EXTI_PORTA_IRQHandler},                                         // irq3  - External interrupt 0 (GPIOA)    
  106.         {0x8200, (interrupt_handler_t)EXTI_PORTB_IRQHandler},                                         // irq4  - External interrupt 1 (GPIOB)    
  107.         {0x8200, (interrupt_handler_t)EXTI_PORTC_IRQHandler},                                         // irq5  - External interrupt 2 (GPIOC)    
  108.         {0x8200, (interrupt_handler_t)EXTI_PORTD_IRQHandler},                                         // irq6  - External interrupt 3 (GPIOD)    
  109.         {0x8200, (interrupt_handler_t)EXTI_PORTE_IRQHandler},                                         // irq7  - External interrupt 4 (GPIOE)    
  110.         {0x8200, (interrupt_handler_t)CAN_RX_IRQHandler},                                                         // irq8  - CAN Rx interrupt    
  111.         {0x8200, (interrupt_handler_t)CAN_TX_IRQHandler},                                                         // irq9  - CAN Tx/ER/SC interrupt    
  112.         {0x8200, (interrupt_handler_t)SPI_IRQHandler},                                                                         // irq10 - SPI End of transfer interrupt  
  113.         {0x8200, (interrupt_handler_t)TIM1_UPD_OVF_TRG_BRK_IRQHandler}, // irq11 - TIM1 Update/Overflow/Trigger/Break interrupt  
  114.         {0x8200, (interrupt_handler_t)TIM1_CAP_COM_IRQHandler},                                 // irq12 - TIM1 Capture/Compare interrupt  
  115.         {0x8200, (interrupt_handler_t)TIM2_UPD_OVF_BRK_IRQHandler},                 // irq13 - TIM2 Update/Overflow/Break interrupt  
  116.         {0x8200, (interrupt_handler_t)TIM2_CAP_COM_IRQHandler},                                 // irq14 - TIM2 Capture/Compare interrupt  
  117.         {0x8200, (interrupt_handler_t)TIM3_UPD_OVF_BRK_IRQHandler},                 // irq15 - TIM3 Update/Overflow/Break interrupt  
  118.         {0x8200, (interrupt_handler_t)TIM3_CAP_COM_IRQHandler},                                 // irq16 - TIM3 Capture/Compare interrupt  
  119.         {0x8200, (interrupt_handler_t)USART_TX_IRQHandler},                                                 // irq17 - USART Tx complete interrupt  
  120.         {0x8200, (interrupt_handler_t)USART_RX_IRQHandler},                                                 // irq18 - USART Rx interrupt  
  121.         {0x8200, (interrupt_handler_t)I2C_IRQHandler},                                                                         // irq19 - I2C interrupt  
  122.         {0x8200, (interrupt_handler_t)LINUART_TX_IRQHandler},                                         // irq20 - LINUART Tx interrupt  
  123.         {0x8200, (interrupt_handler_t)LINUART_RX_IRQHandler},                                         // irq21 - LINUART Rx interrupt  
  124.         {0x8200, (interrupt_handler_t)ADC_IRQHandler},                                                                         // irq22 - ADC end of conversion interrupt  
  125.         {0x8200, (interrupt_handler_t)TIM4_UPD_OVF_IRQHandler},                                 // irq23 - TIM4 Update/Overflow interrupt  
  126.         {0x8200, (interrupt_handler_t)FLASH_IRQHandler},                                                                 // irq24 - FLASH interrupt  
  127.         {0x8200, (interrupt_handler_t)NonHandledInterrupt},                                                 // irq25 - Reserved  
  128.         {0x8200, (interrupt_handler_t)NonHandledInterrupt},                                                 // irq26 - Reserved  
  129.         {0x8200, (interrupt_handler_t)NonHandledInterrupt},                                                 // irq27 - Reserved  
  130.         {0x8200, (interrupt_handler_t)NonHandledInterrupt},                                                 // irq28 - Reserved  
  131.         {0x8200, (interrupt_handler_t)NonHandledInterrupt},                                                 // irq29 - Reserved  
  132. };  
  133.   
  134. // Restore default section  
  135. #pragma section const {}  
  136. // System interrupt table: 0x8000-0x8080  
  137. struct interrupt_vector const _vectab[] = {  
  138.         {0x8200, (interrupt_handler_t)_stext},                                                 // reset  
  139.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 1)},         // trap  - Software interrupt  
  140.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 2)},         // irq0  - External Top Level interrupt (TLI)    
  141.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 3)},        // irq1  - Auto Wake Up from Halt interrupt     
  142.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 4)},        // irq2  - Clock Controller interrupt    
  143.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 5)},        // irq3  - External interrupt 0 (GPIOA)    
  144.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 6)},        // irq4  - External interrupt 1 (GPIOB)    
  145.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 7)},         // irq5  - External interrupt 2 (GPIOC)    
  146.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 8)},         // irq6  - External interrupt 3 (GPIOD)    
  147.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 9)},         // irq7  - External interrupt 4 (GPIOE)    
  148.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 10)}, // irq8  - CAN Rx interrupt    
  149.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 11)}, // irq9  - CAN Tx/ER/SC interrupt    
  150.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 12)}, // irq10 - SPI End of transfer interrupt  
  151.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 13)}, // irq11 - TIM1 Update/Overflow/Trigger/Break interrupt  
  152.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 14)}, // irq12 - TIM1 Capture/Compare interrupt  
  153.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 15)}, // irq13 - TIM2 Update/Overflow/Break interrupt  
  154.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 16)}, // irq14 - TIM2 Capture/Compare interrupt  
  155.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 17)}, // irq15 - TIM3 Update/Overflow/Break interrupt  
  156.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 18)}, // irq16 - TIM3 Capture/Compare interrupt  
  157.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 19)}, // irq17 - USART Tx complete interrupt  
  158.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 20)}, // irq18 - USART Rx interrupt  
  159.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 21)}, // irq19 - I2C interrupt  
  160.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 22)}, // irq20 - LINUART Tx interrupt  
  161.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 23)}, // irq21 - LINUART Rx interrupt  
  162.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 24)}, // irq22 - ADC end of conversion interrupt  
  163.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 25)}, // irq23 - TIM4 Update/Overflow interrupt  
  164.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 26)}, // irq24 - FLASH interrupt  
  165.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 27)}, // irq25 - Reserved   
  166.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 28)}, // irq26 - Reserved   
  167.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 29)}, // irq27 - Reserved   
  168.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 30)}, // irq28 - Reserved   
  169.         {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 31)}, // irq29 - Reserved   
  170. };  


 


路过

鸡蛋

鲜花

握手

雷人

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 立即注册

回顶部