1
0
mirror of https://github.com/elua/elua.git synced 2025-01-08 20:56:17 +08:00
elua/inc/romfs.h
Bogdan Marinescu e7702bb0e2 Manual merge of remotefs/ into trunk. Tested with the simulator and (partially) on a ET-STM32 board. Other changes:
- FAT changed to support the new opendir/readdir/closedir mechanism, and to use lseek directly instead of ioctl (also fixed a bug in FAT's lseek that always returned 0 instead of file position).
- ET-STM32 console moved to UART2@19200bps (to allow RFS to run on UART0). If UART0 is needee for console, remember to disable RFS.
- freed 700+ bytes of RAM by changing the devman implementation to keep pointers instead of actual DM_DEVICE structures
- other minor code changes and fixes
2010-02-01 18:47:41 +00:00

43 lines
882 B
C

// Read-only ROM filesystem
#ifndef __FS_H__
#define __FS_H__
#include "type.h"
#include "devman.h"
/*******************************************************************************
The Read-Only "filesystem" resides in a contiguous zone of memory, with the
following structure, repeated for each file:
Filename: ASCIIZ, max length is DM_MAX_FNAME_LENGTH defined here, empty if last file
File size: (2 bytes)
File data: (file size bytes)
*******************************************************************************/
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 );
// A small "FILE" structure
typedef struct
{
u32 baseaddr;
u32 offset;
u16 size;
p_read_fs_byte p_read_func;
} FS;
// FS functions
const DM_DEVICE* romfs_init();
#endif