1 //*****************************************************************************
2 //
3 //! @file am_util_delay.h
4 //!
5 //! @brief A few useful delay functions.
6 //!
7 //! Functions for fixed delays.
8 //!
9 //! @addtogroup delay Delay Functionality
10 //! @ingroup utils
11 //! @{
12 //
13 //*****************************************************************************
14 
15 //*****************************************************************************
16 //
17 // Copyright (c) 2023, Ambiq Micro, Inc.
18 // All rights reserved.
19 //
20 // Redistribution and use in source and binary forms, with or without
21 // modification, are permitted provided that the following conditions are met:
22 //
23 // 1. Redistributions of source code must retain the above copyright notice,
24 // this list of conditions and the following disclaimer.
25 //
26 // 2. Redistributions in binary form must reproduce the above copyright
27 // notice, this list of conditions and the following disclaimer in the
28 // documentation and/or other materials provided with the distribution.
29 //
30 // 3. Neither the name of the copyright holder nor the names of its
31 // contributors may be used to endorse or promote products derived from this
32 // software without specific prior written permission.
33 //
34 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
35 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
36 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
37 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
38 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
39 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
40 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
41 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
42 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
43 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
44 // POSSIBILITY OF SUCH DAMAGE.
45 //
46 // This is part of revision release_sdk_4_4_0-3c5977e664 of the AmbiqSuite Development Package.
47 //
48 //*****************************************************************************
49 #ifndef AM_UTIL_DELAY_H
50 #define AM_UTIL_DELAY_H
51 
52 #ifdef __cplusplus
53 extern "C"
54 {
55 #endif
56 
57 //*****************************************************************************
58 //
59 // External function definitions
60 //
61 //*****************************************************************************
62 
63 //*****************************************************************************
64 //
65 //! @brief Delays for a desired amount of loops.
66 //!
67 //! This function will delay for a number of cycle loops.
68 //!
69 //! @note - the number of cycles each loops takes to execute is approximately 3.
70 //! Therefore the actual number of cycles executed will be ~3x ui32Iterations.
71 //!
72 //! For example, a ui32Iterations value of 100 will delay for 300 cycles.
73 //!
74 //! @param ui32Iterations - Desired number of cycle loops to delay for.
75 //
76 //*****************************************************************************
77 extern void am_util_delay_cycles(uint32_t ui32Iterations);
78 
79 //*****************************************************************************
80 //
81 //! @brief Delays for a desired amount of milliseconds.
82 //!
83 //! This function will delay for a number of milliseconds.
84 //!
85 //! @param ui32MilliSeconds - number of milliseconds to delay for.
86 //
87 //*****************************************************************************
88 extern void am_util_delay_ms(uint32_t ui32MilliSeconds);
89 
90 //*****************************************************************************
91 //
92 //! @brief Delays for a desired amount of microseconds.
93 //!
94 //! This function will delay for a number of microseconds.
95 //!
96 //! @param ui32MicroSeconds - number of microseconds to delay for.
97 //
98 //*****************************************************************************
99 extern void am_util_delay_us(uint32_t ui32MicroSeconds);
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
105 #endif // AM_UTIL_DELAY_H
106 
107 //*****************************************************************************
108 //
109 // End Doxygen group.
110 //! @}
111 //
112 //*****************************************************************************
113 
114