clock.c

来自「realview22.rar」· C语言 代码 · 共 47 行

C
47
字号
/*
** Copyright (C) ARM Limited, 2002. All rights reserved.
*/

/* clock.c */

/*
** This implements a simple clocking mechanism on the Integrator platform
**
** It reads from the Real Time Clock that is present on the
** Integrator AP Motherboard.
**
** The reference counter ticks at 1Hz.
** this is very poor resolution, but is very simple to implement.
*/

/* 
** Define SCATTER_PERIP if the Core Module clock register locations are
** defined in a scatter file
*/

#ifdef SCATTER_PERIP

#include "intgrt_struct.h"
extern struct cm cm0;
extern struct rtc rtc0;
#define CM_REFCT  cm0.refct
#define RTC_DR    rtc0.DR

#else
#include "intgrt.h"
#endif


/* Return the current value from the Integrator reference clock */

unsigned ref_clock(void)
{
    return RTC_DR;
}

void init_clock(void)
{
    RTC_DR=0;        // Zero the Real Time Clock
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?