1 /**
2  * \file
3  *
4  * \brief Delay related functionality declaration.
5  *
6  * Copyright (C) 2014 Atmel Corporation. All rights reserved.
7  *
8  * \asf_license_start
9  *
10  * \page License
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions are met:
14  *
15  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
16  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
17  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
18  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
19  * POSSIBILITY OF SUCH DAMAGE.
20  *
21  * \asf_license_stop
22  *
23  */
24 
25 #ifndef _HPL_DELAY_H_INCLUDED
26 #define _HPL_DELAY_H_INCLUDED
27 
28 /**
29  * \addtogroup HPL Delay
30  *
31  * \section hpl_delay_rev Revision History
32  * - v1.0.0 Initial Release
33  *
34  *@{
35  */
36 
37 #ifndef _UNIT_TEST_
38 #include <compiler.h>
39 #endif
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /**
46  * \name HPL functions
47  */
48 //@{
49 
50 /**
51  * \brief Initialize delay functionality
52  *
53  * \param[in] hw The pointer to hardware instance
54  */
55 void _delay_init(void *const hw);
56 
57 /**
58  * \brief Retrieve the amount of cycles to delay for the given amount of us
59  *
60  * \param[in] us The amount of us to delay for
61  *
62  * \return The amount of cycles
63  */
64 uint32_t _get_cycles_for_us(const uint16_t us);
65 
66 /**
67  * \brief Retrieve the amount of cycles to delay for the given amount of ms
68  *
69  * \param[in] ms The amount of ms to delay for
70  *
71  * \return The amount of cycles
72  */
73 uint32_t _get_cycles_for_ms(const uint16_t ms);
74 
75 /**
76  * \brief Delay loop to delay n number of cycles
77  *
78  * \param[in] hw The pointer to hardware instance
79  * \param[in] cycles The amount of cycles to delay for
80  */
81 void _delay_cycles(void *const hw, uint32_t cycles);
82 //@}
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 /**@}*/
88 #endif /* _HPL_DELAY_H_INCLUDED */
89