亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? cf.c

?? Hardware and firmware for a DSP based digital audio MP3 player with USB pen drive funtionality, usin
?? C
字號:
/*
 * DSPdap-bootloader - DSP based Digital Audio Player, Bootloader
 * Copyright (C) 2004-2007 Roger Quadros <rogerquads @ yahoo . com>
 * http://dspdap.sourceforge.net
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * $Id: CF.c,v 1.2 2007/06/03 08:54:03 Roger Exp $
 */

#include "CF.h"
#include "types.h"
#include "IO.h"	//for read_mem() and write_mem()

#define CF_DET 6		//CF detect on A6 pin
                                                           
#define CF_BUSY_TIMEOUT 100		//Count time to wait for CF to be not busy
#define CF_READY_TIMEOUT 100    //Count time to wait for CF to be ready
#define CF_DRQ_TIMEOUT 100      //Count time to wait for CF to request data

                                                           
static void delay()
{
	int i;
	for(i=0; i<0x7fff; i++)
	{
		asm("	nop");
	}
}   

int CF_IsPresent()
{
	int word;
	word = get_AGPIO();
	
	if(word & (1<<CF_DET))
		return 0;	//CF not present as CF_DET line is high
	else
		return 1;	
}

//provides a hardware reset to the CF card
void CF_HardReset()
{
	asm("	BCLR	XF");	//make XF low
	delay();		//wait for at least 25us

	asm("	BSET	XF");	//make XF high	
	delay();		//wait for at least 25us
	delay();		//wait for at least 25us
}


enum BUSY_STATUS CF_CheckBusyStatus()
{
	int timeout;

	for(timeout = 0; timeout < CF_BUSY_TIMEOUT; timeout++)
	{
		if(read_mem(STATUS_REG) & 0x80)
		{
			//CF still busy
			delay();				//wait in loop till timeout
		}
		else
		{
			return CF_NOT_BUSY;		//CF is not busy.. return immediately
		}
	}
	return CF_BUSY;
}

enum READY_STATUS CF_CheckReadyStatus()
{                  
	int timeout;

	for(timeout = 0; timeout < CF_READY_TIMEOUT; timeout++)
	{
		if(read_mem(STATUS_REG) & 0x40)
		{                            
			return CF_READY;	//CF is ready... return immediately
		}
		else
		{
			//CF not yet ready
			delay();				//wait in loop till timeout
		}
	}
	return CF_NOT_READY;
}

enum DRQ_STATUS CF_CheckDrqStatus()
{
	int timeout;

	for(timeout = 0; timeout < CF_DRQ_TIMEOUT; timeout++)
	{
		if(read_mem(STATUS_REG) & 0x08)
		{                            
			return CF_DRQ_SET;	//DRQ is set... return immediately
		}
		else
		{
			//DRQ not yet set
			delay();				//wait in loop till timeout
		}
	}
	return CF_DRQ_RESET;
}

//Following variables are used to issue ATA commands
//unsigned short Command_Value;
unsigned short Drive_Head_Val;      //LBA(27-24)
unsigned short Cyl_High_Val;		//LBA(23-16)
unsigned short Cyl_Low_Val;         //LBA(15-8)
unsigned short Sector_Num_Val;		//LBA(7-0)
//unsigned short Sector_Count_Val;
unsigned short Feature_Val;     

//Fills the ATA registers appropriately with the given physical sector addres
//and sector count and issues the command.
void CF_IssueCommand(unsigned long physicalSector, unsigned short sectorCount, unsigned short command)
{
	//Set ATA registers based on given Physical/LBA address
	Sector_Num_Val = physicalSector & 0xFF;	//get bits 7-0
	physicalSector >>= 8;
	Cyl_Low_Val = physicalSector & 0xFF;	//get bits 15-8
	physicalSector >>= 8;
	Cyl_High_Val = physicalSector & 0xFF;	//get bits 23-16
	physicalSector >>= 8;
	Drive_Head_Val = 0xE0;		//set LBA = 1, DRV = 0
	Drive_Head_Val |= physicalSector & 0xF;	//get bits 27-24
	
	//write into the ATA registers
	write_mem(SECTOR_NO_REG, Sector_Num_Val);
	write_mem(CYL_LOW_REG, Cyl_Low_Val);
	write_mem(CYL_HIGH_REG, Cyl_High_Val);
	write_mem(DRIVE_HEAD_REG, Drive_Head_Val);                        
	//sector count
	write_mem(SECTOR_CNT_REG, sectorCount);
	//command
	write_mem(COMMAND_REG, command);	
}


//executes the identify drive command. the data returned by compact flash 
//is stored in buffer.
int CF_IdentifyDrive(UI buffer[256])
{          
	int i;
	//check is CF is Not Busy
	if(CF_CheckBusyStatus() == CF_BUSY)
		return -1;	//error
	
	//check if CF is Ready
	if(CF_CheckReadyStatus() == CF_NOT_READY)
		return -1;	//error
				
	//CF is not Busy and is Ready so issue command
	CF_IssueCommand(0, 0, IDENTIFY_DRIVE_CMD);
	
	//check to see if CF DRQ is set	
	if(CF_CheckDrqStatus() == CF_DRQ_SET)
	{
		//yes. so read data (256 words) into buffer
		for(i=0; i<256; i++)
			buffer[i] = read_mem(DATA_REG);
			
		return 0;	//success
	}             
	else
		return -1;	//error
}

//reads the contents (256 words) of the given sector into buffer
int CF_ReadSector(unsigned long LBA_address, void* buffer)
{           
	//check is CF is Not Busy
	if(CF_CheckBusyStatus() == CF_BUSY)
		return -1;	//error
	
	//check if CF is Ready
	if(CF_CheckReadyStatus() == CF_NOT_READY)
		return -2;	//error
	
	//CF is not Busy and is Ready so issue command	
	CF_IssueCommand(LBA_address, 1, READ_SECTORS_CMD);

	//check to see if CF DRQ is set		
	if(CF_CheckDrqStatus() == CF_DRQ_SET)
	{
		//yes. so read data (256 words) into buffer
		read_sector(DATA_REG, buffer);		
		
		return 0;	//success
	}
	else
		return -3;	//error
}
 
//prepares for reading given number of sectors
int CF_ReadSectors(unsigned long LBA_address, unsigned short num_sectors)
{           
	//check is CF is Not Busy
	if(CF_CheckBusyStatus() == CF_BUSY)
		return -1;	//error
	
	//check if CF is Ready
	if(CF_CheckReadyStatus() == CF_NOT_READY)
		return -2;	//error
	
	//CF is not Busy and is Ready so issue command	
	CF_IssueCommand(LBA_address, num_sectors, READ_SECTORS_CMD);

	//actual reading of data will be performed by application if success
	//is returned by this function
	//waiting for DRQ will be done in read_sector()
	return 0; //success
}
 
//prepares for writing the given number of sectors
int CF_WriteSectors(unsigned long LBA_address, unsigned short num_sectors)
{           
	//check is CF is Not Busy
	if(CF_CheckBusyStatus() == CF_BUSY)
		return -1;	//error
	
	//check if CF is Ready
	if(CF_CheckReadyStatus() == CF_NOT_READY)
		return -2;	//error
	
	//CF is not Busy and is Ready so issue command	
	CF_IssueCommand(LBA_address, num_sectors, WRITE_SECTORS_CMD);


	//actual writing of data will be performed by application if success
	//is returned by this function		
	//waiting for DRQ will be done in write_sector()
	return 0; //success
}                                           

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本午夜一本久久久综合| 免费不卡在线视频| 精品国产免费人成电影在线观看四季 | 欧美午夜影院一区| 色婷婷综合视频在线观看| 91丨九色丨蝌蚪富婆spa| 99久久er热在这里只有精品15| 国产·精品毛片| 成人精品一区二区三区四区 | 国产精品一区二区久久不卡 | 亚洲九九爱视频| 夜夜精品浪潮av一区二区三区| 亚洲欧洲精品一区二区三区| 亚洲视频 欧洲视频| 一区二区三区日韩精品视频| 亚洲综合一区二区三区| 日韩激情一区二区| 黑人巨大精品欧美黑白配亚洲| 免费日韩伦理电影| 国产在线一区观看| 99在线视频精品| 欧美三级蜜桃2在线观看| 日韩无一区二区| 国产精品入口麻豆原神| 亚洲一区二区在线免费观看视频| 午夜精品福利一区二区三区蜜桃| 九九**精品视频免费播放| 国产xxx精品视频大全| 色94色欧美sute亚洲线路二 | 国精产品一区一区三区mba视频| 激情综合网激情| 91美女片黄在线观看91美女| 欧美日韩一区 二区 三区 久久精品| 日韩美女视频在线| 亚洲人成影院在线观看| 九九九久久久精品| 欧美亚洲尤物久久| 欧美激情一区三区| 日韩主播视频在线| 成人av中文字幕| 日韩欧美亚洲一区二区| 亚洲欧美色图小说| 国产精品一区一区三区| 欧美精品99久久久**| 国产精品视频一区二区三区不卡| 日韩av不卡一区二区| 91在线观看视频| 精品国产乱码久久久久久蜜臀| 亚洲在线观看免费| 成人丝袜高跟foot| 日韩精品影音先锋| 午夜精品久久久久| 97久久超碰国产精品| 久久久国产一区二区三区四区小说 | 欧美日本在线播放| 国产日本欧美一区二区| 日韩影院免费视频| 欧美在线制服丝袜| 中文字幕字幕中文在线中不卡视频| 久久精品国产在热久久| 精品视频免费看| 亚洲女人的天堂| 99热99精品| 国产精品国产三级国产有无不卡| 国产综合成人久久大片91| 欧美一级专区免费大片| 亚洲国产精品麻豆| 91国在线观看| 成人欧美一区二区三区黑人麻豆| 国产高清不卡一区二区| 国产午夜三级一区二区三| 久久电影网电视剧免费观看| 日韩视频一区二区在线观看| 三级在线观看一区二区| 69堂国产成人免费视频| 日韩精品五月天| 色老汉一区二区三区| 亚洲人成伊人成综合网小说| 色婷婷久久久亚洲一区二区三区 | 日本在线不卡视频| 欧美一区二区三区影视| 久久不见久久见免费视频7 | 色94色欧美sute亚洲线路一久| 国产精品久久久久一区| 91免费版pro下载短视频| 中文字幕日韩av资源站| 在线视频综合导航| 日日摸夜夜添夜夜添精品视频| 91精品国产手机| 国产一区二区三区在线看麻豆| 久久精品综合网| 91同城在线观看| 亚洲成av人片在线| 精品日韩一区二区三区免费视频| 久久精品国产99国产精品| 精品99久久久久久| 94-欧美-setu| 午夜精品福利在线| 欧美精品一区二区久久久 | 成人免费一区二区三区在线观看| eeuss鲁片一区二区三区| 亚洲麻豆国产自偷在线| 欧美一区二区三区日韩视频| 韩国av一区二区三区| 中文字幕亚洲在| 4438x亚洲最大成人网| 国产综合久久久久久久久久久久| 国产精品嫩草影院com| 欧美日韩一级视频| 国产99久久久国产精品潘金网站| 日韩毛片一二三区| 欧美大片免费久久精品三p| www.欧美精品一二区| 午夜视频一区二区三区| 国产亚洲精品超碰| 欧美性大战久久久久久久蜜臀| 蜜桃av一区二区在线观看 | 亚洲丰满少妇videoshd| 久久久国产一区二区三区四区小说 | 激情五月激情综合网| 亚洲精品高清在线观看| 久久久久久久久久美女| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 麻豆精品蜜桃视频网站| 一区二区三区在线看| 久久人人超碰精品| 91精品国产一区二区三区| 91亚洲精品久久久蜜桃网站| 国产激情视频一区二区在线观看| 亚洲成人自拍偷拍| 国产精品久久久久久久久久久免费看| 欧美亚洲综合一区| 国产999精品久久久久久| 视频一区二区中文字幕| 一区精品在线播放| 中文字幕欧美激情| 国产校园另类小说区| 欧美www视频| 欧美一区二区视频观看视频| 在线视频欧美精品| 色婷婷久久一区二区三区麻豆| 成人av网站大全| 成人在线视频首页| 成人性生交大片| 国产.欧美.日韩| 国产成人精品午夜视频免费| 韩国中文字幕2020精品| 精品一区免费av| 久草在线在线精品观看| 美女网站视频久久| 奇米色一区二区三区四区| 亚洲1区2区3区视频| 五月婷婷久久综合| 日韩精品亚洲专区| 看电影不卡的网站| 久久成人麻豆午夜电影| 久久99九九99精品| 国产成人免费在线| 成人黄页在线观看| 色综合久久88色综合天天免费| 91美女视频网站| 欧美年轻男男videosbes| 欧美肥大bbwbbw高潮| 日韩一区二区三免费高清| 日韩一卡二卡三卡四卡| 精品欧美一区二区在线观看| 2023国产一二三区日本精品2022| 久久久久久久综合| 国产精品美女久久久久久久网站| 亚洲视频狠狠干| 亚洲国产成人tv| 免费观看在线综合色| 国产精品一区免费视频| av一二三不卡影片| 欧美精品久久一区| 久久这里只有精品首页| 一区在线中文字幕| 三级在线观看一区二区| 国产一区二区在线电影| 在线观看一区二区精品视频| 欧美亚洲一区二区在线观看| 日韩午夜在线观看| 国产精品剧情在线亚洲| 亚洲电影你懂得| 国产精品资源在线| 99久久久精品| 91精品国产综合久久精品图片 | 国产一区二区三区香蕉| av不卡免费在线观看| 9191久久久久久久久久久| 久久久久国产精品麻豆ai换脸| 亚洲综合免费观看高清完整版在线 | 奇米精品一区二区三区四区 | 宅男在线国产精品| 亚洲国产高清不卡| 蜜臀久久久久久久| 91色porny在线视频| 精品国产sm最大网站| 亚洲午夜精品久久久久久久久| 国产美女精品人人做人人爽 |