149 lines
5.8 KiB
C
149 lines
5.8 KiB
C
/*
|
||
******************************************************************************
|
||
*
|
||
* @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
|
||
\******************************************************************************/
|
||
/* 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
|
||
|
||
/*<2A>жϺż<CFBA><C5BC>㷽ʽ<E3B7BD><CABD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD> = <20>жϺ<D0B6> * 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<44>ж<EFBFBD>
|
||
|
||
#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
|
||
|