avionic design with actual uboot and tooling
submodule of avionic design uboot bootloader and with included tools to get you started , read readme.md and readme-tk1-loader.md
This commit is contained in:
24
u-boot/arch/arc/lib/timer.c
Normal file
24
u-boot/arch/arc/lib/timer.c
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <asm/arcregs.h>
|
||||
|
||||
#define NH_MODE (1 << 1) /* Disable timer if CPU is halted */
|
||||
|
||||
int timer_init(void)
|
||||
{
|
||||
write_aux_reg(ARC_AUX_TIMER0_CTRL, NH_MODE);
|
||||
/* Set max value for counter/timer */
|
||||
write_aux_reg(ARC_AUX_TIMER0_LIMIT, 0xffffffff);
|
||||
/* Set initial count value and restart counter/timer */
|
||||
write_aux_reg(ARC_AUX_TIMER0_CNT, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long timer_read_counter(void)
|
||||
{
|
||||
return read_aux_reg(ARC_AUX_TIMER0_CNT);
|
||||
}
|
||||
Reference in New Issue
Block a user