RISC-V MCU中文社区

问题帖:关于0xd1000000地址指向问题

oomdy 发表于  2019-11-06 14:15:23

在看官方给的 GD32VF103V_EVAL_Demo_Suites > 01_GPIO_Running_Led 中涉及的获取1ms延时中

#define TIMER_CTRL_ADDR           0xd1000000


//延时函数
void delay_1ms(uint32_t count)  
{
    uint64_t start_mtime, delta_mtime;
uint64_t tmp = get_timer_value();
    do {
    start_mtime = get_timer_value();
    } while (start_mtime == tmp);   
    do {
    delta_mtime = get_timer_value() - start_mtime;
    }while(delta_mtime <(SystemCoreClock/4000.0 *count ));
}



uint32_t mtime_lo(void)
{
  return *(volatile uint32_t *)(TIMER_CTRL_ADDR + TIMER_MTIME);
}

uint32_t mtime_hi(void)
{
  return *(volatile uint32_t *)(TIMER_CTRL_ADDR + TIMER_MTIME + 4);
}
uint64_t get_timer_value()
{
  while (1) {
    uint32_t hi = mtime_hi();         //hi=high
    uint32_t lo = mtime_lo();     //lo=low
    if (hi == mtime_hi())
      return ((uint64_t)hi << 32) | lo;
  }
}


我想知道0xd1000000这个地址指向的寄存器以及配置说明
可是把user_manual和datasheet翻遍了也没找到
求大神能解答下


没有回答
按投票排序 | 按时间排序