diff options
Diffstat (limited to 'libcpu/mips/gs232/timer.c')
| -rw-r--r-- | libcpu/mips/gs232/timer.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/libcpu/mips/gs232/timer.c b/libcpu/mips/gs232/timer.c new file mode 100644 index 0000000000..8879b82ccf --- /dev/null +++ b/libcpu/mips/gs232/timer.c @@ -0,0 +1,41 @@ +/* + * Assembly Macros For MIPS + * + * Copyright (c) 2006-2019, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2019-12-04 Jiaxun Yang Initial version + */ + +#include <rtthread.h> +#include <rthw.h> +#include <mips.h> +#include <board.h> + +/** + * This is the timer interrupt service routine. + */ +void rt_hw_timer_handler(void) +{ + unsigned int count; + + count = read_c0_compare(); + write_c0_compare(count); + write_c0_count(0); + + /* increase a OS tick */ + rt_tick_increase(); +} + +/** + * This function will initial OS timer + */ +void rt_hw_timer_init(void) +{ + write_c0_compare(CPU_HZ/2/RT_TICK_PER_SECOND); + write_c0_count(0); + mips_unmask_cpu_irq(7); +}
\ No newline at end of file |
