/***********************************************************************
 * Copyright (c)  2017 - 2020, Unicmicro Co.,Ltd .
 * All rights reserved.
 * Filename    : system_um6809.h
 * Description : system config header file (for example: clock config.....)
 * Author(s)   : Dan
 * version     : V1.0
 * Modify date : 2019-04-10
 ***********************************************************************/
#ifndef __SYSTEM_UM321XA_H__
#define __SYSTEM_UM321XA_H__

#include  "um321xA.h"

#ifdef __cplusplus
extern "C"
{
#endif

#define CLK_DIV_RCH    (1<<17)  //时钟源分频(0表示不分频，1表示2分频)
#define CLK_DIV_APB    (0<<9)  //APB分频

extern uint32_t SystemCoreClock;   //core时钟  (uint:Hz)
extern uint32_t SRCClock;   		 //源时钟,clk_src, (uint:Hz)
extern uint32_t PCLK;    			 //APB时钟/PCLK,外设时钟  , (uint:Hz)
extern uint32_t RCLClock;   	     //RCL时钟,clk_src, (uint:Hz)
/************************************************************************
 * function   : SystemInit
 * Description: SystemInit
 * input : none
 * return: none
 ************************************************************************/
void SystemInit(void);

/************************************************************************
 * function   : clock_init
 * Description: clock init, initil several clock variables
 * input :
 *         uint32_t system_clk_mhz: expected system core clock
 * return: none
 ************************************************************************/
void clock_init(uint32_t system_clk_hz);
void io_status_init(void);

void SystemCoreClockUpdate(void);
void sys_entersleep(void);
void sys_enterdeepsleep(void);
void sys_enterstop(void);




#ifdef __cplusplus
}
#endif

#endif
