Skip to content

Commit

Permalink
Fixing timer
Browse files Browse the repository at this point in the history
  • Loading branch information
lupyuen committed Dec 25, 2023
1 parent 50e66d8 commit 57ea5f0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
14 changes: 12 additions & 2 deletions arch/risc-v/src/bl808/bl808_timerisr.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@
#include "riscv_percpu.h"
#include "hardware/bl808_memorymap.h"

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

#define MTIMER_FREQ 10000000

/****************************************************************************
* Private Data
****************************************************************************/
Expand Down Expand Up @@ -101,6 +107,10 @@ static int bl808_ssoft_interrupt(int irq, void *context, void *arg)

void up_timer_initialize(void)
{
irq_attach(RISCV_IRQ_SSOFT, bl808_ssoft_interrupt, NULL);
up_enable_irq(RISCV_IRQ_SSOFT);
struct oneshot_lowerhalf_s *lower = riscv_mtimer_initialize(
0, 0, RISCV_IRQ_STIMER, MTIMER_FREQ);

DEBUGASSERT(lower);

up_alarm_set_lowerhalf(lower);
}
8 changes: 4 additions & 4 deletions arch/risc-v/src/common/riscv_mtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
struct riscv_mtimer_lowerhalf_s
{
struct oneshot_lowerhalf_s lower;
uintptr_t mtime;
uintptr_t mtimecmp;
////uintptr_t mtime;
////uintptr_t mtimecmp;
uint64_t freq;
uint64_t alarm;
oneshot_callback_t callback;
Expand Down Expand Up @@ -325,8 +325,8 @@ riscv_mtimer_initialize(uintptr_t mtime, uintptr_t mtimecmp,
if (priv != NULL)
{
priv->lower.ops = &g_riscv_mtimer_ops;
priv->mtime = mtime;
priv->mtimecmp = mtimecmp;
////priv->mtime = mtime;
////priv->mtimecmp = mtimecmp;
priv->freq = freq;

riscv_mtimer_set_mtimecmp(priv, UINT64_MAX);
Expand Down

0 comments on commit 57ea5f0

Please sign in to comment.