315 lines
10 KiB
C
315 lines
10 KiB
C
|
/***************************************************************
|
|||
|
*Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd.
|
|||
|
*<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> lib_scu.h
|
|||
|
*<EFBFBD><EFBFBD> <EFBFBD>ߣ<EFBFBD> Liut
|
|||
|
*<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> V1.00
|
|||
|
*<EFBFBD><EFBFBD> <EFBFBD>ڣ<EFBFBD> 2017/07/14
|
|||
|
*<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ں<EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD>⺯<EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
|
|||
|
*<EFBFBD><EFBFBD> ע<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ES8P508xоƬ
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧϰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾʹ<EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><EFBFBD>ջ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD>κη<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ρ<EFBFBD>
|
|||
|
***************************************************************/
|
|||
|
#ifndef __LIBSCU_H
|
|||
|
#define __LIBSCU_H
|
|||
|
|
|||
|
#include "system_ES8P508x.h"
|
|||
|
#include "ES8P508x.h"
|
|||
|
#include "type.h"
|
|||
|
|
|||
|
/* NMI<4D><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ѡ<EFBFBD><D1A1> */
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
SCU_PINT0_IRQn = 0,
|
|||
|
SCU_PINT1_IRQn = 1,
|
|||
|
SCU_PINT2_IRQn = 2,
|
|||
|
SCU_PINT3_IRQn = 3,
|
|||
|
SCU_PINT4_IRQn = 4,
|
|||
|
SCU_PINT5_IRQn = 5,
|
|||
|
SCU_PINT6_IRQn = 6,
|
|||
|
SCU_PINT7_IRQn = 7,
|
|||
|
SCU_T16N0_IRQn = 8,
|
|||
|
SCU_T16N1_IRQn = 9,
|
|||
|
SCU_T16N2_IRQn = 10,
|
|||
|
SCU_T16N3_IRQn = 11,
|
|||
|
SCU_T32N0_IRQn = 12,
|
|||
|
SCU_IWDT_IRQn = 14,
|
|||
|
SCU_WWDT_IRQn = 15,
|
|||
|
SCU_CCM_IRQn = 16,
|
|||
|
SCU_PLK_IRQn = 17,
|
|||
|
SCU_LVD_IRQn = 18,
|
|||
|
SCU_KINT_IRQn = 19,
|
|||
|
SCU_RTC_IRQn = 20,
|
|||
|
SCU_ADC_IRQn = 21,
|
|||
|
SCU_AES_IRQn = 23,
|
|||
|
SCU_UART0_IRQn = 24,
|
|||
|
SCU_UART1_IRQn = 25,
|
|||
|
SCU_UART2_IRQn = 26,
|
|||
|
SCU_UART3_IRQn = 27,
|
|||
|
SCU_UART4_IRQn = 28,
|
|||
|
SCU_UART5_IRQn = 29,
|
|||
|
SCU_SPI0_IRQn = 30,
|
|||
|
SCU_I2C0_IRQn = 31,
|
|||
|
}SCU_TYPE_NMICS;
|
|||
|
|
|||
|
/* PWRC<52><43>λ״̬<D7B4>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD>־λ */
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
SCU_PWRC_PORF= 0X00001, //POR<4F><52>λ<EFBFBD><CEBB>־λ
|
|||
|
SCU_PWRC_RRCF = 0X00002, //PORC<52><43>λ<EFBFBD><CEBB>־λ
|
|||
|
SCU_PWRC_PORRSTF = 0x00004, //POR<4F>ܸ<EFBFBD>λ<EFBFBD><CEBB>־
|
|||
|
SCU_PWRC_BORF = 0x00008, //BOR<4F>ܸ<EFBFBD>λ<EFBFBD><CEBB>־
|
|||
|
SCU_PWRC_WWDTRSTF = 0x00010, //WWDT<44><54>λ<EFBFBD><CEBB>־
|
|||
|
SCU_PWRC_IWDTRSTF = 0x00020, //IWDT<44><54>λ<EFBFBD><CEBB>־
|
|||
|
SCU_PWRC_MRSTF = 0x00040, //MRSTn<54><6E>λ<EFBFBD><CEBB>־
|
|||
|
SCU_PWRC_SOFTRSTF = 0x00080, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>־
|
|||
|
}SCU_TYPE_PWRC;
|
|||
|
|
|||
|
/* LVD<56>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD>־λ */
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
SCU_LVDFlag_IF = 0x0100, //LVD<56>жϱ<D0B6>־
|
|||
|
SCU_LVDFlag_Out = 0x8000, //<2F><><EFBFBD><EFBFBD>״̬λ
|
|||
|
}SCU_TYPE_LVD0CON;
|
|||
|
|
|||
|
/* ʱ<><CAB1>ѡ<EFBFBD><D1A1> */
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
SCU_SysClk_HRC = 0x0 , //<2F>ڲ<EFBFBD>20MHZ RCʱ<43><CAB1>
|
|||
|
SCU_SysClk_XTAL = 0x1 , //<2F>ⲿ<EFBFBD><E2B2BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
SCU_SysClk_PLL = 0x2 , //PLL
|
|||
|
}SCU_TYPE_SYSCLK;
|
|||
|
|
|||
|
/*clk_selʱ<6C><CAB1>Դѡ<D4B4><D1A1>*/
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
CLK_SEL_HRC = 0x0, //HRC 20M
|
|||
|
CLK_SEL_LRC = 0x1, //LRC 32KHz
|
|||
|
CLK_SEL_XTAL = 0x2, //<2F><><EFBFBD>Ӿ<EFBFBD><D3BE><EFBFBD>XTAL
|
|||
|
}SCU_TYPE_CLK_SEL;
|
|||
|
|
|||
|
/* PLLʱ<4C><CAB1>Դѡ<D4B4><D1A1> */
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
SCU_PLL_HRC = 0x0 , //PLLʱ<4C><CAB1>ԴHRC
|
|||
|
SCU_PLL_LRC = 0x2 , //PLLʱ<4C><CAB1>ԴLRC
|
|||
|
SCU_PLL_XTAL_32K = 0x3 , //PLLʱ<4C><CAB1>ԴXTAL
|
|||
|
SCU_PLL_XTAL_4M = 0x4 , //PLLʱ<4C><CAB1>ԴXTAL
|
|||
|
SCU_PLL_XTAL_8M = 0x5, //PLLʱ<4C><CAB1>ԴXTAL
|
|||
|
SCU_PLL_XTAL_16M = 0x6, //PLLʱ<4C><CAB1>ԴXTAL
|
|||
|
SCU_PLL_XTAL_20M = 0x7, //PLLʱ<4C><CAB1>ԴXTAL
|
|||
|
} SCU_PLL_Origin;
|
|||
|
|
|||
|
/* PLLʱ<4C><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
SCU_PLL_32M = 0x0 , //PLLʱ<4C><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ32MHz
|
|||
|
SCU_PLL_48M = 0x1 , //PLLʱ<4C><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ48Mhz
|
|||
|
} SCU_PLL_Out;
|
|||
|
|
|||
|
/************SCUģ<55><C4A3><EFBFBD>궨<EFBFBD><EAB6A8>***********/
|
|||
|
/* SCUд<55><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
#define SCU_RegUnLock() (SCU->PROT.Word = 0x55AA6996)
|
|||
|
#define SCU_RegLock() (SCU->PROT.Word = 0x00000000)
|
|||
|
|
|||
|
/* NMIʹ<49>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_NMI_Enable() (SCU->NMICON.NMIEN = 0x1)
|
|||
|
#define SCU_NMI_Disable() (SCU->NMICON.NMIEN = 0x0)
|
|||
|
|
|||
|
/*-------LVDģ<44><C4A3>-------*/
|
|||
|
|
|||
|
/* LVDʹ<44>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_LVD_Enable() (SCU->LVDCON.EN = 0x1)
|
|||
|
#define SCU_LVD_Disable() (SCU->LVDCON.EN = 0x0)
|
|||
|
|
|||
|
/* LVD<56>˲<EFBFBD>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_LVDFLT_Enable() (SCU->LVDCON.FLTEN = 0x1)
|
|||
|
#define SCU_LVDFLT_Disable() (SCU->LVDCON.FLTEN = 0x0)
|
|||
|
|
|||
|
/* LVD<56><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹѡ<D1B9><D1A1> */
|
|||
|
#define SCU_LVDVS_2V0() (SCU->LVDCON.VS = 0x0)
|
|||
|
#define SCU_LVDVS_2V1() (SCU->LVDCON.VS = 0x1)
|
|||
|
#define SCU_LVDVS_2V2() (SCU->LVDCON.VS = 0x2)
|
|||
|
#define SCU_LVDVS_2V4() (SCU->LVDCON.VS = 0x3)
|
|||
|
#define SCU_LVDVS_2V6() (SCU->LVDCON.VS = 0x4)
|
|||
|
#define SCU_LVDVS_2V8() (SCU->LVDCON.VS = 0x5)
|
|||
|
#define SCU_LVDVS_3V0() (SCU->LVDCON.VS = 0x6)
|
|||
|
#define SCU_LVDVS_3V6() (SCU->LVDCON.VS = 0x7)
|
|||
|
#define SCU_LVDVS_4V() (SCU->LVDCON.VS = 0x8)
|
|||
|
#define SCU_LVDVS_4V6() (SCU->LVDCON.VS = 0x9)
|
|||
|
#define SCU_LVDVS_2V3() (SCU->LVDCON.VS = 0xA)
|
|||
|
#define SCU_LVDVS_LVDIN() (SCU->LVDCON.VS = 0xE)
|
|||
|
|
|||
|
/* LVD<56>ж<EFBFBD>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_LVDIT_Enable() (SCU->LVDCON.IE = 0x1)
|
|||
|
#define SCU_LVDIT_Disable() (SCU->LVDCON.IE = 0x0)
|
|||
|
|
|||
|
/* LVD<56>жϱ<D0B6>־λ<D6BE><CEBB><EFBFBD><EFBFBD> */
|
|||
|
#define SCU_LVDClearIFBit() (SCU->LVDCON.IF = 1)
|
|||
|
|
|||
|
/* LVD<56>жϲ<D0B6><CFB2><EFBFBD>ģʽѡ<CABD><D1A1> */
|
|||
|
#define SCU_LVDIFS_Rise() (SCU->LVDCON.IFS = 0x0) //LVDO<44><4F><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><D8B2><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
#define SCU_LVDIFS_Fall() (SCU->LVDCON.IFS = 0x1) //LVDO<44>½<EFBFBD><C2BD>ز<EFBFBD><D8B2><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
#define SCU_LVDIFS_High() (SCU->LVDCON.IFS = 0x2) //LVDO<44>ߵ<EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
#define SCU_LVDIFS_Low() (SCU->LVDCON.IFS = 0x3) //LVDO<44>͵<EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
#define SCU_LVDIFS_Change() (SCU->LVDCON.IFS = 0x4) //LVDO<44><4F>ƽ<EFBFBD>仯<EFBFBD><E4BBAF><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
|
|||
|
/* FLASH<53><48><EFBFBD>ʵȴ<CAB5>ʱ<EFBFBD><CAB1>ѡ<EFBFBD><D1A1> */
|
|||
|
#define SCU_FlashWait_1Tclk() (SCU->FLASHWAIT.ACCT = 0x0)
|
|||
|
#define SCU_FlashWait_2Tclk() (SCU->FLASHWAIT.ACCT = 0x1)
|
|||
|
#define SCU_FlashWait_3Tclk() (SCU->FLASHWAIT.ACCT = 0x2)
|
|||
|
#define SCU_FlashWait_4Tclk() (SCU->FLASHWAIT.ACCT = 0x3)
|
|||
|
#define SCU_FlashWait_5Tclk() (SCU->FLASHWAIT.ACCT = 0x4)
|
|||
|
#define SCU_FlashWait_6Tclk() (SCU->FLASHWAIT.ACCT = 0x5)
|
|||
|
#define SCU_FlashWait_7Tclk() (SCU->FLASHWAIT.ACCT = 0x6)
|
|||
|
#define SCU_FlashWait_8Tclk() (SCU->FLASHWAIT.ACCT = 0x7)
|
|||
|
#define SCU_FlashWait_9Tclk() (SCU->FLASHWAIT.ACCT = 0x8)
|
|||
|
#define SCU_FlashWait_10Tclk() (SCU->FLASHWAIT.ACCT = 0x9)
|
|||
|
#define SCU_FlashWait_11Tclk() (SCU->FLASHWAIT.ACCT = 0xA)
|
|||
|
#define SCU_FlashWait_12Tclk() (SCU->FLASHWAIT.ACCT = 0xB)
|
|||
|
#define SCU_FlashWait_13Tclk() (SCU->FLASHWAIT.ACCT = 0xC)
|
|||
|
#define SCU_FlashWait_14Tclk() (SCU->FLASHWAIT.ACCT = 0xD)
|
|||
|
#define SCU_FlashWait_15Tclk() (SCU->FLASHWAIT.ACCT = 0xE)
|
|||
|
#define SCU_FlashWait_16Tclk() (SCU->FLASHWAIT.ACCT = 0xF)
|
|||
|
|
|||
|
/* ϵͳʱ<CDB3>Ӻ<EFBFBD><D3BA><EFBFBD>Ƶѡ<C6B5><D1A1> */
|
|||
|
#define SCU_SysClk_Div1() (SCU->SCLKEN0.SYSCLK_DIV = 0)
|
|||
|
#define SCU_SysClk_Div2() (SCU->SCLKEN0.SYSCLK_DIV = 1)
|
|||
|
#define SCU_SysClk_Div4() (SCU->SCLKEN0.SYSCLK_DIV = 2)
|
|||
|
#define SCU_SysClk_Div8() (SCU->SCLKEN0.SYSCLK_DIV = 3)
|
|||
|
#define SCU_SysClk_Div16() (SCU->SCLKEN0.SYSCLK_DIV = 4)
|
|||
|
#define SCU_SysClk_Div32() (SCU->SCLKEN0.SYSCLK_DIV = 5)
|
|||
|
#define SCU_SysClk_Div64() (SCU->SCLKEN0.SYSCLK_DIV = 6)
|
|||
|
#define SCU_SysClk_Div128() (SCU->SCLKEN0.SYSCLK_DIV = 7)
|
|||
|
|
|||
|
/* HRCʹ<43>ܿ<EFBFBD><DCBF><EFBFBD> (<28>ڲ<EFBFBD>20Mhz) */
|
|||
|
#define SCU_HRC_Enable() (SCU->SCLKEN1.HRC_EN = 1)
|
|||
|
#define SCU_HRC_Disable() (SCU->SCLKEN1.HRC_EN = 0)
|
|||
|
|
|||
|
/* XTALʹ<4C>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_XTAL_Enable() (SCU->SCLKEN1.XTAL_EN = 1)
|
|||
|
#define SCU_XTAL_Disable() (SCU->SCLKEN1.XTAL_EN = 0)
|
|||
|
|
|||
|
/* PLLģʽʹ<CABD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_PLL_Enable() (SCU->SCLKEN1.PLL_EN = 1)
|
|||
|
#define SCU_PLL_Disable() (SCU->SCLKEN1.PLL_EN = 0)
|
|||
|
|
|||
|
/*-------<2D><><EFBFBD><EFBFBD>ʱ<EFBFBD>ӿ<EFBFBD><D3BF><EFBFBD>-------*/
|
|||
|
/* SCUʱ<55><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_SCUCLK_Enable() (SCU->PCLKEN0.SCU_EN = 1)
|
|||
|
#define SCU_SCUCLK_Disable() (SCU->PCLKEN0.SCU_EN = 0)
|
|||
|
|
|||
|
/* GPIOʱ<4F><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_GPIOCLK_Enable() (SCU->PCLKEN0.GPIO_EN = 1)
|
|||
|
#define SCU_GPIOCLK_Disable() (SCU->PCLKEN0.GPIO_EN = 0)
|
|||
|
|
|||
|
/* FLASH IAPʱ<50><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_IAPCLK_Enable() (SCU->PCLKEN0.IAP_EN = 1)
|
|||
|
#define SCU_IAPCLK_Disable() (SCU->PCLKEN0.IAP_EN = 0)
|
|||
|
|
|||
|
/* CRCʱ<43><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_CRCCLK_Enable() (SCU->PCLKEN0.CRC_EN = 1)
|
|||
|
#define SCU_CRCCLK_Disable() (SCU->PCLKEN0.CRC_EN = 0)
|
|||
|
|
|||
|
/* ADCʱ<43><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_ADCCLK_Enable() (SCU->PCLKEN0.ADC_EN = 1)
|
|||
|
#define SCU_ADCCLK_Disable() (SCU->PCLKEN0.ADC_EN = 0)
|
|||
|
|
|||
|
/* RTCʱ<43><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_RTCCLK_Enable() (SCU->PCLKEN0.RTC_EN = 1)
|
|||
|
#define SCU_RTCCLK_Disable() (SCU->PCLKEN0.RTC_EN = 0)
|
|||
|
|
|||
|
/* IWDTʱ<54><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_IWDTCLK_Enable() (SCU->PCLKEN0.IWDT_EN = 1)
|
|||
|
#define SCU_IWDTCLK_Disable() (SCU->PCLKEN0.IWDT_EN = 0)
|
|||
|
|
|||
|
/* WWDTʱ<54><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_WWDTCLK_Enable() (SCU->PCLKEN0.WWDT_EN = 1)
|
|||
|
#define SCU_WWDTCLK_Disable() (SCU->PCLKEN0.WWDT_EN = 0)
|
|||
|
|
|||
|
/* AESʱ<53><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_AESCLK_Enable() (SCU->PCLKEN0.AES_EN = 1)
|
|||
|
#define SCU_AESCLK_Disable() (SCU->PCLKEN0.AES_EN = 0)
|
|||
|
|
|||
|
/* T16N0ʱ<30><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_T16N0CLK_Enable() (SCU->PCLKEN1.T16N0_EN = 1)
|
|||
|
#define SCU_T16N0CLK_Disable() (SCU->PCLKEN1.T16N0_EN = 0)
|
|||
|
|
|||
|
/* T16N1ʱ<31><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_T16N1CLK_Enable() (SCU->PCLKEN1.T16N1_EN = 1)
|
|||
|
#define SCU_T16N1CLK_Disable() (SCU->PCLKEN1.T16N1_EN = 0)
|
|||
|
|
|||
|
/* T16N2ʱ<32><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_T16N2CLK_Enable() (SCU->PCLKEN1.T16N2_EN = 1)
|
|||
|
#define SCU_T16N2CLK_Disable() (SCU->PCLKEN1.T16N2_EN = 0)
|
|||
|
|
|||
|
/* T16N3ʱ<33><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_T16N3CLK_Enable() (SCU->PCLKEN1.T16N3_EN = 1)
|
|||
|
#define SCU_T16N3CLK_Disable() (SCU->PCLKEN1.T16N3_EN = 0)
|
|||
|
|
|||
|
/* T32N0ʱ<30><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_T32N0CLK_Enable() (SCU->PCLKEN1.T32N0_EN = 1)
|
|||
|
#define SCU_T32N0CLK_Disable() (SCU->PCLKEN1.T32N0_EN = 0)
|
|||
|
|
|||
|
/* UART0ʱ<30><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_UART0CLK_Enable() (SCU->PCLKEN1.UART0_EN = 1)
|
|||
|
#define SCU_UART0CLK_Disable() (SCU->PCLKEN1.UART0_EN = 0)
|
|||
|
|
|||
|
/* UART1ʱ<31><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_UART1CLK_Enable() (SCU->PCLKEN1.UART1_EN = 1)
|
|||
|
#define SCU_UART1CLK_Disable() (SCU->PCLKEN1.UART1_EN = 0)
|
|||
|
|
|||
|
/* UART2ʱ<32><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_UART2CLK_Enable() (SCU->PCLKEN1.UART2_EN = 1)
|
|||
|
#define SCU_UART2CLK_Disable() (SCU->PCLKEN1.UART2_EN = 0)
|
|||
|
|
|||
|
/* UART3ʱ<33><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_UART3CLK_Enable() (SCU->PCLKEN1.UART3_EN = 1)
|
|||
|
#define SCU_UART3CLK_Disable() (SCU->PCLKEN1.UART3_EN = 0)
|
|||
|
|
|||
|
/* UART4ʱ<34><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_UART4CLK_Enable() (SCU->PCLKEN1.UART4_EN = 1)
|
|||
|
#define SCU_UART4CLK_Disable() (SCU->PCLKEN1.UART4_EN = 0)
|
|||
|
|
|||
|
/* UART5ʱ<35><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_UART5CLK_Enable() (SCU->PCLKEN1.UART5_EN = 1)
|
|||
|
#define SCU_UART5CLK_Disable() (SCU->PCLKEN1.UART5_EN = 0)
|
|||
|
|
|||
|
/* SPI0ʱ<30><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_SPI0CLK_Enable() (SCU->PCLKEN1.SPI0_EN = 1)
|
|||
|
#define SCU_SPI0CLK_Disable() (SCU->PCLKEN1.SPI0_EN = 0)
|
|||
|
|
|||
|
/* IIC0ʱ<30><CAB1>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_IIC0CLK_Enable() (SCU->PCLKEN1.I2C0_EN = 1)
|
|||
|
#define SCU_IIC0CLK_Disable() (SCU->PCLKEN1.I2C0_EN = 0)
|
|||
|
|
|||
|
/* <20>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><D3B3>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
|
|||
|
#define SCU_TBLRemap_Enable() (SCU->TBLREMAPEN.EN= 1)
|
|||
|
#define SCU_TBLRemap_Disable() (SCU->TBLREMAPEN.EN= 0)
|
|||
|
|
|||
|
/* <20>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD>ƼĴ<C6BC><C4B4><EFBFBD> x<><78><EFBFBD><EFBFBD>Ϊ2^24=16777216 */
|
|||
|
#define SCU_TBL_Offset(x) (SCU->TBLOFF.TBLOFF = (uint32_t)x)
|
|||
|
|
|||
|
/************SCUģ<55>麯<EFBFBD><E9BAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>***********/
|
|||
|
void SCU_OpenXTAL(void);
|
|||
|
void SCU_NMISelect(SCU_TYPE_NMICS NMI_Type);
|
|||
|
FlagStatus SCU_GetPWRCFlagStatus(SCU_TYPE_PWRC PWRC_Flag);
|
|||
|
void SCU_ClearPWRCFlagBit(SCU_TYPE_PWRC PWRC_Flag);
|
|||
|
FlagStatus SCU_GetLVDFlagStatus(SCU_TYPE_LVD0CON LVD_Flag);
|
|||
|
void SCU_SysClkSelect(SCU_TYPE_SYSCLK Sysclk);
|
|||
|
SCU_TYPE_SYSCLK SCU_GetSysClk(void);
|
|||
|
FlagStatus SCU_HRCReadyFlag(void);
|
|||
|
FlagStatus SCU_XTALReadyFlag(void);
|
|||
|
FlagStatus SCU_PLLReadyFlag(void);
|
|||
|
void SystemClockConfig(void);
|
|||
|
void SystemClockConfig_1(void);
|
|||
|
void DeviceClockAllEnable(void);
|
|||
|
void DeviceClockAllDisable(void);
|
|||
|
void SystemClockSelect(SCU_TYPE_SYSCLK SYSCLKx , SCU_TYPE_CLK_SEL CLK_SEL);
|
|||
|
void PLLClock_Config(TYPE_FUNCEN pll_en , SCU_PLL_Origin pll_origin ,SCU_PLL_Out pll_out,TYPE_FUNCEN sys_pll);
|
|||
|
#endif
|
|||
|
/*************************END OF FILE**********************/
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|