guoxiaorong188的ChinaUnix博客
guoxiaorong188
全部博文(135)
块设备驱动(0)
网络设备驱动(0)
字符设备驱动(1)
驱动混杂(0)
MMC/SD/SDIO(2)
input 子系统(10)
alsa audio驱动(2)
TTY/Uart(3)
SPI(0)
USB(4)
I2C(2)
TCP/IP网络协议栈(10)
2012年(135)
iteakey
ccx_wz
小超hide
cynthia
浪花小雨
yangchao
风吹叶落
Pierkaso
老顽童熊
风鹏正举
ygw98290
zhangjie
分类:
2012-09-19 11:39:52
原文地址:UBOOT ADC 驱动流程 作者:iibull
static inline int xn_voltage_probe(struct xn_tool *tool) { int adc_value = 0; int i = 0; printf("\nVoltage Probe:\n"); gpio_set_pin(S3C_GPN5, S3C_GPN5_INP); gpio_pullup(S3C_GPN5, 0x2); if(gpio_get_value(S3C_GPN5) == 0) printf("EXTERNAL_POWER.......................................[YES]\n"); else printf("EXTERNAL_POWER.......................................[NO]\n");
while(i++ < 10){ adc_value = get_adc_i(1); printf("BATTERY_VOLTAGE......................................[%u mv]\n",(unsigned int)(adc_value * VOLTAGE_FACTOR));}
while(i++ < 10)
while
{ adc_value = get_adc_i(1);
{
printf("BATTERY_VOLTAGE......................................[%u mv]\n",(unsigned int)(adc_value * VOLTAGE_FACTOR));
}
wait_user_ack(tool); return 0; }
static inline int get_adc_i(int channel) { volatile S3C2410_ADC * reg_adc = S3C2410_GetBase_ADC(); reg_adc->ADCCON = (1<<14) | (49<< 6) | (channel<<3); reg_adc->ADCDLY = 40000; reg_adc->ADCCON |= (1 << 0); while(reg_adc->ADCCON & 0x1); while (!(reg_adc->ADCCON & (1 << 15))); return (0x3ff & reg_adc->ADCDAT0); }
上一篇:UBOOT 网口测试
下一篇:UBOOT 键盘防抖测试
登录 注册