| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- /*!
- \file gd32f10x_it.h
- \brief the header file of the ISR
-
- \version 2015-11-16, V1.0.0, demo for GD32F10x
- \version 2017-06-30, V2.0.0, demo for GD32F10x
- \version 2021-04-30, V2.1.0, demo for GD32F10x
- */
- /*
- Copyright (c) 2021, GigaDevice Semiconductor Inc.
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- 3. Neither the name of the copyright holder nor the names of its contributors
- may be used to endorse or promote products derived from this software without
- specific prior written permission.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- OF SUCH DAMAGE.
- */
- #ifndef GD32F10X_IT_H
- #define GD32F10X_IT_H
- #include "gd32f10x.h"
- /* function declarations */
- /* this function handles NMI exception */
- void NMI_Handler(void);
- /* this function handles HardFault exception */
- void HardFault_Handler(void);
- /* this function handles MemManage exception */
- void MemManage_Handler(void);
- /* this function handles BusFault exception */
- void BusFault_Handler(void);
- /* this function handles UsageFault exception */
- void UsageFault_Handler(void);
- /* this function handles SVC exception */
- void SVC_Handler(void);
- /* this function handles DebugMon exception */
- void DebugMon_Handler(void);
- /* this function handles PendSV exception */
- void PendSV_Handler(void);
- /* this function handles SysTick exception */
- void SysTick_Handler(void);
- extern uint32_t Get_SysTick(void);
- //IO口操作宏定义
- #define BITBAND(addr, bitnum) ((addr & 0xF0000000)+0x2000000+((addr &0xFFFFF)<<5)+(bitnum<<2))
- #define MEM_ADDR(addr) *((volatile unsigned long *)(addr))
- #define BIT_ADDR(addr, bitnum) MEM_ADDR(BITBAND(addr, bitnum))
- //IO口地址映射
- #define GPIOA_ODR_Addr (GPIOA+12) //0x4001080C
- #define GPIOB_ODR_Addr (GPIOB+12) //0x40010C0C
- #define GPIOC_ODR_Addr (GPIOC+12) //0x4001100C
- #define GPIOD_ODR_Addr (GPIOD+12) //0x4001140C
- #define GPIOE_ODR_Addr (GPIOE+12) //0x4001180C
- #define GPIOF_ODR_Addr (GPIOF+12) //0x40011A0C
- #define GPIOG_ODR_Addr (GPIOG+12) //0x40011E0C
- #define GPIOA_IDR_Addr (GPIOA+8) //0x40010808
- #define GPIOB_IDR_Addr (GPIOB+8) //0x40010C08
- #define GPIOC_IDR_Addr (GPIOC+8) //0x40011008
- #define GPIOD_IDR_Addr (GPIOD+8) //0x40011408
- #define GPIOE_IDR_Addr (GPIOE+8) //0x40011808
- #define GPIOF_IDR_Addr (GPIOF+8) //0x40011A08
- #define GPIOG_IDR_Addr (GPIOG+8) //0x40011E08
- //IO口操作,只对单一的IO口
- //确保N的值小于16!
- #define PAout(n) BIT_ADDR(GPIOA_ODR_Addr,n) //ê?3?
- #define PAin(n) BIT_ADDR(GPIOA_IDR_Addr,n) //ê?è?
- #define PBout(n) BIT_ADDR(GPIOB_ODR_Addr,n) //ê?3?
- #define PBin(n) BIT_ADDR(GPIOB_IDR_Addr,n) //ê?è?
- #define PCout(n) BIT_ADDR(GPIOC_ODR_Addr,n) //ê?3?
- #define PCin(n) BIT_ADDR(GPIOC_IDR_Addr,n) //ê?è?
- #define PDout(n) BIT_ADDR(GPIOD_ODR_Addr,n) //ê?3?
- #define PDin(n) BIT_ADDR(GPIOD_IDR_Addr,n) //ê?è?
- #define PEout(n) BIT_ADDR(GPIOE_ODR_Addr,n) //ê?3?
- #define PEin(n) BIT_ADDR(GPIOE_IDR_Addr,n) //ê?è?
- #define PFout(n) BIT_ADDR(GPIOF_ODR_Addr,n) //ê?3?
- #define PFin(n) BIT_ADDR(GPIOF_IDR_Addr,n) //ê?è?
- #define PGout(n) BIT_ADDR(GPIOG_ODR_Addr,n) //ê?3?
- #define PGin(n) BIT_ADDR(GPIOG_IDR_Addr,n) //ê?è?
- #endif /* GD32F10X_IT_H */
|