ISSDK  1.7
IoT Sensing Software Development Kit
Macros | Functions | Variables
systick_utils.c File Reference

Encapsulates the ARM sysTick counter, which is used for computing delays. ARM-core specific function that enables the ARM systick timer on Kinetis uCs. the timer is 24 bit so allows measurement of intervals up to 2^24/CORE_SYSTICK_HZ secs=0.35s for a 48MHz uC. More...

#include "issdk_hal.h"
Include dependency graph for systick_utils.c:

Go to the source code of this file.

Macros

#define SYST_CSR   SysTick->CTRL
 
#define SYST_RVR   SysTick->LOAD
 
#define SYST_CVR   SysTick->VAL
 

Functions

void SysTick_Handler (void)
 
uint32_t SysTick_GetOVFCount (void)
 
void BOARD_SystickEnable (void)
 Function to enable systicks framework. More...
 
void BOARD_SystickStart (int32_t *pStart)
 Function to Record the Start systick. More...
 
int32_t BOARD_SystickElapsedTicks (int32_t *pStart)
 Function to compute the Elapsed systicks. More...
 
uint32_t BOARD_SystickElapsedTime_us (int32_t *pStart)
 Function to compute the Elapsed Time. More...
 
void BOARD_DELAY_ms (uint32_t delay_ms)
 Function to insert delays. More...
 

Variables

uint32_t g_ovf_stamp
 
volatile uint32_t g_ovf_counter = 0
 

Detailed Description

Encapsulates the ARM sysTick counter, which is used for computing delays. ARM-core specific function that enables the ARM systick timer on Kinetis uCs. the timer is 24 bit so allows measurement of intervals up to 2^24/CORE_SYSTICK_HZ secs=0.35s for a 48MHz uC.

Definition in file systick_utils.c.

Macro Definition Documentation

◆ SYST_CSR

#define SYST_CSR   SysTick->CTRL

Definition at line 45 of file systick_utils.c.

Referenced by BOARD_SystickEnable().

◆ SYST_CVR

#define SYST_CVR   SysTick->VAL

Definition at line 47 of file systick_utils.c.

Referenced by BOARD_SystickElapsedTicks(), and BOARD_SystickStart().

◆ SYST_RVR

#define SYST_RVR   SysTick->LOAD

Definition at line 46 of file systick_utils.c.

Referenced by BOARD_SystickElapsedTicks(), and BOARD_SystickEnable().

Function Documentation

◆ BOARD_DELAY_ms()

void BOARD_DELAY_ms ( uint32_t  delay_ms)

Function to insert delays.

This function blocks for the specified milli seconds by using the elapsed systicks to determine time delays.

Parameters
[in]delay_msThe required time to block.
Returns
void.
Constraints:
None. Yes

Definition at line 116 of file systick_utils.c.

References BOARD_SystickElapsedTicks(), BOARD_SystickStart(), and int32_t().

Referenced by ADS_DetectShield(), ADS_MMA9553Query(), DIFF_P_I2C_Initialize(), DIFF_P_SPI_Initialize(), FXLC95000_SPI_Initialize(), FXLS8962_I2C_DeInit(), FXLS8962_SPI_Deinit(), MMA9553_I2C_Initialize(), MMA9553_SPI_Initialize(), Sensor_I2C_BlockWrite(), and Sensor_SPI_BlockWrite().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BOARD_SystickElapsedTicks()

int32_t BOARD_SystickElapsedTicks ( int32_t pStart)

Function to compute the Elapsed systicks.

This function computes the elapsed ticks by getting the difference of the current tick to the one in the arguement.

Parameters
[in]pStartPointer to the variable contating the start systick.
Returns
int32_t The elapsed systicks.
Constraints:
None. Yes

Definition at line 87 of file systick_utils.c.

References g_ovf_stamp, int32_t(), SYST_CVR, SYST_RVR, and SysTick_GetOVFCount().

Referenced by BOARD_DELAY_ms(), and BOARD_SystickElapsedTime_us().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BOARD_SystickElapsedTime_us()

uint32_t BOARD_SystickElapsedTime_us ( int32_t pStart)

Function to compute the Elapsed Time.

This function computes the elapsed Time in micro seconds by getting the difference of the current tick to the one in the arguement. It also updates the start tick to the current systick.

Parameters
[in]pStartPointer to the variable contating the start systick.
Returns
uint32_t The elapsed Time in micro seconds.
Constraints:
None. Yes

Definition at line 99 of file systick_utils.c.

References BOARD_SystickElapsedTicks(), and BOARD_SystickStart().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BOARD_SystickEnable()

void BOARD_SystickEnable ( void  )

Function to enable systicks framework.

This function initializes the CMSIS define ARM core specific systick implementation.

Parameters
[in]void.
Returns
void.
Constraints:
This should be the first function to be invoked before other Systick APIs. Yes

Definition at line 70 of file systick_utils.c.

References SYST_CSR, and SYST_RVR.

Referenced by main().

Here is the caller graph for this function:

◆ BOARD_SystickStart()

void BOARD_SystickStart ( int32_t pStart)

Function to Record the Start systick.

This function records the current systick count for other APIs to compute difference.

Parameters
[in]pStartPointer to the variable to store the current/start systick.
Returns
void.
Constraints:
None. Yes

Definition at line 79 of file systick_utils.c.

References g_ovf_stamp, SYST_CVR, and SysTick_GetOVFCount().

Referenced by BOARD_DELAY_ms(), BOARD_SystickElapsedTime_us(), main(), and process_host_command().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SysTick_GetOVFCount()

uint32_t SysTick_GetOVFCount ( void  )

Definition at line 60 of file systick_utils.c.

References g_ovf_counter.

Referenced by BOARD_SystickElapsedTicks(), and BOARD_SystickStart().

Here is the caller graph for this function:

◆ SysTick_Handler()

void SysTick_Handler ( void  )

Definition at line 54 of file systick_utils.c.

References g_ovf_counter.

Variable Documentation

◆ g_ovf_counter

volatile uint32_t g_ovf_counter = 0

Definition at line 50 of file systick_utils.c.

Referenced by SysTick_GetOVFCount(), and SysTick_Handler().

◆ g_ovf_stamp

uint32_t g_ovf_stamp

Definition at line 49 of file systick_utils.c.

Referenced by BOARD_SystickElapsedTicks(), and BOARD_SystickStart().