2008-07-29 11:08:54 +00:00
|
|
|
// Read-only ROM filesystem
|
|
|
|
|
|
|
|
#ifndef __FS_H__
|
|
|
|
#define __FS_H__
|
|
|
|
|
|
|
|
#include "type.h"
|
|
|
|
#include "devman.h"
|
|
|
|
|
|
|
|
/*******************************************************************************
|
2008-11-24 13:48:46 +00:00
|
|
|
The Read-Only "filesystem" resides in a contiguous zone of memory, with the
|
|
|
|
following structure, repeated for each file:
|
|
|
|
|
2010-02-01 18:47:41 +00:00
|
|
|
Filename: ASCIIZ, max length is DM_MAX_FNAME_LENGTH defined here, empty if last file
|
2012-05-08 16:13:48 +03:00
|
|
|
File size: (4 bytes)
|
2008-11-24 13:48:46 +00:00
|
|
|
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
|
2009-10-13 02:14:27 +00:00
|
|
|
typedef u8 ( *p_read_fs_byte )( u32 );
|
2008-07-29 11:08:54 +00:00
|
|
|
|
|
|
|
// A small "FILE" structure
|
|
|
|
typedef struct
|
|
|
|
{
|
2009-10-13 02:14:27 +00:00
|
|
|
u32 baseaddr;
|
|
|
|
u32 offset;
|
2012-05-08 16:13:48 +03:00
|
|
|
u32 size;
|
2008-07-29 11:08:54 +00:00
|
|
|
p_read_fs_byte p_read_func;
|
|
|
|
} FS;
|
2008-11-24 13:48:46 +00:00
|
|
|
|
2008-07-29 11:08:54 +00:00
|
|
|
// FS functions
|
2010-02-01 18:47:41 +00:00
|
|
|
const DM_DEVICE* romfs_init();
|
2008-07-29 11:08:54 +00:00
|
|
|
|
|
|
|
#endif
|
2009-10-13 02:14:27 +00:00
|
|
|
|