summaryrefslogtreecommitdiffstats
path: root/firmware/target/mips/ingenic_jz47xx/kernel-jz4740.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/mips/ingenic_jz47xx/kernel-jz4740.c')
-rw-r--r--firmware/target/mips/ingenic_jz47xx/kernel-jz4740.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/kernel-jz4740.c b/firmware/target/mips/ingenic_jz47xx/kernel-jz4740.c
index dcfdfd6a38..431af490da 100644
--- a/firmware/target/mips/ingenic_jz47xx/kernel-jz4740.c
+++ b/firmware/target/mips/ingenic_jz47xx/kernel-jz4740.c
@@ -24,38 +24,26 @@
#include "kernel.h"
#include "jz4740.h"
-#define USE_RTC_CLOCK 0
void tick_start(unsigned int interval_in_ms)
{
- unsigned int tps = interval_in_ms;
unsigned int latch;
+
__cpm_start_tcu();
__tcu_stop_counter(0);
__tcu_disable_pwm_output(0);
- __tcu_stop_counter(1);
- __tcu_disable_pwm_output(1);
- __tcu_stop_counter(2);
- __tcu_disable_pwm_output(2);
- __tcu_clear_full_match_flag(2);
__tcu_mask_half_match_irq(0);
__tcu_unmask_full_match_irq(0);
-#if USE_RTC_CLOCK
- __tcu_select_rtcclk(0);
- __tcu_select_clk_div1(0);
- latch = (__cpm_get_rtcclk() + (tps>>1)) / tps;
-#else
__tcu_select_extalclk(0);
__tcu_select_clk_div4(0);
- latch = (JZ_EXTAL / 4 + (tps>>1)) / tps;
-#endif
+ latch = (JZ_EXTAL / 4 + (interval_in_ms>>1)) / interval_in_ms;
+
REG_TCU_TCNT(0) = 0;
REG_TCU_TDFR(0) = latch;
REG_TCU_TDHR(0) = latch;
- //REG_TCU_TDHR(0) = 0;
__tcu_clear_full_match_flag(0);
__tcu_start_counter(0);