xref: /btstack/port/renesas-tb-s1ja-cc256x/template/btstack_example/synergy/ssp/src/driver/r_cgc/r_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    : r_cgc_private.h
22  * Description  : Private header file for the CGC module.
23  **********************************************************************************************************************/
24 
25 #ifndef R_CGC_PRIVATE_H
26 #define R_CGC_PRIVATE_H
27 
28 /***********************************************************************************************************************
29  * Includes
30  **********************************************************************************************************************/
31 #include "bsp_clock_cfg.h"
32 
33 
34 /**********************************************************************************************************************
35  * Macro definitions
36  **********************************************************************************************************************/
37 /** Timeout to wait for register to be written */
38 #define MAX_REGISTER_WAIT_COUNT (0xFFFFU)
39 /** Number of subclock cycles to wait after subcclock has been stopped */
40 #define SUBCLOCK_DELAY          (5U)
41 
42 /** Divisor to use to obtain time for 1 tick in us from iclk */
43 #define RELOAD_COUNT_FOR_1US    (1000000U)
44 
45 
46 /**********************************************************************************************************************
47  * Typedef definitions
48  **********************************************************************************************************************/
49 /** Operating power control modes. */
50 typedef enum
51 {
52     CGC_HIGH_SPEED_MODE     = 0U,   // Should match OPCCR OPCM high speed
53     CGC_MIDDLE_SPEED_MODE   = 1U,   // Should match OPCCR OPCM middle speed
54     CGC_LOW_VOLTAGE_MODE    = 2U,   // Should match OPCCR OPCM low voltage
55     CGC_LOW_SPEED_MODE      = 3U,   // Should match OPCCR OPCM low speed
56     CGC_SUBOSC_SPEED_MODE   = 4U,   // Can be any value not otherwise used
57 }cgc_operating_modes_t;
58 
59 /*******************************************************************************************************************//**
60 @addtogroup CGC
61 @{
62 **********************************************************************************************************************/
63 
64 /**********************************************************************************************************************
65 * Private Global Functions
66  **********************************************************************************************************************/
67 bool r_cgc_clock_run_state_get (R_SYSTEM_Type * p_system_reg, cgc_clock_t clock);
68 cgc_operating_modes_t r_cgc_operating_mode_get (R_SYSTEM_Type * p_system_reg);
69 void r_cgc_operating_hw_modeset (R_SYSTEM_Type * p_system_reg, cgc_operating_modes_t operating_mode);
70 void r_cgc_hoco_wait_control_set (R_SYSTEM_Type * p_system_reg, uint8_t hoco_wait);
71 
72 /*******************************************************************************************************************//**
73  * @} (end addtogroup CGC)
74  **********************************************************************************************************************/
75 #endif /* R_CGC_PRIVATE_H */
76