Hardware Libraries  20.1
Stratix 10 SoC Hardware Manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
alt_clock_manager.h
1 /******************************************************************************
2  *
3  * Copyright 2015,2017 Altera Corporation. All Rights Reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its contributors
16  * may be used to endorse or promote products derived from this software without
17  * specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  *
31  ******************************************************************************/
32 #ifndef __ALT_CLK_MGR_H__
33 #define __ALT_CLK_MGR_H__
34 
35 #include "hwlib.h"
36 
37 typedef uint64_t alt_freq_t;
38 #define ALT_CLK_ERROR ((alt_freq_t)(0))
39 
40 /* ==================================================================
41 // Functions Definition
42 // ================================================================== */
43 
44 typedef enum ALT_CLK
45 {
46  ALT_CLK_OSC1,
47  ALT_CLK_F2S_FREE_CLK,
48  ALT_CLK_INTOSC,
49  ALT_CLK_MPU,
50  ALT_CLK_MPU_PERIPH,
51  ALT_CLK_MPU_CCU,
52  ALT_CLK_L4_SYS_FREE,
53  ALT_CLK_L4_MAIN,
54  ALT_CLK_L4_MP,
55  ALT_CLK_L4_SP,
56  ALT_CLK_CS_TIMER,
57  ALT_CLK_CS_AT,
58  ALT_CLK_CS_PDBG,
59  ALT_CLK_CS_TRACE,
60  ALT_CLK_S2F_USER0,
61  ALT_CLK_S2F_USER1,
62  ALT_CLK_EMAC0,
63  ALT_CLK_EMAC1,
64  ALT_CLK_EMAC2,
65  ALT_CLK_EMAC_PTP,
66  ALT_CLK_GPIO,
67  ALT_CLK_SDMMC,
68  ALT_CLK_PSI_REF,
69  ALT_CLK_USB,
70  ALT_CLK_NAND,
71  ALT_CLK_UNKNOWN
72 } ALT_CLK_t;
73 
74 /******************************************************************************/
84 alt_freq_t alt_clk_get_freq(ALT_CLK_t clk);
85 
86 
87 
88 /******************************************************************************/
94 alt_freq_t alt_clk_get_osc1_freq(void);
95 alt_freq_t alt_clk_get_cb_intosc_freq(void);
96 alt_freq_t alt_clk_get_f2s_free_freq(void);
97 alt_freq_t alt_clk_get_mpu_freq(void);
98 alt_freq_t alt_clk_get_mpu_periph_freq(void);
99 alt_freq_t alt_clk_get_mpu_ccu_freq(void);
100 alt_freq_t alt_clk_get_noc_freq(void);
101 alt_freq_t alt_clk_get_l3_main_free_freq(void);
102 alt_freq_t alt_clk_get_l4_sys_free_freq(void);
103 alt_freq_t alt_clk_get_l4_main_freq(void);
104 alt_freq_t alt_clk_get_l4_mp_freq(void);
105 alt_freq_t alt_clk_get_l4_sp_freq(void);
106 alt_freq_t alt_clk_get_cs_timer_freq(void);
107 alt_freq_t alt_clk_get_cs_at_freq(void);
108 alt_freq_t alt_clk_get_cs_pdbg_freq(void);
109 alt_freq_t alt_clk_get_cs_trace_freq(void);
110 alt_freq_t alt_clk_get_nand_freq(void);
111 alt_freq_t alt_clk_get_usb_freq(void);
112 alt_freq_t alt_clk_get_emac0_freq(void);
113 alt_freq_t alt_clk_get_emac1_freq(void);
114 alt_freq_t alt_clk_get_emac2_freq(void);
115 alt_freq_t alt_clk_get_emac_ptp_freq(void);
116 alt_freq_t alt_clk_get_gpio_db_freq(void);
117 alt_freq_t alt_clk_get_sdmmc_freq(void);
118 alt_freq_t alt_clk_get_sdmmc_freq(void);
119 alt_freq_t alt_clk_get_s2f_user0_freq(void);
120 alt_freq_t alt_clk_get_s2f_user1_freq(void);
121 alt_freq_t alt_clk_get_psi_ref_freq(void);
122 
123 /******************************************************************************/
138 ALT_STATUS_CODE alt_clk_clock_disable(ALT_CLK_t clk);
139 
140 /******************************************************************************/
155 ALT_STATUS_CODE alt_clk_clock_enable(ALT_CLK_t clk);
156 
157 /******************************************************************************/
169 ALT_STATUS_CODE alt_clk_is_enabled(ALT_CLK_t clk);
170 
171 #endif /* #ifndef __ALT_CLK_MGR_H__ */