SY8837_Demo_For_OurSelf/UsrInc/system/system.h

209 lines
8.1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
******************************************************************************
*
* @file system.h
* @brief system module
* @ic sy8835
*
* @version 1.0
* @date 2024/11/01 09:59:40
* @author Alex Xu
*
* Copyright (c) 2013-2099,Tkplusemi Technology Co.,Ltd.
* All Rights Reserved
*
* History:
* Revision Date Author Desc
* 1.0.0 2024/11/01 Alex build this file
******************************************************************************
*/
#ifndef __SYSTEM_H__
#define __SYSTEM_H__
/*_____ I N C L U D E S ____________________________________________________*/
#include "define.h"
/******************************************************************************\
Macro definitions
\******************************************************************************/
/* Boost/Hall/Key/VBUS״̬¼Ä´æÆ÷ - CHIP_STA0 */
#define BOOST_BATUV_Pos (7U)
#define BOOST_BATUV_Pos_Msk (0x1UL << BOOST_BATUV_Pos)
#define BOOST_BATUV BOOST_BATUV_Pos_Msk
#define BOOST_SHORT_Pos (6U)
#define BOOST_SHORT_Pos_Msk (0x1UL << BOOST_SHORT_Pos)
#define BOOST_SHORT BOOST_SHORT_Pos_Msk
#define HALL_STATOK_Pos (4U)
#define HALL_STATOK_Pos_Msk (0x1UL << HALL_STATOK_Pos)
#define HALL_STATOK HALL_STATOK_Pos_Msk
#define HALL_STAT_Pos (3U)
#define HALL_STAT_Pos_Msk (0x1UL << HALL_STAT_Pos)
#define HALL_STAT HALL_STAT_Pos_Msk
#define HALL_PRE_Pos (2U)
#define HALL_PRE_Pos_Msk (0x1UL << HALL_PRE_Pos)
#define HALL_PRE HALL_PRE_Pos_Msk
#define KEY_STAT_Pos (1U)
#define KEY_STAT_Pos_Msk (0x1UL << KEY_STAT_Pos)
#define KEY_STAT KEY_STAT_Pos_Msk
#define VIN_PRESENT_Pos (0U)
#define VIN_PRESENT_Pos_Msk (0x1UL << VIN_PRESENT_Pos)
#define VIN_PRESENT VIN_PRESENT_Pos_Msk
/* Abnormal Interrupt Flag Register-IRQ_FLAG0 */
#define DIE_TO_Pos (6U)
#define DIE_TO_Pos_Msk (0x1UL << DIE_TO_Pos)
#define DIE_TO DIE_TO_Pos_Msk
#define VBUS_OverVol_Pos (5U)
#define VBUS_OverVol_Pos_Msk (0x1UL << VBUS_OverVol_Pos)
#define VBUS_OverVol VBUS_OverVol_Pos_Msk
#define BAT_Low_Pos (4U)
#define BAT_Low_Pos_Msk (0x1UL << BAT_Low_Pos)
#define BAT_Low BAT_Low_Pos_Msk
#define VOR_OutPut_Short_Pos (3U)
#define VOR_OutPut_Short_Pos_Msk (0x1UL << VOR_OutPut_Short_Pos)
#define VOR_OutPut_Short VOR_OutPut_Short_Pos_Msk
#define VOL_OutPut_Short_Pos (2U)
#define VOL_OutPut_Short_Pos_Msk (0x1UL << VOL_OutPut_Short_Pos)
#define VOL_OutPut_Short VOL_OutPut_Short_Pos_Msk
#define Boost_UVLO_Pos (1U)
#define Boost_UVLO_Pos_Msk (0x1UL << Boost_UVLO_Pos)
#define Boost_UVLO Boost_UVLO_Pos_Msk
#define Boost_OutPut_Short_Pos (0U)
#define Boost_OutPut_Short_Pos_Msk (0x1UL << Boost_OutPut_Short_Pos)
#define Boost_OutPut_Short Boost_OutPut_Short_Pos_Msk
/* Charger Interrupt Flag Register-IRQ_FALG9 */
#define VIN_DPM_Pos (7U)
#define VIN_DPM_Pos_Msk (0x1UL << VIN_DPM_Pos)
#define VIN_DPM VIN_DPM_Pos_Msk
#define Temp_Loop_Pos (6U)
#define Temp_Loop_Pos_Msk (0x1UL << Temp_Loop_Pos)
#define Temp_Loop Temp_Loop_Pos_Msk
#define BAT_OverVol_Pos (5U)
#define BAT_OverVol_Pos_Msk (0x1UL << BAT_OverVol_Pos)
#define BAT_OverVol BAT_OverVol_Pos_Msk
#define CHG_Complete_Pos (4U)
#define CHG_Complete_Pos_Msk (0x1UL << CHG_Complete_Pos)
#define CHG_Complete CHG_Complete_Pos_Msk
#define CHG_FastChgTmr_Pos (3U)
#define CHG_FastChgTmr_Pos_Msk (0x1UL << CHG_FastChgTmr_Pos)
#define CHG_FastChgTmr CHG_FastChgTmr_Pos_Msk
#define CHG_TricleChgTmr_Pos (2U)
#define CHG_TricleChgTmr_Pos_Msk (0x1UL << CHG_TricleChgTmr_Pos)
#define CHG_TricleChgTmr CHG_TricleChgTmr_Pos_Msk
#define VBUS_PG_NEG_Pos (1U)
#define VBUS_PG_NEG_Pos_Msk (0x1UL << VBUS_PG_NEG_Pos)
#define VBUS_PG_NEG VBUS_PG_NEG_Pos_Msk
#define VBUS_PG_POS_Pos (0U)
#define VBUS_PG_POS_Pos_Msk (0x1UL << VBUS_PG_POS_Pos)
#define VBUS_PG_POS VBUS_PG_POS_Pos_Msk
/* VBUS/HALL and ADC Data Ready Interrupt Flag Register-IRQ_FLAG10 */
#define VBUS_PLUG_OUT_Pos (7U)
#define VBUS_PLUG_OUT_Pos_Msk (0x1UL << VBUS_PLUG_OUT_Pos)
#define VBUS_PLUG_OUT VBUS_PLUG_OUT_Pos_Msk
#define VBUS_PLUG_IN_Pos (6U)
#define VBUS_PLUG_IN_Pos_Msk (0x1UL << VBUS_PLUG_IN_Pos)
#define VBUS_PLUG_IN VBUS_PLUG_IN_Pos_Msk
#define HALL_NEG_Pos (3U)
#define HALL_NEG_Pos_Msk (0x1UL << HALL_NEG_Pos)
#define HALL_NEG HALL_NEG_Pos_Msk
#define HALL_POS_Pos (2U)
#define HALL_POS_Pos_Msk (0x1UL << HALL_POS_Pos)
#define HALL_POS HALL_POS_Pos_Msk
#define Standby_Tmr_WkUp_Pos (1U)
#define Standby_Tmr_WkUp_Msk (0x1UL << Standby_Tmr_WkUp_Pos)
#define Standby_Tmr_WkUp Standby_Tmr_WkUp_Msk
#define ADC_Data_Ready_Pos (0U)
#define ADC_Data_Ready_Msk (0x1UL << ADC_Data_Ready_Pos)
#define ADC_Data_Ready ADC_Data_Ready_Msk
/* Boost/Hall/Key/VBUS Wakeup Flag - WKUP_FLAG0 */
#define TMR_WK_FLAG_Pos (3U)
#define TMR_WK_FLAG_Pos_Msk (0x1UL << TMR_WK_FLAG_Pos)
#define TMR_WK_FLAG TMR_WK_FLAG_Pos_Msk
#define HALL_WK_FLAG_Pos (2U)
#define HALL_WK_FLAG_Pos_Msk (0x1UL << HALL_WK_FLAG_Pos)
#define HALL_WK_FLAG HALL_WK_FLAG_Pos_Msk
#define KEY_WK_FLAG_Pos (1U)
#define KEY_WK_FLAG_Pos_Msk (0x1UL << KEY_WK_FLAG_Pos)
#define KEY_WK_FLAG KEY_WK_FLAG_Pos_Msk
#define VIN_PRESENT_WK_FLAG_Pos (0U)
#define VIN_PRESENT_WK_FLAG_Pos_Msk (0x1UL << VIN_PRESENT_WK_FLAG_Pos)
#define VIN_PRESENT_WK_FLAG VIN_PRESENT_WK_FLAG_Pos_Msk
/* Standby ¶¨Ê±»½ÐÑ¿ØÖƼĴæÆ÷--STB_TIM_CTL */
#define EN_FORCE_LOSC_Pos (7U)
#define EN_FORCE_LOSC_Pos_Msk (0x1UL << EN_FORCE_LOSC_Pos)
#define EN_FORCE_LOSC EN_FORCE_LOSC_Pos_Msk
#define STB_TMR_EN_Pos (2U)
#define STB_TMR_EN_Pos_Msk (0x1UL << STB_TMR_EN_Pos)
#define STB_TMR_EN STB_TMR_EN_Pos_Msk
#define STB_TMR_SET_2S (0U)
#define STB_TMR_SET_4S (1U)
#define STB_TMR_SET_8S (2U)
#define STB_TMR_SET_16S (3U)
/*ÖжϺżÆË㷽ʽ£ºÖжÏÏòÁ¿ = ÖжϺŠ* 8 + 3*/
#define Interrupt_Vector_IE0 0 //0x03,SY8836 IE0 use for wakeup
#define Interrupt_Vector_TF0 1 //0x0B,Timer 0 Overflow
#define Interrupt_Vector_IE1 2 //0x13
#define Interrupt_Vector_TF1 3 //0x1B,Timer 1 Overflow
#define Interrupt_Vector_RI_TI 4 //0x23,Serial Port0 Interrupt
#define Interrupt_Vector_TF2 5 //0x2B
#define Interrupt_Vector_IE7 8 //0x43,External Interrupt 7 / PWM
#define Interrupt_Vector_IE2 9 //0x4B,External Interrupt 2
#define Interrupt_Vector_IE3 10 //0x53,External Interrupt 3
#define Interrupt_Vector_IE4 11 //0x5B,External Interrupt 4
#define Interrupt_Vector_IE5 12 //0x63,External Interrupt 5
#define Interrupt_Vector_IE6 13 //0x6B,External Interrupt 6 / ADCÖжÏ
#define Interrupt_Vector_RI1_TI1 16 //0x83,Serial Port1 Interrupt
#define Interrupt_Vector_IE8 17 //0x8B,Serial Port2 Interrupt
/******************************************************************************\
Variables definitions
\******************************************************************************/
/******************************************************************************\
Functions definitions
\******************************************************************************/
extern void System_Init(void);
#endif