/*********************************************************************************************************************
* TC264 Opensourec Library TC264 Դ⣩һڹٷ SDK ӿڵĵԴ
* Copyright (c) 2022 SEEKFREE ɿƼ
*
* ļ TC264 Դһ
*
* TC264 Դ 
* Ըᷢ GPLGNU General Public License GNUͨù֤
*  GPL ĵ3棨 GPL3.0ѡģκκİ汾·/޸
*
* Դķϣܷãδκεı֤
* ûԻʺض;ı֤
* ϸμ GPL
*
* ӦյԴͬʱյһ GPL ĸ
* ûУ<https://www.gnu.org/licenses/>
*
* ע
* Դʹ GPL3.0 Դ֤Э Ϊİ汾
* Ӣİ libraries/doc ļµ GPL3_permission_statement.txt ļ
* ֤ libraries ļ ļµ LICENSE ļ
* ӭλʹò ޸ʱ뱣ɿƼİȨ
*
* ļ          zf_common_interrupt
* ˾          ɶɿƼ޹˾
* 汾Ϣ          鿴 libraries/doc ļ version ļ 汾˵
*           ADS v1.9.4
* ƽ̨          TC264D
*           https://seekfree.taobao.com/
*
* ޸ļ¼
*                               ע
* 2022-09-15       pudding             first version
********************************************************************************************************************/

#include "SysSe/Bsp/Bsp.h"
#include "zf_common_interrupt.h"
#include "zf_driver_pit.h"
#include "zf_driver_pwm.h"
#include "zf_driver_exti.h"

//-------------------------------------------------------------------------------------------------------------------
//      ȫжʹ
// ˵     void
// ز     void
// ʹʾ     interrupt_global_enable(1);
// עϢ
//-------------------------------------------------------------------------------------------------------------------
void interrupt_global_enable (uint32 primask)
{
    if(primask == 0)
    {
        enableInterrupts();
    }
}

//-------------------------------------------------------------------------------------------------------------------
//      ȫж
// ˵     void
// ز     void
// ʹʾ     uint32 interrupt_num = interrupt_global_disable();
// עϢ
//-------------------------------------------------------------------------------------------------------------------
uint32 interrupt_global_disable (void)
{
    return (uint32)(!disableInterrupts());
}


//-------------------------------------------------------------------------------------------------------------------
//      ж
// ˵     void
// ز     void
// ʹʾ     assert_interrupt_config();
// עϢ
//-------------------------------------------------------------------------------------------------------------------
void assert_interrupt_config (void)
{
    interrupt_global_disable();                 // ȫжʧ
    pit_all_close();                            // رpitж
    pwm_all_channel_close();                    // رPWMͨ
    exti_all_close();                           // رⲿж
    interrupt_global_enable(0);                 // ȫжʹ
}
