NEORV32 Software Framework Documentation
The NEORV32 RISC-V Processor
Loading...
Searching...
No Matches
neorv32_gptmr.c File Reference

General purpose timer (GPTMR) HW driver source file. More...

#include <neorv32.h>

Functions

int neorv32_gptmr_available (void)
 
void neorv32_gptmr_setup (int prsc, uint32_t threshold, int cont_mode)
 
void neorv32_gptmr_disable (void)
 
void neorv32_gptmr_enable (void)
 
void neorv32_gptmr_irq_ack (void)
 

Detailed Description

General purpose timer (GPTMR) HW driver source file.

Note
These functions should only be used if the GPTMR unit was synthesized (IO_GPTMR_EN = true).
See also
https://stnolting.github.io/neorv32/sw/files.html

Function Documentation

◆ neorv32_gptmr_available()

int neorv32_gptmr_available ( void )

Check if general purpose timer unit was synthesized.

Returns
0 if GPTMR was not synthesized, 1 if GPTMR is available.

◆ neorv32_gptmr_disable()

void neorv32_gptmr_disable ( void )

Disable general purpose timer.

◆ neorv32_gptmr_enable()

void neorv32_gptmr_enable ( void )

Enable general purpose timer.

◆ neorv32_gptmr_irq_ack()

void neorv32_gptmr_irq_ack ( void )

Clear pending timer interrupt.

◆ neorv32_gptmr_setup()

void neorv32_gptmr_setup ( int prsc,
uint32_t threshold,
int cont_mode )

Reset, enable and configure general purpose timer.

Parameters
[in]prscClock prescaler select (0..7). See NEORV32_CLOCK_PRSC_enum.
[in]thresholdThreshold value, counter will reset to zero when reaching this.
[in]cont_modeSet to operate timer in continuous mode (instead of single-shot mode).