/*********************************************************************************************************************
* RT1064DVL6A Opensourec Library RT1064DVL6A Դ⣩һڹٷ SDK ӿڵĵԴ
* Copyright (c) 2022 SEEKFREE ɿƼ
* 
* ļ RT1064DVL6A Դһ
* 
* RT1064DVL6A Դ 
* Ըᷢ 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_clock
* ˾          ɶɿƼ޹˾
* 汾Ϣ          鿴 libraries/doc ļ version ļ 汾˵
*           IAR 8.32.4 or MDK 5.33
* ƽ̨          RT1064DVL6A
*           https://seekfree.taobao.com/
* 
* ޸ļ¼
*                               ע
* 2022-09-21        SeekFree            first version
********************************************************************************************************************/

#include "board.h"
#include "clock_config.h"
#include "zf_common_function.h"
#include "zf_common_interrupt.h"
#include "zf_driver_flash.h"
#include "zf_common_clock.h"

uint32 system_clock = SYSTEM_CLOCK_600M;                                          // ϵͳʱϢ

extern void system_delay_init(void);
    
//-------------------------------------------------------------------------------------------------------------------
//      ʱӻָʼ
// ˵     void
// ز     void
// ʹʾ     clock_reset();
// עϢ     ļڲ ûùע Ҳ޸
//-------------------------------------------------------------------------------------------------------------------
//static void clock_reset (void)
//{
//    // δʵ
//}

//-------------------------------------------------------------------------------------------------------------------
//      ʱ
// ˵     clock       ʱƵ Ƽʹ zf_common_clock.h  system_clock_enum ѡ
// ز     void
// ʹʾ     clock_set_freq(clock);
// עϢ     ļڲ ûùע Ҳ޸
//-------------------------------------------------------------------------------------------------------------------
//static void clock_set_freq (uint32 clock)
//{
//    // δʵ
//}

//-------------------------------------------------------------------------------------------------------------------
//      ʱӳʼ
// ˵     clock       ʱƵ Ƽʹ zf_common_clock.h  system_clock_enum ѡ
// ز     void
// ʹʾ     clock_init(SYSTEM_CLOCK_120M);                  // ʼʱΪ 120MHz
// עϢ     ڽʱõָƵ
//-------------------------------------------------------------------------------------------------------------------
void clock_init (uint32 clock)
{
    system_clock = clock;                                                       // ¼ʱƵ
//    clock_reset();
    BOARD_ConfigMPU();
    BOARD_InitBootClocks();
    system_delay_init();
    interrupt_init();
    //flash_init();
}
