]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/common/services/clock/genclk.h
Rename DummyTCB_t to StaticTCB_t.
[freertos] / FreeRTOS / Demo / CORTEX_M7_SAME70_Xplained_AtmelStudio / src / ASF / common / services / clock / genclk.h
1 /**\r
2  * \file\r
3  *\r
4  * \brief Generic clock management\r
5  *\r
6  * Copyright (c) 2010-2015 Atmel Corporation. All rights reserved.\r
7  *\r
8  * \asf_license_start\r
9  *\r
10  * \page License\r
11  *\r
12  * Redistribution and use in source and binary forms, with or without\r
13  * modification, are permitted provided that the following conditions are met:\r
14  *\r
15  * 1. Redistributions of source code must retain the above copyright notice,\r
16  *    this list of conditions and the following disclaimer.\r
17  *\r
18  * 2. Redistributions in binary form must reproduce the above copyright notice,\r
19  *    this list of conditions and the following disclaimer in the documentation\r
20  *    and/or other materials provided with the distribution.\r
21  *\r
22  * 3. The name of Atmel may not be used to endorse or promote products derived\r
23  *    from this software without specific prior written permission.\r
24  *\r
25  * 4. This software may only be redistributed and used in connection with an\r
26  *    Atmel microcontroller product.\r
27  *\r
28  * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED\r
29  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE\r
31  * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR\r
32  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
33  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
34  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
35  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r
36  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\r
37  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
38  * POSSIBILITY OF SUCH DAMAGE.\r
39  *\r
40  * \asf_license_stop\r
41  *\r
42  */\r
43 /*\r
44  * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>\r
45  */\r
46 #ifndef CLK_GENCLK_H_INCLUDED\r
47 #define CLK_GENCLK_H_INCLUDED\r
48 \r
49 #include "parts.h"\r
50 \r
51 #if SAM3S\r
52 # include "sam3s/genclk.h"\r
53 #elif SAM3U\r
54 # include "sam3u/genclk.h"\r
55 #elif SAM3N\r
56 # include "sam3n/genclk.h"\r
57 #elif SAM3XA\r
58 # include "sam3x/genclk.h"\r
59 #elif SAM4S\r
60 # include "sam4s/genclk.h"\r
61 #elif SAM4L\r
62 # include "sam4l/genclk.h"\r
63 #elif SAM4E\r
64 # include "sam4e/genclk.h"\r
65 #elif SAM4N\r
66 # include "sam4n/genclk.h"\r
67 #elif SAM4C\r
68 # include "sam4c/genclk.h"\r
69 #elif SAM4CM\r
70 # include "sam4cm/genclk.h"\r
71 #elif SAM4CP\r
72 # include "sam4cp/genclk.h"\r
73 #elif SAMG\r
74 # include "samg/genclk.h"\r
75 #elif SAMV71\r
76 # include "samv71/genclk.h"\r
77 #elif SAMV70\r
78 # include "samv70/genclk.h"\r
79 #elif SAME70\r
80 # include "same70/genclk.h"\r
81 #elif SAMS70\r
82 # include "sams70/genclk.h"\r
83 #elif (UC3A0 || UC3A1)\r
84 # include "uc3a0_a1/genclk.h"\r
85 #elif UC3A3\r
86 # include "uc3a3_a4/genclk.h"\r
87 #elif UC3B\r
88 # include "uc3b0_b1/genclk.h"\r
89 #elif UC3C\r
90 # include "uc3c/genclk.h"\r
91 #elif UC3D\r
92 # include "uc3d/genclk.h"\r
93 #elif UC3L\r
94 # include "uc3l/genclk.h"\r
95 #else\r
96 # error Unsupported chip type\r
97 #endif\r
98 \r
99 /**\r
100  * \ingroup clk_group\r
101  * \defgroup genclk_group Generic Clock Management\r
102  *\r
103  * Generic clocks are configurable clocks which run outside the system\r
104  * clock domain. They are often connected to peripherals which have an\r
105  * asynchronous component running independently of the bus clock, e.g.\r
106  * USB controllers, low-power timers and RTCs, etc.\r
107  *\r
108  * Note that not all platforms have support for generic clocks; on such\r
109  * platforms, this API will not be available.\r
110  *\r
111  * @{\r
112  */\r
113 \r
114 /**\r
115  * \def GENCLK_DIV_MAX\r
116  * \brief Maximum divider supported by the generic clock implementation\r
117  */\r
118 /**\r
119  * \enum genclk_source\r
120  * \brief Generic clock source ID\r
121  *\r
122  * Each generic clock may be generated from a different clock source.\r
123  * These are the available alternatives provided by the chip.\r
124  */\r
125 \r
126 //! \name Generic clock configuration\r
127 //@{\r
128 /**\r
129  * \struct genclk_config\r
130  * \brief Hardware representation of a set of generic clock parameters\r
131  */\r
132 /**\r
133  * \fn void genclk_config_defaults(struct genclk_config *cfg,\r
134  *              unsigned int id)\r
135  * \brief Initialize \a cfg to the default configuration for the clock\r
136  * identified by \a id.\r
137  */\r
138 /**\r
139  * \fn void genclk_config_read(struct genclk_config *cfg, unsigned int id)\r
140  * \brief Read the currently active configuration of the clock\r
141  * identified by \a id into \a cfg.\r
142  */\r
143 /**\r
144  * \fn void genclk_config_write(const struct genclk_config *cfg,\r
145  *              unsigned int id)\r
146  * \brief Activate the configuration \a cfg on the clock identified by\r
147  * \a id.\r
148  */\r
149 /**\r
150  * \fn void genclk_config_set_source(struct genclk_config *cfg,\r
151  *              enum genclk_source src)\r
152  * \brief Select a new source clock \a src in configuration \a cfg.\r
153  */\r
154 /**\r
155  * \fn void genclk_config_set_divider(struct genclk_config *cfg,\r
156  *              unsigned int divider)\r
157  * \brief Set a new \a divider in configuration \a cfg.\r
158  */\r
159 /**\r
160  * \fn void genclk_enable_source(enum genclk_source src)\r
161  * \brief Enable the source clock \a src used by a generic clock.\r
162  */\r
163  //@}\r
164 \r
165 //! \name Enabling and disabling Generic Clocks\r
166 //@{\r
167 /**\r
168  * \fn void genclk_enable(const struct genclk_config *cfg, unsigned int id)\r
169  * \brief Activate the configuration \a cfg on the clock identified by\r
170  * \a id and enable it.\r
171  */\r
172 /**\r
173  * \fn void genclk_disable(unsigned int id)\r
174  * \brief Disable the generic clock identified by \a id.\r
175  */\r
176 //@}\r
177 \r
178 /**\r
179  * \brief Enable the configuration defined by \a src and \a divider\r
180  * for the generic clock identified by \a id.\r
181  *\r
182  * \param id      The ID of the generic clock.\r
183  * \param src     The source clock of the generic clock.\r
184  * \param divider The divider used to generate the generic clock.\r
185  */\r
186 static inline void genclk_enable_config(unsigned int id, enum genclk_source src, unsigned int divider)\r
187 {\r
188         struct genclk_config gcfg;\r
189 \r
190         genclk_config_defaults(&gcfg, id);\r
191         genclk_enable_source(src);\r
192         genclk_config_set_source(&gcfg, src);\r
193         genclk_config_set_divider(&gcfg, divider);\r
194         genclk_enable(&gcfg, id);\r
195 }\r
196 \r
197 //! @}\r
198 \r
199 #endif /* CLK_GENCLK_H_INCLUDED */\r