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

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

?? main.c

?? ADI 公司的DSP ADSP21369 EZ-KIT LITE開發板的全部源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
///////////////////////////////////////////////////////////////////////////////////////
//NAME:     main.c (AMD Parallel Flash Programmer)
//DATE:     01/26/06
//PURPOSE:  Program the Parallel Flash for the ADSP-21369 Ezkit
//
//USAGE:    This file contains the main code for programming the PP flash on the
//          ADSP-21369 Ezkit lite.
//
//          If more than one file is to be programmed, either include all files in the
//          same buffer (for contiguous location), or make sure that the files will not
//          occupy any common 64K sectors in the flash, as programming the subsequent
//          buffers will erase parts of the previously programmed buffers.
//
//          For the AMD Am29LV081B the sectors occupy the following byte addresses:
//          Sector                              Address Range
//          SA0                                 0x00000 - 0x0FFFF
//          SA1                                 0x10000 - 0x1FFFF
//          SA2                                 0x20000 - 0x2FFFF
//          SA3                                 0x30000 - 0x3FFFF
//          SA4                                 0x40000 - 0x4FFFF
//          SA5                                 0x50000 - 0x5FFFF
//          SA6                                 0x60000 - 0x6FFFF
//          SA7                                 0x70000 - 0x7FFFF
//          SA8                                 0x80000 - 0x8FFFF
//          SA9                                 0x90000 - 0x9FFFF
//          SA10                                0xA0000 - 0xAFFFF
//          SA11                                0xB0000 - 0xBFFFF
//          SA12                                0xC0000 - 0xCFFFF
//          SA13                                0xD0000 - 0xDFFFF
//          SA14                                0xE0000 - 0xEFFFF
//          SA15                                0xF0000 - 0xFFFFF
//
//
////////////////////////////////////////////////////////////////////////////////////////

#include <stdlib.h>				// malloc includes
#include <Services_Sharc.h>			// system services buffers
#include <adi_am29lv081b.h>		// flash-AM29LV081B includes
#include <util.h> 				// library struct includes
#include <Errors.h>				// error type includes

#ifdef __ADSP21369__
	#include <Cdef21369.h>
	#include <def21369.h>
	#define FLASH_START_ADDR	0x4000000  
	static char *pEzKitTitle = "ADSP-21369 EZ-KIT Lite";
	
#elif __ADSP21364__
	#define FLASH_START_ADDR	0x1000000
	static char *pEzKitTitle = "ADSP-21364 EZ-KIT Lite";

#elif __ADSP21262__
	#define FLASH_START_ADDR	0x1000000
	static char	*pEzKitTitle =	"ADSP-21262 EZ-KIT Lite";
	
#endif

#define BUFFER_SIZE			0x600

//Flash Programmer commands
typedef enum
{
	NO_COMMAND,		// 0
	GET_CODES,		// 1
	RESET,			// 2
	WRITE,			// 3
	FILL,			// 4
	ERASE_ALL,		// 5
	ERASE_SECT,		// 6
	READ,			// 7
	GET_SECTNUM,	// 8
	GET_SECSTARTEND,// 9
}enProgCmds;

//----- g l o b a l s -----//

char 			*AFP_Title ;						// EzKit info: ADSP-21369 EZ-KIT Lite
char 			*AFP_Description;					// Device Description: AMD AM29LV081B
char			*AFP_DeviceCompany;					// Device Company
char 			*AFP_DrvVersion		= "1.01.0";		// Driver Version
char			*AFP_BuildDate		= __DATE__;		// Driver Build Date
enProgCmds 		AFP_Command 		= NO_COMMAND;	// command sent down from the GUI
int 			AFP_ManCode 		= -1;			// 0x01 	= Atmel
int 			AFP_DevCode 		= -1;			// 0x38 	= AT49BV040
unsigned long 	AFP_Offset 			= 0x0;			// offset into flash
int 			*AFP_Buffer;						// buffer used to read and write flash
long 			AFP_Size 			= BUFFER_SIZE;	// buffer size
long 			AFP_Count 			= -1;			// count of locations to be read or written
long 			AFP_Stride 			= -1;			// stride used when reading or writing
int 			AFP_NumSectors 		= NUM_SECTORS;	// number of sectors in the flash device
int 			AFP_Sector 			= -1;			// sector number
int 			AFP_Error 			= 0;			// contains last error encountered
bool 			AFP_Verify 			= TRUE;		// verify writes or not
unsigned long 	AFP_StartOff 		= 0x0;			// sector start offset
unsigned long 	AFP_EndOff 			= 0x0;			// sector end offset
int				AFP_FlashWidth		= 0x8;			// width of the flash device
int 			*AFP_SectorInfo;

bool bExit = FALSE; 								//exit flag

//----- c o n s t a n t   d e f i n i t i o n s -----//

// structure for flash sector information

typedef struct _SECTORLOCATION
{
 	unsigned long ulStartOff;
	unsigned long ulEndOff;
}SECTORLOCATION;

SECTORLOCATION SectorInfo[NUM_SECTORS];


//----- f u n c t i o n   p r o t o t y p e s -----//

ERROR_CODE AllocateAFPBuffer(void);
ERROR_CODE GetSectorMap(void);
ERROR_CODE GetFlashInfo(void);
ERROR_CODE SetupForFlash(void);
ERROR_CODE FillData( unsigned long ulStart, long lCount, long lStride, int *pnData );
ERROR_CODE ReadData( unsigned long ulStart, long lCount, long lStride, int *pnData );
ERROR_CODE WriteData( unsigned long ulStart, long lCount, long lStride, int *pnData );
void FreeAFPBuffer(void);



//Declare the destination address in the flash of the file which is the flash start address
#define LDR_START_ADDR  0x4000000


//Declare a variable in SDRAM to hold the file data to program
section("seg_sdram") int ldr_source[] = {
                        #include "Core_Timer.ldr"
                             };

//------------- m a i n ( ) ----------------//


bool main(void )

{
	
	ERROR_CODE ErrorCode = 	NO_ERR; 		//return error code

	COMMAND_STRUCT CmdStruct;
		
    
		// open the device
		AFP_Error = ADIAM29LV081BEntryPoint.adi_pdd_Open(	NULL,		// DevMgr handle
							0,				// pdd entry point
							NULL,			// device instance
							NULL,			// client handle callback identifier
				  			ADI_DEV_DIRECTION_BIDIRECTIONAL,// data direction for this device
							NULL,			// DevMgr handle for this device
							NULL,			// handle to DmaMgr for this device
							NULL,			// handle to deferred callback service
							NULL );			// client's callback function

	// allocate AFP_Buffer
	if (( AFP_Error = AllocateAFPBuffer()) != NO_ERR)
		return FALSE;

	// get sector map
	if (( AFP_Error = GetSectorMap())!= NO_ERR)
		return FALSE;

		// setup the device so the DSP can access it
	if (SetupForFlash() != NO_ERR)
		return FALSE;

	// get flash manufacturer & device codes, title & desc
	if (( AFP_Error = GetFlashInfo()) != NO_ERR)
		return FALSE;

	// erase the entire flash	
	CmdStruct.SEraseAll.ulFlashStartAddr 	= FLASH_START_ADDR;	//FlashStartAddress
	AFP_Error = (ERROR_CODE) ADIAM29LV081BEntryPoint.adi_pdd_Control(NULL, CNTRL_ERASE_ALL, &CmdStruct );

			
 		// get manufacturer and device codes
	CmdStruct.SGetCodes.pManCode 			= (unsigned long *)&AFP_ManCode;	// Manufacturer Code
	CmdStruct.SGetCodes.pDevCode 			= (unsigned long *)&AFP_DevCode;	// Device Code
	CmdStruct.SGetCodes.ulFlashStartAddr 	= FLASH_START_ADDR;
	AFP_Error = (ERROR_CODE) ADIAM29LV081BEntryPoint.adi_pdd_Control(NULL, CNTRL_GET_CODES, &CmdStruct);
			

// Reset the Flash
	CmdStruct.SGetCodes.ulFlashStartAddr 	= FLASH_START_ADDR;
   AFP_Error = (ERROR_CODE) ADIAM29LV081BEntryPoint.adi_pdd_Control(NULL, CNTRL_RESET, &CmdStruct);
   

   AFP_Error = WriteData( 0, sizeof(ldr_source) , 1, ldr_source ); 
   
    // Clear the AFP_Buffer
	FreeAFPBuffer();

	// Close the Device
	AFP_Error = ADIAM29LV081BEntryPoint.adi_pdd_Close(NULL);

	return TRUE; 
   
}




//----------- A l l o c a t e A F P B u f f e r  ( ) ----------//
//
//  PURPOSE
//  	Allocate memory for the AFP_Buffer
//
// 	RETURN VALUE
//  	ERROR_CODE - value if any error occurs
//  	NO_ERR     - otherwise
//
// 	CHANGES
//  	9-28-2005 Created

ERROR_CODE AllocateAFPBuffer()
{

	ERROR_CODE ErrorCode = NO_ERR;	//return error code

	// by making AFP_Buffer as big as possible the plug-in can send and
	// receive more data at a time making the data transfer quicker
	//
	// by allocating it on the heap the compiler does not create an
	// initialized array therefore making the driver image smaller
	// and faster to load
	//
	// The linker description file (LDF) could be modified so that
	// the heap is larger, therefore allowing the BUFFER_SIZE to increase.
	AFP_Buffer = (int *)malloc(BUFFER_SIZE);

	// AFP_Buffer will be NULL if we could not allocate storage for the
	// buffer
	if ( AFP_Buffer == NULL )
	{
		// tell GUI that our buffer was not initialized
		ErrorCode = BUFFER_IS_NULL;
	}

	return(ErrorCode);
}


//----------- F r e e A F P B u f f e r  ( ) ----------//
//
//  PURPOSE
//  	Free the AFP_Buffer
//
// 	RETURN VALUE
//  	ERROR_CODE - value if any error occurs
//  	NO_ERR     - otherwise
//
// 	CHANGES
//  	9-28-2005 Created

void FreeAFPBuffer()
{
	// free the buffer if we were able to allocate one
	if ( AFP_Buffer )
		free( AFP_Buffer );

}



//----------- S e t u p F o r F l a s h ( ) ----------//
//
//  PURPOSE
// 		Perform necessary setup for the processor to talk to the
//		flash such as external memory interface registers, etc.
//
//  RETURN VALUE
//  	ERROR_CODE - value if any error occurs during Opcode scan
//  	NO_ERR     - otherwise

ERROR_CODE SetupForFlash()
{
#ifdef __ADSP21369__
	// setup EPCTL to use bank 2 (MS1) core accesses.
	*pEPCTL = (((*pEPCTL) & (~B1SD)) | EPBRCORE);

	// setup for max waitstates
	// NOTE:  The PKDIS bit is set which makes a 1 to 1 mapping, each 8 bit byte
	///       maps to an address.
	*pAMICTL1 = ( PKDIS | WS31 | HC1 | HC2 | RHC1 | RHC2 | IC7 | AMIEN | AMIFLSH);
		
#endif

	return NO_ERR;
}


//----------- G e t S e c t o r M a p  ( ) ----------//
//
//  PURPOSE
//  	Get the start and end offset for each sector in the flash.
//
// 	RETURN VALUE
//  	ERROR_CODE - value if any error occurs
//  	NO_ERR     - otherwise
//
// 	CHANGES
//  	9-28-2005 Created

ERROR_CODE GetSectorMap()
{

	ERROR_CODE ErrorCode = NO_ERR;			//return error code
	GET_SECTSTARTEND_STRUCT	SSectStartEnd;	//structure for GetSectStartEnd
	int i;									//index

	//initiate sector information structures
	for( i=0;i<AFP_NumSectors; i++)
	{
		SSectStartEnd.nSectorNum = i;
		SSectStartEnd.pStartOffset = &SectorInfo[i].ulStartOff;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久久久久一区 | 一区二区三区美女| 91视频在线观看| 亚洲激情一二三区| 欧美日韩国产在线播放网站| 午夜视频一区二区| 欧美tickle裸体挠脚心vk| 久久国产福利国产秒拍| 久久精品水蜜桃av综合天堂| 成人毛片老司机大片| 亚洲三级在线看| 欧美裸体一区二区三区| 免费黄网站欧美| 国产精品欧美一区喷水| 国产精品沙发午睡系列990531| 成人午夜精品在线| 亚洲黄色片在线观看| 欧美高清视频一二三区 | 欧美高清视频在线高清观看mv色露露十八 | 欧美激情一区二区三区蜜桃视频| 国产黄人亚洲片| 亚洲男人的天堂在线观看| 欧美日韩精品欧美日韩精品| 激情综合网av| 久久精品夜色噜噜亚洲a∨| 不卡av在线网| 亚洲成人动漫精品| 久久综合中文字幕| 日本韩国一区二区三区视频| 日韩国产高清影视| 欧美激情中文不卡| 欧美久久久久久久久中文字幕| 精品影院一区二区久久久| 国产精品每日更新| 日韩三级在线免费观看| 91丨九色porny丨蝌蚪| 男人的j进女人的j一区| 亚洲人成在线播放网站岛国| 欧美videos中文字幕| 色综合中文字幕国产 | 亚洲1区2区3区视频| 国产亚洲制服色| 欧美精品三级在线观看| 99精品欧美一区| 激情六月婷婷久久| 香蕉成人啪国产精品视频综合网| 国产精品免费丝袜| 国产精品女同一区二区三区| 在线免费观看日本欧美| 免费av成人在线| 亚洲欧美日韩一区二区 | www.成人在线| 精品一区二区在线视频| 亚洲网友自拍偷拍| 亚洲欧美一区二区三区孕妇| 国产欧美一区二区精品久导航| 欧美精品黑人性xxxx| 日本久久电影网| 成人av免费观看| 九九热在线视频观看这里只有精品| 亚洲一区二区免费视频| 亚洲视频一区二区在线| 国产精品丝袜久久久久久app| 日韩精品一区二区在线| 51午夜精品国产| 欧美日本乱大交xxxxx| 国产精品白丝jk白祙喷水网站| 色综合久久综合| 成人性生交大片免费看视频在线| 美女视频免费一区| 免费在线观看不卡| 日韩二区三区四区| 日韩精品电影在线观看| 午夜精品久久久久久久久久| 一区二区三区日韩精品| 亚洲精品乱码久久久久久久久| 国产精品不卡一区二区三区| 一区在线播放视频| 中文字幕一区二区在线观看| 中文字幕一区av| 亚洲男同1069视频| 亚洲欧美另类久久久精品2019| 亚洲欧美视频在线观看视频| 亚洲精品乱码久久久久久久久| 亚洲精品欧美激情| 无码av免费一区二区三区试看| 亚洲国产成人va在线观看天堂| 亚洲一区二区视频在线观看| 三级欧美韩日大片在线看| 蜜桃一区二区三区四区| 国产精品综合一区二区| 成人性视频免费网站| 97国产一区二区| 欧美日韩一区二区电影| 欧美一区二区视频在线观看2022 | 国产欧美日韩视频在线观看| 日本一二三不卡| 伊人色综合久久天天| 亚洲国产美女搞黄色| 蜜臀久久久久久久| 国产成人福利片| 欧日韩精品视频| 欧美一二三四在线| 欧美国产欧美综合| 亚洲午夜久久久久中文字幕久| 日韩高清在线一区| 国产风韵犹存在线视精品| 91网站在线观看视频| 欧美区在线观看| 国产欧美日韩久久| 亚洲综合免费观看高清完整版在线| 免费一级片91| 91在线观看成人| 9191国产精品| 中文字幕中文字幕一区| 日韩1区2区3区| 成人激情图片网| 91精品国产91久久久久久一区二区| 久久九九久久九九| 亚洲成人一区在线| 国产.欧美.日韩| 91精品国产麻豆国产自产在线| 欧美国产日本韩| 蜜桃91丨九色丨蝌蚪91桃色| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 久久久美女毛片| 亚洲二区视频在线| 成人美女视频在线观看| 日韩亚洲欧美高清| 亚洲免费毛片网站| 国产成人精品免费在线| 欧美一区二区三区免费| 亚洲欧美一区二区三区孕妇| 狠狠色丁香久久婷婷综| 欧美精三区欧美精三区| 亚洲桃色在线一区| 国产福利不卡视频| 日韩欧美在线影院| 亚洲一区二区三区在线| 成人高清av在线| 久久九九全国免费| 久久精品国产99国产精品| 欧洲一区二区av| 日韩美女视频一区| 成人免费观看av| 久久免费看少妇高潮| 日韩高清不卡在线| 日本精品裸体写真集在线观看| 欧美国产国产综合| 国产麻豆精品在线| 精品国产污污免费网站入口 | 久久精品国产亚洲a| 欧美视频在线一区| 亚洲激情校园春色| 色综合中文综合网| 国产精品天天摸av网| 狠狠色2019综合网| 精品日韩在线观看| 久久精品国产**网站演员| 337p亚洲精品色噜噜狠狠| 午夜婷婷国产麻豆精品| 欧美系列一区二区| 亚洲一区二区在线免费观看视频| 色综合视频一区二区三区高清| 国产精品高潮久久久久无| 岛国一区二区在线观看| 欧美极品aⅴ影院| 国产iv一区二区三区| 欧美高清在线一区| 99视频超级精品| 亚洲欧美乱综合| 欧美性大战xxxxx久久久| 亚洲国产精品自拍| 51精品秘密在线观看| 青青草97国产精品免费观看无弹窗版 | 欧美亚洲综合另类| 日日摸夜夜添夜夜添国产精品| 欧美精品亚洲一区二区在线播放| 日本视频一区二区三区| 精品精品欲导航| 国产成人8x视频一区二区| 国产精品护士白丝一区av| 国产精品色哟哟网站| 成人的网站免费观看| 亚洲自拍欧美精品| 91精品国产丝袜白色高跟鞋| 老司机精品视频一区二区三区| 欧美sm美女调教| 不卡的av电影| 亚洲国产精品自拍| 欧美成人a在线| eeuss鲁一区二区三区| 亚洲一二三专区| 日韩欧美第一区| av中文一区二区三区| 性做久久久久久免费观看| 久久影院午夜论| 一本一本大道香蕉久在线精品| 天堂在线亚洲视频| 国产欧美日韩中文久久|