ISSDK  1.7
IoT Sensing Software Development Kit
systick_utils.h
Go to the documentation of this file.
1 /*
2  * The Clear BSD License
3  * Copyright (c) 2016, Freescale Semiconductor, Inc.
4  * Copyright 2016-2017 NXP
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without modification,
8  * are permitted (subject to the limitations in the disclaimer below) provided
9  * that the following conditions are met:
10  *
11  * o Redistributions of source code must retain the above copyright notice, this list
12  * of conditions and the following disclaimer.
13  *
14  * o Redistributions in binary form must reproduce the above copyright notice, this
15  * list of conditions and the following disclaimer in the documentation and/or
16  * other materials provided with the distribution.
17  *
18  * o Neither the name of the copyright holder nor the names of its
19  * contributors may be used to endorse or promote products derived from this
20  * software without specific prior written permission.
21  *
22  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
27  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
30  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 /**
36  * @file systick_utils.h
37  * @brief ARM Systick Utilities.
38 
39  This file provides systick based counts for the developer
40  to get cycle counts for measuring time delays.
41 */
42 
43 #ifndef __SYSTICK_UTILS_H__
44 #define __SYSTICK_UTILS_H__
45 
46 /*! @brief Function to enable systicks framework.
47  * @details This function initializes the CMSIS define ARM core specific systick implementation.
48  * @param[in] void.
49  * @return void.
50  * @constraints This should be the first function to be invoked before other Systick APIs.
51  * @reeentrant Yes
52  */
53 void BOARD_SystickEnable(void);
54 
55 /*! @brief Function to Record the Start systick.
56  * @details This function records the current systick count for other APIs to compute difference.
57  * @param[in] pStart Pointer to the variable to store the current/start systick.
58  * @return void.
59  * @constraints None.
60  * @reeentrant Yes
61  */
62 void BOARD_SystickStart(int32_t *pStart);
63 
64 /*! @brief Function to compute the Elapsed systicks.
65  * @details This function computes the elapsed ticks by getting the difference
66  * of the current tick to the one in the arguement.
67  * @param[in] pStart Pointer to the variable contating the start systick.
68  * @return int32_t The elapsed systicks.
69  * @constraints None.
70  * @reeentrant Yes
71  */
73 
74 /*! @brief Function to compute the Elapsed Time.
75  * @details This function computes the elapsed Time in micro seconds by getting the difference
76  * of the current tick to the one in the arguement.
77  * It also updates the start tick to the current systick.
78  * @param[in] pStart Pointer to the variable contating the start systick.
79  * @return uint32_t The elapsed Time in micro seconds.
80  * @constraints None.
81  * @reeentrant Yes
82  */
83 uint32_t BOARD_SystickElapsedTime_us(int32_t *pStart);
84 
85 /*! @brief Function to insert delays.
86  * @details This function blocks for the specified milli seconds by using the elapsed systicks
87  * to determine time delays.
88  * @param[in] delay_ms The required time to block.
89  * @return void.
90  * @constraints None.
91  * @reeentrant Yes
92  */
93 void BOARD_DELAY_ms(uint32_t delay_ms);
94 
95 #endif // __SYSTICK_UTILS_H__
void BOARD_SystickStart(int32_t *pStart)
Function to Record the Start systick.
Definition: systick_utils.c:79
uint32_t BOARD_SystickElapsedTime_us(int32_t *pStart)
Function to compute the Elapsed Time.
Definition: systick_utils.c:99
void BOARD_SystickEnable(void)
Function to enable systicks framework.
Definition: systick_utils.c:70
int32_t BOARD_SystickElapsedTicks(int32_t *pStart)
Function to compute the Elapsed systicks.
Definition: systick_utils.c:87
typedef int32_t(DATA_FORMAT_Append_t))(void *pData
The interface function to append the data on the formated stream.
void BOARD_DELAY_ms(uint32_t delay_ms)
Function to insert delays.