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

📄 dm642main.c

📁 这是测试SEED-VPM642系统中第1通路的图像显示(U21)的程序。
💻 C
字号:
/********************************************************************/
/*  Copyright 2004 by SEED Incorporated.							*/
/*  All rights reserved. Property of SEED Incorporated.				*/
/*  Restricted rights to use, duplicate or disclose this code are	*/
/*  granted through contract.									    */
/*  															    */
/********************************************************************/
/*
 *---------dm642main.c---------
 * This example uses a timer to read and write the ESAM.
 */


#include <stdio.h>
#include <csl.h>
#include <std.h>
#include <csl_emifa.h>
#include <csl_irq.h>
#include <csl_chip.h>
#include <csl_timer.h>

#include "seeddm642.h"
#include "seeddm642_ide.h"

/*SEEDDM642的emifa的设置结构*/
EMIFA_Config Seeddm642ConfigA ={
	   0x00052078,/*gblctl EMIFA(B)global control register value */
	   			  /*将CLK6、4、1使能;将MRMODE置1;使能EK2EN,EK2RATE*/
	   0xffffffd3,/*cectl0 CE0 space control register value*/
	   			  /*将CE0空间设为SDRAM*/
	   0x73a28e01,/*cectl1 CE1 space control register value*/
	   			  /*Read hold: 1 clock;
	   			    MTYPE : 0000,选择8位的异步接口
	   			    Read strobe :001110;14个clock宽度
	   			    TA:2 clock; Read setup 2 clock;
	   			    Write hold :2 clock; Write strobe: 14 clock
	   			    Write setup :7 clock
	   			    --					 ---------------
	   			  	  \		 14c		/1c
	   			 	   \----------------/ */
	   0xac2ab02f, /*cectl2 CE2 space control register value*/
	   			   /*Read hold :
	   			   */
       0x22a28a42, /*cectl3 CE3 space control register value*/
	   0x57115000, /*sdctl SDRAM control register value*/
	   0x0000081b, /*sdtim SDRAM timing register value*/
	   0x001faf4d, /*sdext SDRAM extension register value*/
	   0x00000002, /*cesec0 CE0 space secondary control register value*/
	   0x00000002, /*cesec1 CE1 space secondary control register value*/
	   0x00000002, /*cesec2 CE2 space secondary control register value*/
	   0x00000073 /*cesec3 CE3 space secondary control register value*/	
};
CHIP_Config SEEDDM642percfg = {
	CHIP_VP2+\
	CHIP_VP1+\
	CHIP_VP0+\
	CHIP_I2C+\
	CHIP_MCASP0
};
ATA_command atacommand;

Uint32 buffer[512];
char view[30];

extern far void vectors();

/*此程序可将四个采集口的数据经过Video Port0送出*/
void main()
{
	Uint32 i,j;
	int ata_data;
/*-------------------------------------------------------*/
/* perform all initializations                           */
/*-------------------------------------------------------*/
	/*Initialise CSL,初始化CSL库*/
	CSL_init();
	CHIP_config(&SEEDDM642percfg);
/*----------------------------------------------------------*/
	/*EMIFA的初始化,将CE0设为SDRAM空间,CE1设为异步空间
	 注,DM642支持的是EMIFA,而非EMIF*/
	EMIFA_config(&Seeddm642ConfigA);
/*----------------------------------------------------------*/
	/*中断向量表的初始化*/
	//Point to the IRQ vector table
    IRQ_setVecs(vectors);
    IRQ_nmiEnable();
/*----------------------------------------------------------*/
	for(i = 0;i<512;i++)
	{
		buffer[i] = 0;
	}
/*	for(;;)
	{
		ata_data = ata_status();
		ata_data = ata_data & 0xff;
	}*/
	ata_open();
/*----------------------------------------------------*/
/*确定硬盘的型号与类型*/	
	/*提交设备确认命令*/
	atacommand.features = 0x100;
	atacommand.sector_count = 0x100;
	atacommand.LBA_l = 0x100;
	atacommand.LBA_M = 0x100;
	atacommand.LBA_H = 0x100;
	atacommand.device = 0x00;
	atacommand.prereq = ATA_BUS_DRDY;
	atacommand.complete_flag = ATA_BUS_DRQ;
	atacommand.com_code = IDENTIFY_DEVICE;
	if(FALSE ==ata_command( &atacommand,
							(Uint32)(&buffer),
							128))
	{
		for(;;){}
	}
	/*显示序列号*/
	i = 10;
	j = 0;
	do
	{	
		view[j++] = (buffer[i] >>8) & 0xff;
		view[j++] = buffer[i] & 0xff;
		i++;
	}while(view[j]!= 0x20);
	view[j]= 0x00;
	printf("the Serial number:%s\n",view);
	/*显示模块的名称*/
	i = 27;
	j = 0;
	do
	{	
		view[j++] = (buffer[i] >>8) & 0xff;
		view[j++] = buffer[i] & 0xff;
		i++;
	}while(view[j]!= 0x20);
	view[j] = 0x00;
	printf("the Model number:%s\n",view);
/*-----------------------------------------------------*/
	for(;;){}	
}     

⌨️ 快捷键说明

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