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

📄 dma.c

📁 小型操作系统,以VC为开发环境,需要boachs调试
💻 C
字号:
/***************************************************************************
**     File name   : dma.c
**     Author      : x.cheng
**     Create date :
**
**	   Comment:
**        main part of dma managing function
**		  This driver is based on the Fabian Nunez DMA driver.
**
**     Revisions:
**     $Log: dma.c,v $
**     Revision 1.3  2005/08/19 14:58:25  x.cheng
**     default dma end address smallen
**
**     Revision 1.2  2005/07/27 08:03:07  x.cheng
**     new function:
**         void DmaSetupMemoryEnd(unsigned long ulMemoryEnd)
**
**     Revision 1.1.1.1  2005/07/27 06:53:15  x.cheng
**     add into repositories
**
**
***************************************************************************/
#include "const.h"
#include "type.h"
#include "stdarg.h"

#include "..\..\Inc\i386\map.h"
#include "..\..\Inc\debug.h"

/* debug preprocessor instrument
	#ifdef _DEBUG__
	#ifdef _DEBUG_TUI__
				
	#endif
	#endif	
***************************/

/*********************************************
 * global variable declaration
 *********************************************/
unsigned long g_ulEndOfDmaMemory = 2*1024*1024;

/************************************************************
*************************************************************
**      Function Name:			DmaSetupMemoryEnd	
**      Author:                 x.cheng
**
**      Comment:
**			Evaluate a reasonable value for the upper bound of the
**		DMA memory area if the system has a little amount of physical memory.
**
**      List of parameters:
**			unsigned long ulMemorySize
**
**      Return value:   
**          no
**
**      Revisions:
**
*************************************************************
*************************************************************/
void DmaSetupMemoryEnd(unsigned long ulMemoryEnd)
{
	switch(ulMemoryEnd) {
		// From 7M to 15M of extended physical memory.
	case (7*1024*1024) ... (15*1024*1024-1):
		g_ulEndOfDmaMemory = 4*1024*1024;
		break;
	case (3*1024*1024) ... (7*1024*1024-1):
		g_ulEndOfDmaMemory = 2*1024*1024;
		break;
	case 0 ... (3*1024*1024-1):
		kprintf("%s(): %uK of extended memory are not enough for jcinx!\n",
				__FUNCTION__, ulMemoryEnd / 1024 );
		PANIC();
		break;
	default:
		g_ulEndOfDmaMemory = 6*1024*1024;
		break;
	}
	g_ulEndOfDmaMemory += KERNEL_VIRTUAL_START;
	kprintf("DMA: reserved memory area [%p]->[%p]\n", KERNEL_LINK_VIRTUAL_ADDRESS_END, g_ulEndOfDmaMemory);
}

/************************************************************
*************************************************************
**      Function Name:			DmaInitial
**      Author:                 x.cheng
**
**      Comment:
**			Initial dma memory...
**      List of parameters:
**			no
**
**      Return value:   
**          no
**
**      Revisions:
**
*************************************************************
*************************************************************/
extern unsigned long KernelEnd_;	//extern variable is defined in linkscript.ld

void DmaInitialize()
{
}

⌨️ 快捷键说明

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