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

📄 nand.c

📁 嵌入式linux(arm9)的平台下
💻 C
字号:
#include "example.h"#include "nand.h"static uint8 nand_buffer[NAND_DATA_BLOCK_SIZE];static int nand_buffer_index = 0;static int nand_block_offset = 0;static NandDevice* nand_device = 0;int nandClose(){	DPRINTF("%s\n", __FUNCTION__);	return 1;}int nandOpen(const char* block){	int result = 0;	DPRINTF("%s\n", __FUNCTION__);	nand_buffer_index = NAND_DATA_BLOCK_SIZE;	//Start at end of buffer	nand_block_offset = strtol((char*) &block[5], NULL, 16);	if(nand_device = nand_initialize())		result = 1;	return result;}int nandRead(void* buffer, int size){	//DPRINTF("%s\n", __FUNCTION__);	int i;	for(i = 0; i < size; ++i)	{		if(nand_buffer_index == NAND_DATA_BLOCK_SIZE)		{			nand_buffer_index = 0;			nand_read(nand_buffer, NAND_DATA_BLOCK_SIZE, nand_block_offset++, 0);		}		((uint8*)buffer)[i] = nand_buffer[nand_buffer_index++];	}		return size;}

⌨️ 快捷键说明

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