AM261x MCU+ SDK: APIs for timer setup and control

| AM261x MCU+ SDK 26.00.00 |

Data Structures | Functions | Macros
APIs for timer setup and control
APIs for Driver Porting Layer

## Introduction

This module define's generic APIs to configure and control a timer Depending on the SOC there can be different timer implementation's

For more details and example usage, see Timer

Timer is used by Clock to generate system ticks.

Currently below timer implementations are supported

- DM Timer (AM64x, AM243x)
- RTI Timer (AM263x, AM273x, AWR294x)

## Data Structures
struct | TimerP_Params
| Parameters for TimerP_setup. More...

## Functions
void | TimerP_Params_init (TimerP_Params *params)
| Set default value for TimerP_Params. More...
void | TimerP_setup (uint32_t baseAddr, TimerP_Params *params)
| Setup timer but does not start it. More...
void | TimerP_start (uint32_t baseAddr)
| Start timer. More...
void | TimerP_stop (uint32_t baseAddr)
| Stop timer. More...
uint32_t | TimerP_getCount (uint32_t baseAddr)
| Get timer current count. More...
uint32_t | TimerP_getReloadCount (uint32_t baseAddr)
| Get timer reload count. More...
void | TimerP_clearOverflowInt (uint32_t baseAddr)
| Clear timer overflow interrupt. More...
uint32_t | TimerP_isOverflowed (uint32_t baseAddr)
| Check if timer is overflowed. More...

## Macros
#define | TIME_IN_MICRO_SECONDS (1000000U)
#define | MAX_TIMER_COUNT_VALUE (0xFFFFFFFFU)
#define | TIME_IN_MILLI_SECONDS (1000U)
#define | TIME_IN_NANO_SECONDS (1000000000U)
#define | TIMERP_SHIFT_BY_EIGHT (8U)
#define | MAX_NUMBER_OF_CYCLES (0xFFFFFFFFU)
#define | MAX_NUMBER_OF_COUNT (0xFFFFFFFFU)

## Macro Definition Documentation

## ◆ TIME_IN_MICRO_SECONDS

#define TIME_IN_MICRO_SECONDS (1000000U)

Macro defines the time in micro seconds

## ◆ MAX_TIMER_COUNT_VALUE

#define MAX_TIMER_COUNT_VALUE (0xFFFFFFFFU)

Macro defines the maximum timer count value

## ◆ TIME_IN_MILLI_SECONDS

#define TIME_IN_MILLI_SECONDS (1000U)

Macro defines the time in milli seconds

## ◆ TIME_IN_NANO_SECONDS

#define TIME_IN_NANO_SECONDS (1000000000U)

Macro defines the time in nano seconds

## ◆ TIMERP_SHIFT_BY_EIGHT

#define TIMERP_SHIFT_BY_EIGHT (8U)

Macro defines the shift by eight

## ◆ MAX_NUMBER_OF_CYCLES

#define MAX_NUMBER_OF_CYCLES (0xFFFFFFFFU)

Macro defines the maximum number of cycles

## ◆ MAX_NUMBER_OF_COUNT

#define MAX_NUMBER_OF_COUNT (0xFFFFFFFFU)

Macro defines the maximum number of count

## Function Documentation

## ◆ TimerP_Params_init()

void TimerP_Params_init | ( | TimerP_Params * | params | ) |

Set default value for TimerP_Params.

Parameters

  params | [out] timer parameters initalized to default

## ◆ TimerP_setup()

void TimerP_setup | ( | uint32_t | baseAddr,
|  | TimerP_Params * | params
| ) |  |

Setup timer but does not start it.

Parameters

  baseAddr | [in] HW timer base addresss
  params | [in] timer parameters

## ◆ TimerP_start()

void TimerP_start | ( | uint32_t | baseAddr | ) |

Start timer.

Parameters

  baseAddr | [in] HW timer base addresss

## ◆ TimerP_stop()

void TimerP_stop | ( | uint32_t | baseAddr | ) |

Stop timer.

Parameters

  baseAddr | [in] HW timer base addresss

## ◆ TimerP_getCount()

uint32_t TimerP_getCount | ( | uint32_t | baseAddr | ) |

Get timer current count.

Parameters

  baseAddr | [in] HW timer base addresss

Returns
  current timer count value

## ◆ TimerP_getReloadCount()

uint32_t TimerP_getReloadCount | ( | uint32_t | baseAddr | ) |

Get timer reload count.

Parameters

  baseAddr | [in] HW timer base addresss

Returns
  reload count value

## ◆ TimerP_clearOverflowInt()

void TimerP_clearOverflowInt | ( | uint32_t | baseAddr | ) |

Clear timer overflow interrupt.

Parameters

  baseAddr | [in] HW timer base addresss

## ◆ TimerP_isOverflowed()

uint32_t TimerP_isOverflowed | ( | uint32_t | baseAddr | ) |

Check if timer is overflowed.

Note
  make sure to clear overflow status TimerP_clearOverflowInt

Parameters

  baseAddr | [in] HW timer base addresss