#ifndef _GW3323_CLK_H
#define _GW3323_CLK_H

#include "include.h"

//----------------- CLKGAT0 DEFINITION -----------------//
#define CLOCK_GATE0_ROM0            ((uint32_t)0x00000001)
#define CLOCK_GATE0_ROM1            ((uint32_t)0x00000002)
#define CLOCK_GATE0_RAM0            ((uint32_t)0x00000004)
#define CLOCK_GATE0_RAM1            ((uint32_t)0x00000008)
#define CLOCK_GATE0_RAM2            ((uint32_t)0x00000010)
#define CLOCK_GATE0_RAM3            ((uint32_t)0x00000020)
#define CLOCK_GATE0_RAM4            ((uint32_t)0x00000040)
#define CLOCK_GATE0_TMR0            ((uint32_t)0x00000100)
#define CLOCK_GATE0_SD0             ((uint32_t)0x00000200)
#define CLOCK_GATE0_UART0           ((uint32_t)0x00000400)
#define CLOCK_GATE0_HSUART0         ((uint32_t)0x00000800)
#define CLOCK_GATE0_DAC             ((uint32_t)0x00001000)
#define CLOCK_GATE0_SARADC          ((uint32_t)0x00002000)
#define CLOCK_GATE0_USB             ((uint32_t)0x00004000)
#define CLOCK_GATE0_SDADCBQF        ((uint32_t)0x00008000)
#define CLOCK_GATE0_AUDEC           ((uint32_t)0x00010000)
#define CLOCK_GATE0_PORT            ((uint32_t)0x00020000)
#define CLOCK_GATE0_MBIST           ((uint32_t)0x00040000)
#define CLOCK_GATE0_SPI0            ((uint32_t)0x00080000)
#define CLOCK_GATE0_BT              ((uint32_t)0x00100000)
#define CLOCK_GATE0_UART1           ((uint32_t)0x00200000)
#define CLOCK_GATE0_SDADC           ((uint32_t)0x00400000)
#define CLOCK_GATE0_TMR1            ((uint32_t)0x01000000)
#define CLOCK_GATE0_TMR2            ((uint32_t)0x02000000)
#define CLOCK_GATE0_RTCC            ((uint32_t)0x04000000)
#define CLOCK_GATE0_RESRC           ((uint32_t)0x08000000)
#define CLOCK_GATE0_SPF             ((uint32_t)0x20000000)
#define CLOCK_GATE0_AEC             ((uint32_t)0x40000000)
#define CLOCK_GATE0_CVSD            ((uint32_t)0x80000000)

//----------------- CLKGAT1 DEFINITION -----------------//
#define CLOCK_GATE1_FMAMFDT         ((uint32_t)0x00000001)
#define CLOCK_GATE1_SRC             ((uint32_t)0x00000004)
#define CLOCK_GATE1_IRRX            ((uint32_t)0x00000008)
#define CLOCK_GATE1_IIS             ((uint32_t)0x00000010)
#define CLOCK_GATE1_SBCEC           ((uint32_t)0x00000020)
#define CLOCK_GATE1_LPBK            ((uint32_t)0x00000040)
#define CLOCK_GATE1_PLC             ((uint32_t)0x00000080)
#define CLOCK_GATE1_TMR3            ((uint32_t)0x00000100)
#define CLOCK_GATE1_TMR4            ((uint32_t)0x00000200)
#define CLOCK_GATE1_TMR5            ((uint32_t)0x00000400)
#define CLOCK_GATE1_UART2           ((uint32_t)0x00000800)
#define CLOCK_GATE1_SPI1            ((uint32_t)0x00001000)
#define CLOCK_GATE1_FMLODIV         ((uint32_t)0x00002000)
#define CLOCK_GATE1_FMLO            ((uint32_t)0x00004000)
#define CLOCK_GATE1_PIANO           ((uint32_t)0x00008000)
#define CLOCK_GATE1_TICK            ((uint32_t)0x00010000)
#define CLOCK_GATE1_RNN             ((uint32_t)0x00080000)
#define CLOCK_GATE1_AECRAM          ((uint32_t)0x00800000)
#define CLOCK_GATE1_ROM2            ((uint32_t)0x01000000)
#define CLOCK_GATE1_ROM3            ((uint32_t)0x02000000)
#define CLOCK_GATE1_FREQDET         ((uint32_t)0x04000000)
#define CLOCK_GATE1_PBF             ((uint32_t)0x08000000)
#define CLOCK_GATE1_DBG             ((uint32_t)0x10000000)
#define CLOCK_GATE1_X26M_32K        ((uint32_t)0x20000000)
#define CLOCK_GATE1_M2M             ((uint32_t)0x40000000)
#define CLOCK_GATE1_EFUS            ((uint32_t)0x80000000)

//----------------- CLKGAT2 DEFINITION -----------------//
#define CLOCK_GATE2_IIC             ((uint32_t)0x00000001)
#define CLOCK_GATE2_DVP             ((uint32_t)0x00000004)
#define CLOCK_GATE2_BSP             ((uint32_t)0x00000400)
#define CLOCK_GATE2_PLLDIV2         ((uint32_t)0x00000800)
#define CLOCK_GATE2_PLLDIV4         ((uint32_t)0x00001000)
#define CLOCK_GATE2_SPLLDIV         ((uint32_t)0x00002000)
#define CLOCK_GATE2_ADPLLDIV        ((uint32_t)0x00004000)
#define CLOCK_GATE2_DAC             ((uint32_t)0x00008000)
#define CLOCK_GATE2_RNN             ((uint32_t)0x00080000)
#define CLOCK_GATE2_RDFT            ((uint32_t)0x00100000)
#define CLOCK_GATE2_HWMATH          ((uint32_t)0x00200000)

//------ Function used to enable clock or disable ------//
void clock_gate0_cmd(uint32_t clock_gate, FUNCTIONAL_STATE state);
void clock_gate1_cmd(uint32_t clock_gate, FUNCTIONAL_STATE state);
void clock_gate2_cmd(uint32_t clock_gate, FUNCTIONAL_STATE state);

#endif // _GW3323_CLK_H
