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

📄 timeout.c

📁 AT91RM9200的USB host和USB device的代码ADS1.2. USB-Device测试程序: 因为程序运行在SDRAM中
💻 C
字号:
//*----------------------------------------------------------------------------
//*         ATMEL Microcontroller Software Support  -  ROUSSET  -
//*----------------------------------------------------------------------------
//* The software is delivered "AS IS" without warranty or condition of any
//* kind, either express, implied or statutory. This includes without
//* limitation any warranty or condition with respect to merchantability or
//* fitness for any particular purpose, or against the infringements of
//* intellectual property rights of others.
//*----------------------------------------------------------------------------
//* File Name           : timeout.h
//* Object              : 2 simple routines to handle timeout using AT91C_ST_CRTR register 
//* Creation            : ODi   01/06/2003
//*
//*----------------------------------------------------------------------------
#include "AT91RM9200.h"
#include "lib_AT91RM9200.h"
#include "timeout.h"

//*----------------------------------------------------------------------------
//* \fn    AT91F_InitTimeout
//* \brief Start a timeout
//*----------------------------------------------------------------------------
void AT91F_InitTimeout(AT91PS_TIMEOUT pTimeout, unsigned int second)
{
	pTimeout->tick = *(AT91C_ST_CRTR);
	pTimeout->second = second;
}
//*----------------------------------------------------------------------------
//* \fn    AT91F_TestTimeout
//* \brief Test a timeout, return 0 if the timeout is not reached
//*----------------------------------------------------------------------------
int AT91F_TestTimeout(AT91PS_TIMEOUT pTimeout)
{
	if ((pTimeout->tick != *(AT91C_ST_CRTR)) && (pTimeout->second != 0)) {
		pTimeout->tick = *(AT91C_ST_CRTR);
		--(pTimeout->second);
	}
	return pTimeout->second;
}

⌨️ 快捷键说明

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