2019-12-07 00:55:46 +08:00
|
|
|
/*
|
|
|
|
* Assembly Macros For MIPS
|
|
|
|
*
|
2021-03-27 17:51:56 +08:00
|
|
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
2019-12-07 00:55:46 +08:00
|
|
|
*
|
|
|
|
* 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)
|
|
|
|
{
|
2021-03-27 17:51:56 +08:00
|
|
|
unsigned int count;
|
2019-12-07 00:55:46 +08:00
|
|
|
|
2021-03-27 17:51:56 +08:00
|
|
|
count = read_c0_compare();
|
|
|
|
write_c0_compare(count);
|
|
|
|
write_c0_count(0);
|
2019-12-07 00:55:46 +08:00
|
|
|
|
2021-03-27 17:51:56 +08:00
|
|
|
/* increase a OS tick */
|
|
|
|
rt_tick_increase();
|
2019-12-07 00:55:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This function will initial OS timer
|
|
|
|
*/
|
|
|
|
void rt_hw_timer_init(void)
|
|
|
|
{
|
2021-03-27 17:51:56 +08:00
|
|
|
write_c0_compare(CPU_HZ/2/RT_TICK_PER_SECOND);
|
|
|
|
write_c0_count(0);
|
|
|
|
mips_unmask_cpu_irq(7);
|
|
|
|
}
|