1 /* 2 * Assembly Macros For MIPS 3 * 4 * Copyright (c) 2006-2021, RT-Thread Development Team 5 * 6 * SPDX-License-Identifier: Apache-2.0 7 * 8 * Change Logs: 9 * Date Author Notes 10 * 2019-12-04 Jiaxun Yang Initial version 11 */ 12 13 #include <rtthread.h> 14 #include <rthw.h> 15 #include <mips.h> 16 #include <board.h> 17 18 /** 19 * This is the timer interrupt service routine. 20 */ rt_hw_timer_handler(void)21void rt_hw_timer_handler(void) 22 { 23 unsigned int count; 24 25 count = read_c0_compare(); 26 write_c0_compare(count); 27 write_c0_count(0); 28 29 /* increase a OS tick */ 30 rt_tick_increase(); 31 } 32 33 /** 34 * This function will initial OS timer 35 */ rt_hw_timer_init(void)36void rt_hw_timer_init(void) 37 { 38 write_c0_compare(CPU_HZ/2/RT_TICK_PER_SECOND); 39 write_c0_count(0); 40 mips_unmask_cpu_irq(7); 41 } 42