/*******************************************************************************
* Project:      Amped'RF Bluetooth
* File name:    GKI_rcc.c
* Description:  Header for uart abstraction layer
*
* Copyright (c) 2013 Amped'RF Inc., AR Technology  All rights reserved.
*******************************************************************************/
#ifndef _GKI_RCC_H_
#define _GKI_RCC_H_

//------------------------------------------------------------------------------
// PLL Table
//------------------------------------------------------------------------------
typedef struct {
    u8      mhz;
    bool    usePLL;
    u8      M;
    u16     N;
    u8      P;
    u32     AHB_Prescale;
    u8      APB1Div;
    u8      APB2Div;
    u32     MaxBaudrate;
} tPLL_Table;

extern tPLL_Table PLL_Table[];
extern u16 pll_tbl_size;


// Prototypes
void    GKI_rcc_Config(void);
void    GKI_rcc_SetCpuHz_HSI(uint32 Hz);
void    GKI_rcc_SetCpuHz_HSE(uint32 Hz);
void    GKI_rcc_ConfigMCO(void);
void    GKI_rcc_SetSysClock(uint32 hz);
uint32  GKI_rcc_MaxBaudrate(uint8 mhz);
uint8   GKI_rcc_MinCpuMHz(uint32 baudrate);
void    GKI_rcc_BT_ClockConfig(uint32 Hz);
bool    GKI_rcc_ValidateCpuMHz(uint8 mhz);
char   *GKI_rcc_ValidMhzText(void);
bool    GKI_rcc_CheckExtLPO(void);
bool    GKI_rcc_MainClockUsesHSE(void);
void    GKI_rcc_HSEConfig(bool en);
uint8   GKI_rcc_GetHSICalibrationValue(void);
void    GKI_rcc_AdjustHSICalibrationValue(uint8 n);


#endif // _GKI_RCC_H_
