| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- /*!
- \file gd32f3x0_it.c
- \brief interrupt service routines
- \version 2017-06-06, V1.0.0, firmware for GD32F3x0
- \version 2019-06-01, V2.0.0, firmware for GD32F3x0
- \version 2020-09-30, V2.1.0, firmware for GD32F3x0
- \version 2022-01-06, V2.2.0, firmware for GD32F3x0
- \version 2022-04-15, V2.2.1, firmware for GD32F3x0
- */
- /*
- Copyright (c) 2022, 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.
- */
- #include "gd32f3x0_it.h"
- extern uint8_t spi0_send_array[ ];
- extern uint8_t spi1_receive_array[ ];
- extern volatile uint32_t send_n, receive_n ;
- void SPI0_IRQHandler(void)
- {
- if(RESET != spi_i2s_interrupt_flag_get(SPI0, SPI_I2S_INT_FLAG_TBE)) {
- /* send data */
- spi_i2s_data_transmit(SPI0, spi0_send_array[send_n++]);
- if(ARRAYSIZE == send_n) {
- #if SPI_CRC_ENABLE
- /* send the CRC value */
- spi_crc_next(SPI0);
- #endif /* enable CRC function */
- spi_i2s_interrupt_disable(SPI0, SPI_I2S_INT_TBE);
- }
- }
- }
- /*!
- \brief this function handles SPI1 Handler exception
- \param[in] none
- \param[out] none
- \retval none
- */
- void SPI1_IRQHandler(void)
- {
- /* receive data */
- if(RESET != spi_i2s_interrupt_flag_get(SPI1, SPI_I2S_INT_FLAG_RBNE)) {
- spi1_receive_array[receive_n++] = spi_i2s_data_receive(SPI1);
- #if SPI_CRC_ENABLE
- if((ARRAYSIZE - 1) == receive_n) {
- /* receive the CRC value */
- spi_crc_next(SPI1);
- }
- #endif /* enable CRC function */
- }
- }
|