/*******************************************************************************
* Project:      Amped'RF Bluetooth
* File name:    GKI_misc.h
* Description:  Misc abstraction layer
*
* Copyright (c) 2013 Amped'RF Inc., AR Technology  All rights reserved.
*******************************************************************************/
#ifndef _GKI_MISC_H_
#define _GKI_MISC_H_


#define GKI_DEBUG
#ifdef  GKI_DEBUG
void GKI_TRACE_printf(char *fmt, ...);
#define GKI_TRACE_PRINT					GKI_TRACE_printf
#define GKI_TRACE_PRINT1(a,p1)			GKI_TRACE_printf(a,p1)
#define GKI_TRACE_PRINT2(a,p1,p2)		GKI_TRACE_printf(a,p1,p2)
#define GKI_TRACE_PRINT3(a,p1,p2,p3)	GKI_TRACE_printf(a,p1,p2,p3)
#else
#define GKI_TRACE_PRINT(a)
#define GKI_TRACE_PRINT1(a,p1)
#define GKI_TRACE_PRINT2(a,p1,p2)
#define GKI_TRACE_PRINT3(a,p1,p3)
#endif


#define GKI_WATCHDOG_MS   2000


typedef struct {
    u32 IDLE;
    u32 FULL;
    u32 HALF;
    u32 SWI;
    u32 RXNE;
    u32 ERR;
    u32 DOUBLE;
} tIsrSourceStatistic;
extern tIsrSourceStatistic IsrSrcStat[];


// Prototypes
//void GKI_BT_ClockConfig(uint32 Hz);
void    GKI_BT_ClockConfigDelete(void);
void    GKI_misc_Enable_Peripherals(void);
void    GKI_misc_Reset_Peripherals(void);
void    GKI_misc_LowPowerMode(void);
void    GKI_Startup(void);
#if defined(BT24)||defined(TI2564)
void SerialPutHciUART(char c);
#endif
void    SerialPutChar(char c);
u32     SerialKeyPressed(u8 *key);
u32     GKI_misc_CRC32Buffer(u8 *pBuf, u16 BufLen);
u16     GKI_READ_IPSR(void);
void    GKI_wdg_PeriodValueConfig(u32);
void    GKI_wdg_CntRefresh(void);
void    GKI_goto_bootloader(void);
void    GKI_ShowCpu(void);
void    GKI_WatchdogConfig(u32 ms);
void    GKI_WatchdogReset(void);
void    GKI_WatchdogISR(void);
u32     GKI_misc_CalcBlockCRC(u32 *wrd);

#endif // _GKI_MISC_H_
//--------------------------------------------------------------
//