RV32 SoC DS UG
High-Perf RV32 SoC DS UG
RV64 SoC DS UG API and Examples
Embedded IDE UG
Loading...
Searching...
No Matches
Clint Timer Driver

Overview

Core Local Interruptor (CLINT) driver.

This module provides functions to configure and control CLINT input/output and interrupt behavior.

Usage & Initialization.

This is an example show how to utilize API Functions and enable software interrupt using IRQ Controller Driver.

#include "irq.h"
static uint32_t counter = 0;
timerCmp += TIMER_TICK_DELAY;
clint_setCmp(timerCmp, 0);
printf(ANSI_YELLOW "Timer Interrupt Triggered!\n" ANSI_RESET);
return 1;
}
void isrInit(){
// Configure timer
initTimer();
}
#define ANSI_YELLOW
Yellow text.
Definition debug.h:113
#define ANSI_RESET
Reset to default color.
Definition debug.h:110
@ MSIP_ENABLE
Enable Software Interrupt *‍/.
Definition clint.h:100
void clint_setCmp(u64 cmp, u32 hart_id)
This function sets the compare value for the CLINT CMP register for a specific hardware thread.
Definition clint.c:56
void clint_setSoftInterrupt(clint_msip_t enable, u32 hart_id)
Sets the software interrupt state for a specific hart.
Definition clint.c:72
void trap_entry(void)
The Main Trap Entry Point (Naked).
Definition mtrap.c:129
int irq_handleTimer(void)
Handlers for CPU interrupts (Timer).
void irq_enable(void)
Enable Global Interrupts (MIE bit).
Definition irq.c:56
void irq_setType(cpu_irq_t enable)
Enable specific CPU interrupt sources.
Definition irq.c:76
void irq_setTrapVector(void(*trap_vector)(void))
Set the Machine Trap Vector (mtvec).
Definition irq.c:46
@ IRQ_TIMER
Definition irq.h:121
RISC-V Core Interrupt Handling and Vector Table.

This is an example show how to utilize API Functions and enable timer interrupt using IRQ Controller Driver.

#include "irq.h"
static uint32_t counter = 0;
timerCmp += TIMER_TICK_DELAY;
clint_setCmp(timerCmp, 0);
printf(ANSI_YELLOW "Timer Interrupt Triggered!\n" ANSI_RESET);
return 1;
}
void isrInit(){
// Configure timer
initTimer();
}
See also
Example CLINT Timer Interrupt Demo - Learn how to use the driver for timer interrupt operations

Topics

 API Functions
 Function definitions for CLINT driver.
 Data Structures
 Structs and Enums used by the driver.
 Data Types
 Enums used by the driver.