浏览代码

add soc timer cntpct

bigmagic 5 年之前
父节点
当前提交
efbb5490d7
共有 2 个文件被更改,包括 16 次插入0 次删除
  1. 2 0
      bsp/raspberry-pi/raspi3-64/driver/board.c
  2. 14 0
      libcpu/aarch64/cortex-a53/context_gcc.S

+ 2 - 0
bsp/raspberry-pi/raspi3-64/driver/board.c

@@ -25,6 +25,8 @@ static rt_uint64_t timerStep;
 
 int rt_hw_get_gtimer_frq(void);
 void rt_hw_set_gtimer_val(rt_uint64_t value);
+int rt_hw_get_gtimer_val(void);
+int rt_hw_get_cntpct_val(void);
 void rt_hw_gtimer_enable(void);
 
 void core0_timer_enable_interrupt_controller()

+ 14 - 0
libcpu/aarch64/cortex-a53/context_gcc.S

@@ -25,6 +25,20 @@ rt_hw_set_gtimer_val:
 	MSR CNTP_TVAL_EL0,X0
 	RET
 
+/*
+ *get gtimer CNTP_TVAL_EL0 value
+ */
+.globl rt_hw_get_gtimer_val
+rt_hw_get_gtimer_val:
+	MRS X0,CNTP_TVAL_EL0
+	RET
+
+
+.globl rt_hw_get_cntpct_val
+rt_hw_get_cntpct_val:
+	MRS X0, CNTPCT_EL0
+	RET
+
 /*
  *get gtimer frq value
  */