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

📄 otg_dev_test.c

📁 s3c6400 ADS下官方测试程序
💻 C
字号:
/**************************************************************************************
* 
*	Project Name : S3C6400 Validation
*
*	Copyright 2006 by Samsung Electronics, Inc.
*	All rights reserved.
*
*	Project Description :
*		This software is only for validating functions of the S3C6400.
*		Anybody can use this software without our permission.
*  
*--------------------------------------------------------------------------------------
* 
*	File Name : 6400_main.c
*  
*	File Description : This file implements the USB OTG test functions.
*
*	Author : Haksoo,Kim
*	Dept. : AP Development Team
*	Created Date : 2007/07/11
*	Version : 0.1 
* 
*	History
*	- Created(Haksoo,Kim 2007/07/11)
*  
**************************************************************************************/


#include <stdio.h>

#include "option.h"
#include "library.h"
#include "sfr6400.h"
#include "system.h"
#include "sysc.h"
#include "intc.h"
#include "otg_dev.h"
#include "gpio.h"
#include "timer.h"
#include "nand.h"
#include "am29f800.h"

USB_OPMODE eOpMode = USB_DMA;
USB_SPEED eSpeed = USB_HIGH;
bool download_run=false;
u32 tempDownloadAddress;
bool g_bSuspendResume=false;

//////////
// Function Name : Isr_UsbOtg
// Function Description : USB OTG ISR
// Input : NONE
// Output : NONE
// Version : 
void __irq Isr_UsbOtg(void)
{
	INTC_Disable(NUM_OTG);
	
	OTGDEV_HandleEvent();
	
	INTC_Enable(NUM_OTG);
	
	INTC_ClearVectAddr();
}

//////////
// Function Name : Download_Only
// Function Description : This function downloads a image file thru DNW.
//						You can configure the address to downlad in DNW "Configuration-Options" menu.
// Input : NONE
// Output : NONE
// Version : 
static void Download_Only(void)
{
	u8 *pucDownloadAddr;
	
    Disp("Enter the download address(0x...):");
    pucDownloadAddr=(u8 *)GetIntNum();
    if(pucDownloadAddr==(u8 *)0xffffffff)
    {
    	pucDownloadAddr=(u8 *)DefaultDownloadAddress;
    }
    
    Disp("The temporary download address is 0x%x.\n\n",pucDownloadAddr);
    
    DownloadImageThruUsbOtg(pucDownloadAddr);
	
}

//////////
// Function Name : Upload_Only
// Function Description : This function uploads a image file thru DNW
//						You can configure the address and the size to upload in DNW "Configuration-Options" menu.
// Input : NONE
// Output : NONE
// Version : 
void Upload_Only()
{
	UploadImageThruUsbOtg();
}

//////////
// Function Name : Select_OpMode
// Function Description : This function selects an operation mode of USB OTG of CPU or DMA mode.
// Input : NONE
// Output : NONE
// Version : 
void Select_OpMode(void)
{
	int iSel;
	
	Disp(" Current Op Mode : ");
	if(eOpMode == USB_CPU)
	{
		Disp("CPU mode\n");
	}
	else if(eOpMode== USB_DMA)
	{
		Disp("DMA mode\n");
	}

	Disp(" Enter the op. mode (0: CPU_MODE, 1: DMA_MODE) : ");
	iSel = GetIntNum();

	if (iSel != -1) 
	{
		if (iSel == 0)
			eOpMode = USB_CPU;
		else if (iSel == 1)
			eOpMode = USB_DMA;
		else
			Disp("Invalid selection\n");
	}
}

//////////
// Function Name : OtgDev_Test
// Function Desctiption : test function of the OTG DEV
// Input : NONE
// Output : NONE
// Version :
void OtgDev_Test(void)
{
	s32 i, sel;
			
	const testFuncMenu menu[]=
	{
		Download_Only,			"Donwload Only",
		Upload_Only,			"Upload Only",
		Select_OpMode,			"Select Op Mode",
		0,                      0
	};
	
	while(1)
	{
		Disp("\n");
		for (i=0; (int)(menu[i].desc)!=0; i++)
			Disp("%2d: %s\n", i, menu[i].desc);

		Disp("\nSelect the function to test : ");
		sel = GetIntNum();
		Disp("\n");

		if (sel == -1)
			break;
		else if (sel>=0 && sel<(sizeof(menu)/8-1))
			(menu[sel].func)();
	}
}

⌨️ 快捷键说明

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