xref: /btstack/port/renesas-tb-s1ja-cc256x/template/btstack_example/synergy/ssp/src/driver/r_cgc/hw/hw_cgc_private.h (revision 3b5c872a8c45689e8cc17891f01530f5aa5e911c)
1 /***********************************************************************************************************************
2  * Copyright [2015-2017] Renesas Electronics Corporation and/or its licensors. All Rights Reserved.
3  *
4  * This file is part of Renesas SynergyTM Software Package (SSP)
5  *
6  * The contents of this file (the "contents") are proprietary and confidential to Renesas Electronics Corporation
7  * and/or its licensors ("Renesas") and subject to statutory and contractual protections.
8  *
9  * This file is subject to a Renesas SSP license agreement. Unless otherwise agreed in an SSP license agreement with
10  * Renesas: 1) you may not use, copy, modify, distribute, display, or perform the contents; 2) you may not use any name
11  * or mark of Renesas for advertising or publicity purposes or in connection with your use of the contents; 3) RENESAS
12  * MAKES NO WARRANTY OR REPRESENTATIONS ABOUT THE SUITABILITY OF THE CONTENTS FOR ANY PURPOSE; THE CONTENTS ARE PROVIDED
13  * "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
14  * PARTICULAR PURPOSE, AND NON-INFRINGEMENT; AND 4) RENESAS SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, OR
15  * CONSEQUENTIAL DAMAGES, INCLUDING DAMAGES RESULTING FROM LOSS OF USE, DATA, OR PROJECTS, WHETHER IN AN ACTION OF
16  * CONTRACT OR TORT, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE CONTENTS. Third-party contents
17  * included in this file may be subject to different terms.
18  **********************************************************************************************************************/
19 
20 /**********************************************************************************************************************
21  * File Name    : hw_cgc_private.h
22  * Description  : hw_cgc Private header file.
23  **********************************************************************************************************************/
24 
25 #ifndef HW_CGC_PRIVATE_H
26 #define HW_CGC_PRIVATE_H
27 #include "r_cgc_api.h"
28 
29 /* Common macro for SSP header files. There is also a corresponding SSP_FOOTER macro at the end of this file. */
30 SSP_HEADER
31 
32 
33 /**********************************************************************************************************************
34  * Macro definitions
35  **********************************************************************************************************************/
36 #define CGC_OPCCR_HIGH_SPEED_MODE   (0U)
37 #define CGC_OPCCR_MIDDLE_SPEED_MODE (1U)
38 #define CGC_OPCCR_LOW_VOLTAGE_MODE (2U)
39 #define CGC_OPCCR_LOW_SPEED_MODE (3U)
40 #define CGC_SOPCCR_SET_SUBOSC_SPEED_MODE (1U)
41 #define CGC_SOPCCR_CLEAR_SUBOSC_SPEED_MODE (0U)
42 #define CGC_OPPCR_OPCM_MASK (0x3U)
43 #define CGC_SOPPCR_SOPCM_MASK (0x1U)
44 
45 /**********************************************************************************************************************
46  * Typedef definitions
47  **********************************************************************************************************************/
48 /** Main oscillator source identifier. */
49 typedef enum e_cgc_osc_source
50 {
51     CGC_OSC_SOURCE_RESONATOR,       ///< A resonator is used as the source of the main oscillator.
52     CGC_OSC_SOURCE_EXTERNAL_OSC     ///< An external oscillator is used as the source of the main oscillator.
53 } cgc_osc_source_t;
54 
55 
56 /*******************************************************************************************************************//**
57  * @} (end addtogroup CGC)
58  **********************************************************************************************************************/
59 
60 /**********************************************************************************************************************
61 * Functions
62  **********************************************************************************************************************/
63 void          HW_CGC_MemWaitSet (R_SYSTEM_Type * p_system_reg, uint32_t setting);
64 
65 uint32_t      HW_CGC_MemWaitGet (R_SYSTEM_Type * p_system_reg);
66 
67 void          HW_CGC_OscStopDetectEnable (R_SYSTEM_Type * p_system_reg);            // enable hardware oscillator stop detect function
68 
69 void          HW_CGC_SRAM_ProtectLock (R_SYSTEM_Type * p_system_reg);
70 
71 void          HW_CGC_SRAM_ProtectUnLock (R_SYSTEM_Type * p_system_reg);
72 
73 void          HW_CGC_SRAM_RAMWaitSet (R_SYSTEM_Type * p_system_reg, uint32_t setting);
74 
75 void          HW_CGC_SRAM_HSRAMWaitSet (R_SYSTEM_Type * p_system_reg, uint32_t setting);
76 
77 void          HW_CGC_ROMWaitSet (R_SYSTEM_Type * p_system_reg, uint32_t setting);
78 
79 uint32_t      HW_CGC_ROMWaitGet (R_SYSTEM_Type * p_system_reg);
80 
81 bool          HW_CGC_SystickUpdate(uint32_t ticks_per_second);
82 
83 /* Common macro for SSP header files. There is also a corresponding SSP_HEADER macro at the top of this file. */
84 SSP_FOOTER
85 
86 #endif /* HW_CGC_PRIVATE_H */
87