libElysianVMU 1.6.0
Full-featured, accurate, cross-platform library emulating the Dreamcast's Visual Memory Unit
Loading...
Searching...
No Matches
evmu_fat.h File Reference

Go to the source code of this file.

Data Structures

struct  EvmuRootBlock
 
struct  EvmuFatUsage
 
struct  EvmuFatInfo
 
struct  EvmuFatClass
 
struct  EvmuFat
 

Macros

#define EVMU_FAT_NAME   "fat"
 
#define EVMU_FAT_GAME_VMS_HEADER_OFFSET   0x200
 
Type System

Type UUID and cast operators

#define EVMU_FAT_TYPE   (GBL_TYPEID(EvmuFat))
 
#define EVMU_FAT(self)   (GBL_CAST(EvmuFat, self))
 
#define EVMU_FAT_CLASS(klass)   (GBL_CLASS_CAST(EvmuFat, klass))
 
#define EVMU_FAT_GET_CLASS(self)   (GBL_CLASSOF(EvmuFat, self))
 
Default Volume Info

Size and location of volume and system regions

#define EVMU_FAT_BLOCK_SIZE   512
 
#define EVMU_FAT_BLOCK_COUNT_DEFAULT   256
 
#define EVMU_FAT_BLOCK_ROOT   255
 
#define EVMU_FAT_BLOCK_ROOT_SIZE   1
 
#define EVMU_FAT_BLOCK_USERDATA_DEFAULT   0
 
#define EVMU_FAT_BLOCK_USERDATA_SIZE_DEFAULT   200
 
#define EVMU_FAT_BLOCK_EXTRA_DEFAULT   200
 
#define EVMU_FAT_BLOCK_EXTRA_SIZE_DEFAULT   31
 
#define EVMU_FAT_BLOCK_DIRECTORY_DEFAULT   253
 
#define EVMU_FAT_BLOCK_DIRECTORY_SIZE_DEFAULT   13
 
#define EVMU_FAT_BLOCK_DIRECTORY_ENTRIES_DEFAULT   200
 
#define EVMU_FAT_BLOCK_FAT_DEFAULT   254
 
#define EVMU_FAT_BLOCK_FAT_SIZE_DEFAULT   1
 
#define EVMU_FAT_BLOCK_FAT_COUNT_DEFAULT   256
 
Root Block Info

Sizes and values used with EvmuRootBlock

#define EVMU_FAT_ROOT_BLOCK_FORMATTED_SIZE   16
 
#define EVMU_FAT_ROOT_BLOCK_FORMATTED_BYTE   0x55
 
#define EVMU_FAT_ROOT_BLOCK_VOLUME_LABEL_SIZE   32
 
#define EVMU_FAT_ROOT_BLOCK_ICON_SHAPE_MAX   123
 
#define EVMU_FAT_ROOT_BLOCK_RESERVED_SIZE   8
 
#define EVMU_FAT_ROOT_BLOCK_RESERVED2_SIZE   8
 
FAT Table Values

Special values used as FAT table entries

#define EVMU_FAT_BLOCK_FAT_UNALLOCATED   0xfffc
 
#define EVMU_FAT_BLOCK_FAT_LAST_IN_FILE   0xfffa
 
#define EVMU_FAT_BLOCK_FAT_DAMAGED   0xffff
 

Typedefs

typedef uint16_t EvmuBlock
 

Functions

GblType EvmuFat_type (void)
 

Detailed Description

EvmuFat peripheral and FAT filesystem API.

EvmuFat offers a mid-level API around the VMU's flash storage, which sits above the physical flash controller and below an actual filesystem API. The API operates at the block-level and also offers a low-level 8-bit FAT abstraction.

Todo:
  • public members for volume allocation information
  • signals for filesystem events/changes
  • Remove EvmuFat_capacity(), add at EvmuFlash level
  • Remove EvmuFileManager_defrag() and add at this level
  • Don't just let user blindly write to block data
    • dataChanged flag and signals won't be updated
    • Need a write function
    • Make EvmuFat_blockData() read-only
Test:
  • Needs whole unit test suite
Author
2023 Falco Girgis

Definition in file evmu_fat.h.

Macro Definition Documentation

◆ EVMU_FAT

#define EVMU_FAT (   self)    (GBL_CAST(EvmuFat, self))

Function-tyle GblInstance cast.

Definition at line 46 of file evmu_fat.h.

◆ EVMU_FAT_BLOCK_COUNT_DEFAULT

#define EVMU_FAT_BLOCK_COUNT_DEFAULT   256

Default block capacity for a standard VMU.

Definition at line 59 of file evmu_fat.h.

◆ EVMU_FAT_BLOCK_DIRECTORY_DEFAULT

#define EVMU_FAT_BLOCK_DIRECTORY_DEFAULT   253

Default directory start block for a standard VMU.

Definition at line 66 of file evmu_fat.h.

◆ EVMU_FAT_BLOCK_DIRECTORY_ENTRIES_DEFAULT

#define EVMU_FAT_BLOCK_DIRECTORY_ENTRIES_DEFAULT   200

Default number of directory entries for a standard-sized directory.

Definition at line 68 of file evmu_fat.h.

◆ EVMU_FAT_BLOCK_DIRECTORY_SIZE_DEFAULT

#define EVMU_FAT_BLOCK_DIRECTORY_SIZE_DEFAULT   13

Default number of directory blocks for a standard VMU.

Definition at line 67 of file evmu_fat.h.

◆ EVMU_FAT_BLOCK_EXTRA_DEFAULT

#define EVMU_FAT_BLOCK_EXTRA_DEFAULT   200

Default hidden start block for a standard VMU.

Definition at line 64 of file evmu_fat.h.

◆ EVMU_FAT_BLOCK_EXTRA_SIZE_DEFAULT

#define EVMU_FAT_BLOCK_EXTRA_SIZE_DEFAULT   31

Default number of hidden blocks for a standard VMU.

Definition at line 65 of file evmu_fat.h.

◆ EVMU_FAT_BLOCK_FAT_COUNT_DEFAULT

#define EVMU_FAT_BLOCK_FAT_COUNT_DEFAULT   256

Default number of FAT entries for a standard-sized FAT

Definition at line 71 of file evmu_fat.h.

◆ EVMU_FAT_BLOCK_FAT_DAMAGED

#define EVMU_FAT_BLOCK_FAT_DAMAGED   0xffff

FAT entry value signifying an unused, damaged block

Definition at line 92 of file evmu_fat.h.

◆ EVMU_FAT_BLOCK_FAT_DEFAULT

#define EVMU_FAT_BLOCK_FAT_DEFAULT   254

Default FAT start block for a standard VMU.

Definition at line 69 of file evmu_fat.h.

◆ EVMU_FAT_BLOCK_FAT_LAST_IN_FILE

#define EVMU_FAT_BLOCK_FAT_LAST_IN_FILE   0xfffa

FAT entry value signifying the last block of a file.

Definition at line 91 of file evmu_fat.h.

◆ EVMU_FAT_BLOCK_FAT_SIZE_DEFAULT

#define EVMU_FAT_BLOCK_FAT_SIZE_DEFAULT   1

Default number of FAT blocks for a standard VMU.

Definition at line 70 of file evmu_fat.h.

◆ EVMU_FAT_BLOCK_FAT_UNALLOCATED

#define EVMU_FAT_BLOCK_FAT_UNALLOCATED   0xfffc

FAT entry value signifying an unallocated block.

Definition at line 90 of file evmu_fat.h.

◆ EVMU_FAT_BLOCK_ROOT

#define EVMU_FAT_BLOCK_ROOT   255

Default root block number for a standard VMU.

Definition at line 60 of file evmu_fat.h.

◆ EVMU_FAT_BLOCK_ROOT_SIZE

#define EVMU_FAT_BLOCK_ROOT_SIZE   1

Default root size for a standard VMU.

Definition at line 61 of file evmu_fat.h.

◆ EVMU_FAT_BLOCK_SIZE

#define EVMU_FAT_BLOCK_SIZE   512

Default block size for a standard VMU.

Definition at line 58 of file evmu_fat.h.

◆ EVMU_FAT_BLOCK_USERDATA_DEFAULT

#define EVMU_FAT_BLOCK_USERDATA_DEFAULT   0

Default userdata start block for a standard VMU.

Definition at line 62 of file evmu_fat.h.

◆ EVMU_FAT_BLOCK_USERDATA_SIZE_DEFAULT

#define EVMU_FAT_BLOCK_USERDATA_SIZE_DEFAULT   200

Default number of userdata blocks for a standard VMU.

Definition at line 63 of file evmu_fat.h.

◆ EVMU_FAT_CLASS

#define EVMU_FAT_CLASS (   klass)    (GBL_CLASS_CAST(EvmuFat, klass))

Function-style GblClass cast.

Definition at line 47 of file evmu_fat.h.

◆ EVMU_FAT_GAME_VMS_HEADER_OFFSET

#define EVMU_FAT_GAME_VMS_HEADER_OFFSET   0x200

Offset of the VMS header from the file start for a GAME.

Definition at line 52 of file evmu_fat.h.

◆ EVMU_FAT_GET_CLASS

#define EVMU_FAT_GET_CLASS (   self)    (GBL_CLASSOF(EvmuFat, self))

Get EvmuFatClass from GblInstance

Definition at line 48 of file evmu_fat.h.

◆ EVMU_FAT_NAME

#define EVMU_FAT_NAME   "fat"

EvmuFat GblObject name.

Definition at line 51 of file evmu_fat.h.

◆ EVMU_FAT_ROOT_BLOCK_FORMATTED_BYTE

#define EVMU_FAT_ROOT_BLOCK_FORMATTED_BYTE   0x55

Value string that must be preset in the EvmuRootBlock to signify a formatted card.

Definition at line 79 of file evmu_fat.h.

◆ EVMU_FAT_ROOT_BLOCK_FORMATTED_SIZE

#define EVMU_FAT_ROOT_BLOCK_FORMATTED_SIZE   16

Size in bytes of the format string in the EvmuRootBlock structure.

Definition at line 78 of file evmu_fat.h.

◆ EVMU_FAT_ROOT_BLOCK_ICON_SHAPE_MAX

#define EVMU_FAT_ROOT_BLOCK_ICON_SHAPE_MAX   123

Maximum allowable value for icon shape in the EvmuRootBlock structure.

Definition at line 81 of file evmu_fat.h.

◆ EVMU_FAT_ROOT_BLOCK_RESERVED2_SIZE

#define EVMU_FAT_ROOT_BLOCK_RESERVED2_SIZE   8

Size in bytes of the second reserved field in the EvmuRootBlock structure

Definition at line 83 of file evmu_fat.h.

◆ EVMU_FAT_ROOT_BLOCK_RESERVED_SIZE

#define EVMU_FAT_ROOT_BLOCK_RESERVED_SIZE   8

Size in bytes of the first reserved field in the EvmuRootBlock structure.

Definition at line 82 of file evmu_fat.h.

◆ EVMU_FAT_ROOT_BLOCK_VOLUME_LABEL_SIZE

#define EVMU_FAT_ROOT_BLOCK_VOLUME_LABEL_SIZE   32

Size in bytes of the volume label in the EvmuRootBlock structure.

Definition at line 80 of file evmu_fat.h.

◆ EVMU_FAT_TYPE

#define EVMU_FAT_TYPE   (GBL_TYPEID(EvmuFat))

UUID for EvmuFat type.

Definition at line 45 of file evmu_fat.h.

Typedef Documentation

◆ EvmuBlock

typedef uint16_t EvmuBlock

FAT block index.

Definition at line 104 of file evmu_fat.h.

Function Documentation

◆ EvmuFat_type()

GblType EvmuFat_type ( void  )

Returns the GblType UUID associated with EvmuFat.