]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/AtmelFiles/drivers/peripherals/pit.h
Add SAMA5D2 Xplained IAR demo.
[freertos] / FreeRTOS / Demo / CORTEX_A5_SAMA5D2x_Xplained_IAR / AtmelFiles / drivers / peripherals / pit.h
1 /* ----------------------------------------------------------------------------\r
2  *         SAM Software Package License\r
3  * ----------------------------------------------------------------------------\r
4  * Copyright (c) 2011, Atmel Corporation\r
5  *\r
6  * All rights reserved.\r
7  *\r
8  * Redistribution and use in source and binary forms, with or without\r
9  * modification, are permitted provided that the following conditions are met:\r
10  *\r
11  * - Redistributions of source code must retain the above copyright notice,\r
12  * this list of conditions and the disclaimer below.\r
13  *\r
14  * Atmel's name may not be used to endorse or promote products derived from\r
15  * this software without specific prior written permission.\r
16  *\r
17  * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR\r
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE\r
20  * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,\r
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\r
23  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
24  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
25  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\r
26  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
27  * ----------------------------------------------------------------------------\r
28  */\r
29 \r
30 #ifndef _PIT_H_\r
31 #define _PIT_H_\r
32 \r
33 /*------------------------------------------------------------------------------\r
34  *         Headers\r
35  *------------------------------------------------------------------------------*/\r
36 \r
37 #include <stdint.h>\r
38 \r
39 /*----------------------------------------------------------------------------\r
40  *        Exported functions\r
41  *----------------------------------------------------------------------------*/\r
42 \r
43 #ifdef __cplusplus\r
44 extern "C" {\r
45 #endif\r
46 \r
47 /**\r
48 * \brief Initialize the Periodic Interval Timer to generate a tick at the\r
49 * specified period, given the current master clock frequency.\r
50 *\r
51 *  \param period Period in micro seconds.\r
52 */\r
53 extern void pit_init(uint32_t period);\r
54 \r
55 /**\r
56  * \brief Set the Periodic Interval Value of the PIT.\r
57  *\r
58  *  \param piv  PIV value to set.\r
59  */\r
60 extern void pit_set_piv(uint32_t piv);\r
61 \r
62 /**\r
63  * \brief Enables the PIT if this is not already the case.\r
64  *\r
65  */\r
66 extern void pit_enable(void);\r
67 \r
68 /**\r
69  * \brief Disnables the PIT when PIV value is reached.\r
70  *\r
71  */\r
72 extern void pit_disable(void);\r
73 \r
74 /**\r
75  * \brief Enable the PIT periodic interrupt.\r
76  *\r
77  */\r
78 extern void pit_enable_it(void);\r
79 \r
80 /**\r
81  * \brief Disables the PIT periodic interrupt.\r
82  *\r
83  */\r
84 extern void pit_disable_it(void);\r
85 \r
86 /**\r
87  * \brief Returns the value of the PIT mode register.\r
88  *\r
89  * \return PIT_MR value.\r
90  */\r
91 extern uint32_t pit_get_mode(void);\r
92 \r
93 /**\r
94  * \brief Returns the value of the PIT status register, clearing it as\r
95  * a side effect.\r
96  *\r
97  * \return PIT_SR value.\r
98  */\r
99 extern uint32_t pit_get_status(void);\r
100 \r
101 /**\r
102  * \brief Returns the value of the PIT Image Register, to read PICNT\r
103  *  and CPIV without clearing the current values.\r
104  *\r
105  * \return PIT_PIIR value.\r
106  */\r
107 extern uint32_t pit_get_piir(void);\r
108 \r
109 /**\r
110  * \brief Returns the value of the PIT Value Register, clearing it as\r
111  * a side effect.\r
112  *\r
113  * \return PITC_PIVR value.\r
114  */\r
115 extern uint32_t pit_get_pivr(void);\r
116 \r
117 #ifdef __cplusplus\r
118 }\r
119 #endif\r
120 \r
121 #endif  /* #ifndef _PIT_H_ */\r