libnds
Loading...
Searching...
No Matches
Functions
system_counter.h File Reference

Contains a system tick counter that can be used by other parts of libnds and other libraries and user code. More...

#include <nds/ndstypes.h>
#include <nds/timers.h>

Functions

uint64_t systemCounterGetTicks (void)
 This gets the current value of the system tick counter.
 
static u32 systemCounterMsecsToTicks (u32 ms)
 Converts milliseconds to system counter ticks.
 
void systemCounterSetup (void)
 Initializes the system tick counter using a timer.
 
static u32 systemCounterTicksToMsec (u32 ticks)
 Converts system counter ticks to milliseconds.
 
static u32 systemCounterTicksToUsec (u32 ticks)
 Converts system counter ticks to microseconds.
 
static u32 systemCounterUsecsToTicks (u32 us)
 Converts microseconds to system counter ticks.
 

Detailed Description

Contains a system tick counter that can be used by other parts of libnds and other libraries and user code.

Function Documentation

◆ systemCounterGetTicks()

uint64_t systemCounterGetTicks ( void  )

This gets the current value of the system tick counter.

Returns
A 64-bit value with the number of ticks.

◆ systemCounterMsecsToTicks()

static u32 systemCounterMsecsToTicks ( u32  ms)
inlinestatic

Converts milliseconds to system counter ticks.

Parameters
msNumber of milliseconds.
Returns
Number of ticks.

◆ systemCounterSetup()

void systemCounterSetup ( void  )

Initializes the system tick counter using a timer.

It uses the timer with index LIBNDS_TIMER_TICK_COUNTER.

◆ systemCounterTicksToMsec()

static u32 systemCounterTicksToMsec ( u32  ticks)
inlinestatic

Converts system counter ticks to milliseconds.

Parameters
ticksNumber of ticks.
Returns
Number of milliseconds.

◆ systemCounterTicksToUsec()

static u32 systemCounterTicksToUsec ( u32  ticks)
inlinestatic

Converts system counter ticks to microseconds.

Parameters
ticksNumber of ticks.
Returns
Number of microseconds.

◆ systemCounterUsecsToTicks()

static u32 systemCounterUsecsToTicks ( u32  us)
inlinestatic

Converts microseconds to system counter ticks.

Parameters
usNumber of microseconds.
Returns
Number of ticks.