blob: a0f1ac81256c0c2dbf03aa222f1533e7edb29ad9 [file] [log] [blame]
Kévin Redon69b92d92019-01-24 16:39:20 +01001/**
2 * \file
3 *
4 * \brief Delay related functionality declaration.
5 *
6 * Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
7 *
8 * \asf_license_start
9 *
10 * \page License
11 *
12 * Subject to your compliance with these terms, you may use Microchip
13 * software and any derivatives exclusively with Microchip products.
14 * It is your responsibility to comply with third party license terms applicable
15 * to your use of third party software (including open source software) that
16 * may accompany Microchip software.
17 *
18 * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
19 * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
20 * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
21 * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
22 * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
23 * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
24 * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
25 * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
26 * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
27 * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
28 * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
29 *
30 * \asf_license_stop
31 *
32 */
33
34#ifndef _HPL_DELAY_H_INCLUDED
35#define _HPL_DELAY_H_INCLUDED
36
37/**
38 * \addtogroup HPL Delay
39 *
40 * \section hpl_delay_rev Revision History
41 * - v1.0.0 Initial Release
42 *
43 *@{
44 */
45
46#ifndef _UNIT_TEST_
47#include <compiler.h>
48#endif
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
54/**
55 * \name HPL functions
56 */
57//@{
58
59/**
60 * \brief Initialize delay functionality
61 *
62 * \param[in] hw The pointer to hardware instance
63 */
64void _delay_init(void *const hw);
65
66/**
67 * \brief Retrieve the amount of cycles to delay for the given amount of us
68 *
69 * \param[in] us The amount of us to delay for
70 *
71 * \return The amount of cycles
72 */
73uint32_t _get_cycles_for_us(const uint16_t us);
74
75/**
76 * \brief Retrieve the amount of cycles to delay for the given amount of ms
77 *
78 * \param[in] ms The amount of ms to delay for
79 *
80 * \return The amount of cycles
81 */
82uint32_t _get_cycles_for_ms(const uint16_t ms);
83
84/**
85 * \brief Delay loop to delay n number of cycles
86 *
87 * \param[in] hw The pointer to hardware instance
88 * \param[in] cycles The amount of cycles to delay for
89 */
90void _delay_cycles(void *const hw, uint32_t cycles);
91//@}
92
93#ifdef __cplusplus
94}
95#endif
96/**@}*/
97#endif /* _HPL_DELAY_H_INCLUDED */