⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ram_count.c

📁 oki67500系列arm工程例程源代码
💻 C
字号:
/**********************************************************************/
/*                                                                    */
/*    Copyright (C) 2003 Oki Electric Industry Co., LTD.              */
/*                                                                    */
/*    System Name    :  ML675001 series                               */
/*    Module Name    :  count up variable at internal RAM             */
/*    File   Name    :  ram_count.c                                   */
/*    Revision       :  01.00                                         */
/*    Date           :  2003/03/09  initial version                   */
/*                                                                    */
/**********************************************************************/

#include "ml675001.h"
#include "common.h"
#include "irq.h"

int ram_count(void);
extern void init_irq(void);         /* initialize IRQ */
extern void reg_irq_handler(void);  /* registration of IRQ handler */
extern void set_timer(void);        /* setup TIMER */
extern void timer_handler(void);    /* TIMER handler */

extern volatile int timer_flag;

/**********************************************************************/
/*  count up variable at internal RAM                                 */
/*  Function : ram_count                                              */
/*      Parameters                                                    */
/*          Input   :   Nothing                                       */
/*          Output  :   count up value                                */
/**********************************************************************/
int ram_count(void)
{
    int count;
    
    timer_flag = 0;
    count = 0;

    set_timer();
    irq_en();
    put_hvalue(TMEN, 0x01); /* enable timer */

    while(timer_flag == 0)
        count++;

    irq_dis();

    return count;
}

⌨️ 快捷键说明

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