1
0
mirror of https://github.com/elua/elua.git synced 2025-01-08 20:56:17 +08:00
elua/inc/romfs.h

46 lines
1020 B
C
Raw Normal View History

2008-07-29 11:08:54 +00:00
// Read-only ROM filesystem
#ifndef __FS_H__
#define __FS_H__
#include "type.h"
#include "devman.h"
// Maximum length of a filename in the filesystem
#define MAX_FNAME_LENGTH 30
2008-07-29 11:08:54 +00:00
/*******************************************************************************
The Read-Only "filesystem" resides in a contiguous zone of memory, with the
following structure, repeated for each file:
Filename: ASCIIZ, max length is MAX_FNAME_LENGTH defined here, empty if last file
File size: (2 bytes)
File data: (file size bytes)
2008-07-29 11:08:54 +00:00
*******************************************************************************/
enum
{
FS_FILE_NOT_FOUND,
FS_FILE_OK
};
// This is the function used to read a byte at the given address from the file
// system
typedef u8 ( *p_read_fs_byte )( u32 );
2008-07-29 11:08:54 +00:00
// A small "FILE" structure
typedef struct
{
u32 baseaddr;
u32 offset;
2008-07-29 11:08:54 +00:00
u16 size;
p_read_fs_byte p_read_func;
} FS;
2008-07-29 11:08:54 +00:00
// FS functions
DM_DEVICE* romfs_init();
u32 romfs_get_dir_entry( u32 offset, char *fname, u16 *fsize );
2008-07-29 11:08:54 +00:00
#endif