Files
retrobsd/sys/pic32/clock.c
Serge Vakulenko 585773955b Fix include paths in the kernel sources.
Max32 kernel successfully compiled with kconfig utility.
2015-08-31 00:21:41 -07:00

22 lines
517 B
C

/*
* Copyright (c) 1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#include <sys/param.h>
#include <machine/pic32mx.h>
/*
* Setup core timer for `hz' timer interrupts per second.
*/
void
clkstart()
{
unsigned count = mips_read_c0_register (C0_COUNT, 0);
mips_write_c0_register (C0_COMPARE, 0,
count + (CPU_KHZ * 1000 / HZ + 1) / 2);
IECSET(0) = 1 << PIC32_IRQ_CT;
}