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

📄 basic.c

📁 嵌入式系统中文件系统源代码
💻 C
字号:
/*************************************************************
File Name: basic.c (RAMDisk 4.1)			     *
**************************************************************
Programmer: MSC
Last Modified Date: 2000/08/16
Compiler : GNU Cross-compiler/SDS
Platform : X86 protection mode, MIPS, Dragonball
Usage : basic ramdisk functions
*************************************************************/
#include <sys/syscall.h>
#include <sys/config.h>
#include <kernel/malloc.h>

#include <ramdisk.h>
//#include "myansi.h"
#include <dskblk.h>
#include <basic.h>
#include <piece.h>



#ifdef RAMDISK_ID



#ifdef RAMDISK_DEBUG


	//#include <ansi_c/stdio.h>
	/**** modified by chilong 8/23/2001 ****/
	#include <stdio.h>
	/**** modified by chilong 8/23/2001 ****/
	char RD_DebugString[80];
#else
	#ifdef RAMDISK_INIT_DEBUG
		//#include <ansi_c/stdio.h>
	/**** modified by chilong 8/23/2001 ****/
		#include <stdio.h>
	/**** modified by chilong 8/23/2001 ****/
		char RD_DebugString[80];
	#endif
#endif

/* The following are used in read_boot_sector */
void *RD_BootBegin = NULL;
unsigned long RD_DiskSize = 0;
unsigned long RD_SignSize = 0;

int RD_SemaphoreID = -1;
int InitRD = FALSE;

unsigned char *RAMMemory = NULL;	// the starting location of the RAMDisk's first memory block

int RDerrno = 0;
int RDExist = 0;

unsigned long RDLowerBoundary = 0;	// the lower boundary of the RAMDisk
unsigned long RDUpperBoundary = 0;	// the upper boundary of the RAMDisk

char RD_Sign1[SIGN1_LEN] = "AVIS RAMDisk 4";
unsigned long RD_Sign2 = 0xDADA55AA;

int RDOutput = TO_MONITOR;

extern unsigned short * reset_status;//thhuang, 2002/5/15

/* piece.c */
extern unsigned long RDPieceSize;
extern void **RD_PLT;

/* dskblk.c */
extern struct diskBlock *RD_FirstFreeBlock;

// FileSys.c
//extern short *FileSysHandleTable[MAX_OPEN_FILE];
extern short **FileSysHandleTable;

/* fio.c */
extern struct RD_FILE	**RD_HandleTable;

#ifdef CURRENT_DIR_ENABLE
	extern unsigned char RD_CurrentPathname[MAX_PATH_LENGTH];
#endif

/* mallocX.c */
#if (MM_TYPE == MM_TAG)
	// kernel/mm/tag/malloc_t.c
	extern struct chunk *TopPointer;
	extern long dbg_tm_usage;	/* the tag boundary memory usage */
	extern long dbg_tm_worst;	/* the worst case of tag memory usage */
	extern long dbg_tm_total;	/* the total available memory of tag boundary */

	#ifdef RUN_OS_MONITOR
		extern struct chunk *DebugMemList;
	#endif	// RUN_OS_MONITOR
#elif (MM_TYPE == MM_TAG2)
	// kernel/mm/tag2/malloc_t2.c
	extern struct chunk *TopPointer;
	extern long dbg_tm_usage;	/* the tag boundary memory usage */
	extern long dbg_tm_worst;	/* the worst case of tag memory usage */
	extern long dbg_tm_total;	/* the total available memory of tag boundary */

	#ifdef RUN_OS_MONITOR
		extern struct chunk *DebugMemList;
	#endif	// RUN_OS_MONITOR
#elif (MM_TYPE == MM_SUPER_TAG)
	// kernel/mm/tag2/malloc_t2.c
	extern struct chunk *TopPointer;
	extern long dbg_stm_usage;	/* the supertag boundary memory usage */
	extern long dbg_stm_worst;	/* the worst case of supertag memory usage */
	extern long dbg_stm_total;	/* the total available memory of supertag boundary */

	#ifdef RUN_OS_MONITOR
		extern struct chunk *DebugMemList;
	#endif	// RUN_OS_MONITOR
#elif (MM_TYPE == MM_SUPER_BMP)
//	#define CHUNK_SIZE	32			/* 1 chunk = 32 bytes */

	// kernel/mm/superbmp/MallocSB.c
	extern struct memoryBitmap FreeChunkArraySB;
	extern unsigned long dbg_bmp_usage;	/* the number of small memory usage */
	extern unsigned long dbg_bmp_worst;	/* worst case of small memory usage (unit = 32byte) */
#endif	// MM_TYPE

//extern unsigned char KernelInit;


void memoryZero(void *source, unsigned int size);



/*************************************************************
Function : ramdisk_init
Description :
	initialize the ramdisk
Inputs :
	size - size of ramdisk in sectors
Outputs :
	 0 - succeeded
	-1 - failed
Notes:
	

⌨️ 快捷键说明

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