ad.h

来自「ucos-II+移植到arm+s3c2410的全套代码」· C头文件 代码 · 共 51 行

H
51
字号
/***************************************************************************\
	Copyright (c) 2004-2007 threewater@up-tech.com, All rights reserved.
	by threewter	2004.4.26
\***************************************************************************/
	

/***************************************************************************\
    #说明: s3c2410 AD函数头文件定义
	----------------------------------  Bug  --------------------------------------

	----------------------------------  TODO list  ----------------------------------

	----------------------------------修正--------------------------------------
	2004-11-4	创建,测试通过

	----------------------------------使用说明--------------------------------

\***************************************************************************/
#ifndef __AD_H__
#define __AD_H__

#include "../inc/drv/reg2410.h"

#define ADCCR_ACCPD			0x80
#define ADCCR_DIRECTC		0x40
#define ADCCR_WAIT2CLK		(0x1<<2)
#define ADCCR_WAIT4CLK		(0x2<<2)
#define ADCCR_EDGE			(0x3<<2)
#define ADCCR_SOP			0x2
#define ADCCR_LONGCAL		1

#define rADCCON		(*(volatile unsigned *)0x58000000)
#define rADCDAT0	(*(volatile unsigned *)0x5800000C)
#define PRSCVL (49<<6)
#define ADCCON_ENABLE_START (0x1)
#define STDBM (0x0<<2)
#define PRSCEN (0x1<<14)

#define ADCDIRCR_AIOSTOP	(1<<7)
#define ADCDIRCR_ADIN(n)		(1<<n)

//#define init_ADdevice()	do{rADCCR=ADCCR_DIRECTC;}while(0)
//#define init_ADdevice() do{rADCCON=(PRSCVL|ADCCON_ENABLE_START|STDBM|PRSCEN);}while(0);
//int AD_GetResult(int channel);
void init_ADdevice();
int GetADresult(int channel); 
void AD_test(void);

#endif
/* 陈文华改动过*/

⌨️ 快捷键说明

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