1 /*******************************************************************************
2 * File Name: NOR_Clock.h
6 * Provides the function and constant definitions for the clock component.
10 ********************************************************************************
11 * Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved.
12 * You may use this file only in accordance with the license, terms, conditions,
13 * disclaimers, and limitations in the end user license agreement accompanying
14 * the software package with which this file was provided.
15 *******************************************************************************/
17 #if !defined(CY_CLOCK_NOR_Clock_H)
18 #define CY_CLOCK_NOR_Clock_H
24 /***************************************
25 * Conditional Compilation Parameters
26 ***************************************/
28 /* Check to see if required defines such as CY_PSOC5LP are available */
29 /* They are defined starting with cy_boot v3.0 */
30 #if !defined (CY_PSOC5LP)
31 #error Component cy_clock_v2_20 requires cy_boot v3.0 or later
32 #endif /* (CY_PSOC5LP) */
35 /***************************************
37 ***************************************/
39 void NOR_Clock_Start(void) ;
40 void NOR_Clock_Stop(void) ;
42 #if(CY_PSOC3 || CY_PSOC5LP)
43 void NOR_Clock_StopBlock(void) ;
44 #endif /* (CY_PSOC3 || CY_PSOC5LP) */
46 void NOR_Clock_StandbyPower(uint8 state) ;
47 void NOR_Clock_SetDividerRegister(uint16 clkDivider, uint8 restart)
49 uint16 NOR_Clock_GetDividerRegister(void) ;
50 void NOR_Clock_SetModeRegister(uint8 modeBitMask) ;
51 void NOR_Clock_ClearModeRegister(uint8 modeBitMask) ;
52 uint8 NOR_Clock_GetModeRegister(void) ;
53 void NOR_Clock_SetSourceRegister(uint8 clkSource) ;
54 uint8 NOR_Clock_GetSourceRegister(void) ;
55 #if defined(NOR_Clock__CFG3)
56 void NOR_Clock_SetPhaseRegister(uint8 clkPhase) ;
57 uint8 NOR_Clock_GetPhaseRegister(void) ;
58 #endif /* defined(NOR_Clock__CFG3) */
60 #define NOR_Clock_Enable() NOR_Clock_Start()
61 #define NOR_Clock_Disable() NOR_Clock_Stop()
62 #define NOR_Clock_SetDivider(clkDivider) NOR_Clock_SetDividerRegister(clkDivider, 1u)
63 #define NOR_Clock_SetDividerValue(clkDivider) NOR_Clock_SetDividerRegister((clkDivider) - 1u, 1u)
64 #define NOR_Clock_SetMode(clkMode) NOR_Clock_SetModeRegister(clkMode)
65 #define NOR_Clock_SetSource(clkSource) NOR_Clock_SetSourceRegister(clkSource)
66 #if defined(NOR_Clock__CFG3)
67 #define NOR_Clock_SetPhase(clkPhase) NOR_Clock_SetPhaseRegister(clkPhase)
68 #define NOR_Clock_SetPhaseValue(clkPhase) NOR_Clock_SetPhaseRegister((clkPhase) + 1u)
69 #endif /* defined(NOR_Clock__CFG3) */
72 /***************************************
74 ***************************************/
76 /* Register to enable or disable the clock */
77 #define NOR_Clock_CLKEN (* (reg8 *) NOR_Clock__PM_ACT_CFG)
78 #define NOR_Clock_CLKEN_PTR ((reg8 *) NOR_Clock__PM_ACT_CFG)
80 /* Register to enable or disable the clock */
81 #define NOR_Clock_CLKSTBY (* (reg8 *) NOR_Clock__PM_STBY_CFG)
82 #define NOR_Clock_CLKSTBY_PTR ((reg8 *) NOR_Clock__PM_STBY_CFG)
84 /* Clock LSB divider configuration register. */
85 #define NOR_Clock_DIV_LSB (* (reg8 *) NOR_Clock__CFG0)
86 #define NOR_Clock_DIV_LSB_PTR ((reg8 *) NOR_Clock__CFG0)
87 #define NOR_Clock_DIV_PTR ((reg16 *) NOR_Clock__CFG0)
89 /* Clock MSB divider configuration register. */
90 #define NOR_Clock_DIV_MSB (* (reg8 *) NOR_Clock__CFG1)
91 #define NOR_Clock_DIV_MSB_PTR ((reg8 *) NOR_Clock__CFG1)
93 /* Mode and source configuration register */
94 #define NOR_Clock_MOD_SRC (* (reg8 *) NOR_Clock__CFG2)
95 #define NOR_Clock_MOD_SRC_PTR ((reg8 *) NOR_Clock__CFG2)
97 #if defined(NOR_Clock__CFG3)
98 /* Analog clock phase configuration register */
99 #define NOR_Clock_PHASE (* (reg8 *) NOR_Clock__CFG3)
100 #define NOR_Clock_PHASE_PTR ((reg8 *) NOR_Clock__CFG3)
101 #endif /* defined(NOR_Clock__CFG3) */
104 /**************************************
106 **************************************/
108 /* Power manager register masks */
109 #define NOR_Clock_CLKEN_MASK NOR_Clock__PM_ACT_MSK
110 #define NOR_Clock_CLKSTBY_MASK NOR_Clock__PM_STBY_MSK
112 /* CFG2 field masks */
113 #define NOR_Clock_SRC_SEL_MSK NOR_Clock__CFG2_SRC_SEL_MASK
114 #define NOR_Clock_MODE_MASK (~(NOR_Clock_SRC_SEL_MSK))
116 #if defined(NOR_Clock__CFG3)
117 /* CFG3 phase mask */
118 #define NOR_Clock_PHASE_MASK NOR_Clock__CFG3_PHASE_DLY_MASK
119 #endif /* defined(NOR_Clock__CFG3) */
121 #endif /* CY_CLOCK_NOR_Clock_H */