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

📄 util.c

📁 davinci的NANDFLASH烧写程序
💻 C
字号:
/* --------------------------------------------------------------------------
    FILE        : util.c 				                             	 	        
    PURPOSE     : Utility and misc. file
    PROJECT     : DaVinci CCS NAND Flashing Utility
    AUTHOR      : Daniel Allred
    DATE	    : 04-Jun-2007  
 
    HISTORY
 	     v1.00 - DJA - 04-Jun-2007
 	        Completion (with support for DM6441 and DM6441_LV)                                 
 ----------------------------------------------------------------------------- */
#include "nandwriter.h"
#include "dm644x.h"
#include "util.h"

// Memory allocation stuff
static VUint32 current_mem_loc;
extern VUint32 DDRStart;

// DDR Memory allocation routines (for storing large data)
Uint32 get_current_mem_loc()
{
	return current_mem_loc;
}

void set_current_mem_loc(Uint32 value)
{
	current_mem_loc = value;
}

void *ubl_alloc_mem (Uint32 size)
{
	void *cPtr;
	VUint8 *DDRMem;
	Uint32 size_temp;
	DDRMem = (void*) &DDRStart;


	// Ensure word boundaries
	size_temp = ((size + 4) >> 2 ) << 2;
	
	if((current_mem_loc + size_temp) > (MAX_IMAGE_SIZE))
	{
		return 0;
	}

	cPtr = (void *) (DDRMem + current_mem_loc);
	current_mem_loc += size_temp;

	return cPtr;
}


// Simple wait loop - comes in handy.
void waitloop(Uint32 loopcnt)
{
    Uint32 i;
	for (i = 0; i<loopcnt; i++)
	{
		asm("   NOP");
	}
}

⌨️ 快捷键说明

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