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

📄 mem.h

📁 fat文件系统的源码 老外写的FAT32文件系统 还是有用的
💻 H
字号:
/*
  Copyright (C) 2001 Jesper Hansen <jesperh@telia.com>.

  Rewritten by:	Nikolai Vorontsov <nickviz@mail.be>

  This file is part of the yampp system.

  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software Foundation, 
  Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

#ifndef __MEM_H__
#define __MEM_H__

#include "types.h"
#include "Constants.h"

// 32 k External RAM

#ifdef YAMPP3USB
 #define EXTRAM_START	0x460
#else
 #define EXTRAM_START	0x260
#endif
#define EXTRAM_END		0x7FFF	

// 3 bytes _before_ LONG_NAME are also used!!!
#define LONG_NAME		((u08*)(EXTRAM_START + 0x00A0))	// length 256
#define DIR_NAME		((u08*)(EXTRAM_START + 0x01A0))	// length 256
#define TMP_SECTOR		((u08*)(EXTRAM_START + 0x02A0))	// length 512
#define FAT_CACHE		((u08*)(EXTRAM_START + 0x04A0))	// length 512
#define LETTER_TABLE		(EXTRAM_START + 0x06A0)		// length 26 * 3 = 78
#define DIRS_TABLE		(EXTRAM_START + 0x07A0)		// length max 1024 dirs * 6B = 6144
#define BACK_STEP_TAB		(EXTRAM_START + 0x20A0)		// length max 1024 steps * 4B = 4096

#define RANDOM_TAB		((u08*)0x4000)			// length max 8192 (0x2000)

//free 0x3200 - 0x3fff

// This is the size of each buffer which is allocated for disk IO
// It should be 512 <= BUFFER_SIZE <=4096 and CLUSTER_SIZE should be
//   divided by it without reminder
#define BUFFER_SIZE		2048
#define BUFFER1			0x6000
#define BUFFER2			(BUFFER1 + BUFFER_SIZE)
#define BUFFER1P		((u08*)BUFFER1)
#define BUFFER2P		((u08*)BUFFER2)

#if BUFFER_SIZE < 512  ||  BUFFER_SIZE > 8192  ||  BUFFER_SIZE % 512 != 0 
#error Invalid BUFFER_SIZE!
#endif

#if BUFFER_SIZE > CLUSTER_SIZE || CLUSTER_SIZE % BUFFER_SIZE != 0
#error Invalid pair CLUSTER_SIZE, BUFFER_SIZE!
#endif

// eeprom positions
#define EEPROM_VOLUME		0x0010	/* u08 */
#define EEPROM_AUTOPLAY		0x0011	/* u08 */
#define EEPROM_RANDOM		0x0012	/* u08 */
#define EEPROM_SONGPOS		0x0013	/* u16 */
#define EEPROM_LOUDNESS		0x0015	/* u08 */

struct LT_elem
{
	u16	song_num;
	u08	letter;
};

#define LetterTable ((struct LT_elem*)LETTER_TABLE)
#define MAX_LETTERS	26

struct DT_elem
{
	u16	song_num;
	u32	dir_clust;
};

#define DirsTable ((struct DT_elem*)DIRS_TABLE)
#define MAX_DIRS	1024

#define Rev_Table ((u32*)BACK_STEP_TAB)
#define MAX_REV_STEPS	1024


void eeprom_ww(u08 address, u16 value);

extern void enable_ram(void);
extern void disable_ram(void);


#endif // __MEM_H__

⌨️ 快捷键说明

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