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

Go to the source code of this file.

Data Structures

struct  EvmuFlashClass
 
struct  EvmuFlash
 

Macros

Type System

Type UUID and cast operators

#define EVMU_FLASH_TYPE   (GBL_TYPEID(EvmuFlash))
 
#define EVMU_FLASH(self)   (GBL_CAST(EvmuFlash, self))
 
#define EVMU_FLASH_CLASS(klass)   (GBL_CLASS_CAST(EvmuFlash, klass))
 
#define EVMU_FLASH_GET_CLASS(self)   (GBL_CLASSOF(EvmuFlash, self))
 
Sizes

Sizes of flash and its banks

#define EVMU_FLASH_BANK_SIZE   65536
 
#define EVMU_FLASH_BANKS   2
 
#define EVMU_FLASH_SIZE   (EVMU_FLASH_BANK_SIZE * EVMU_FLASH_BANKS)
 
Programming Sequence

Sequence of target addresses and values for write programming

#define EVMU_FLASH_PROGRAM_BYTE_COUNT   128
 
#define EVMU_FLASH_PROGRAM_STATE_0_ADDRESS   0x5555
 
#define EVMU_FLASH_PROGRAM_STATE_0_VALUE   0xaa
 
#define EVMU_FLASH_PROGRAM_STATE_1_ADDRESS   0x2aaa
 
#define EVMU_FLASH_PROGRAM_STATE_1_VALUE   0x55
 
#define EVMU_FLASH_PROGRAM_STATE_2_ADDRESS   0x5555
 
#define EVMU_FLASH_PROGRAM_STATE_2_VALUE   0xa0
 

Enumerations

enum  EVMU_FLASH_PROGRAM_STATE
 

Functions

Utilities

Static utility methods

GblType EvmuFlash_type (void)
 
EvmuAddress EvmuFlash_programAddress (EVMU_FLASH_PROGRAM_STATE state)
 
EvmuWord EvmuFlash_programValue (EVMU_FLASH_PROGRAM_STATE state)
 

Detailed Description

EvmuFlash peripheral, 8-bit FAT filesystem API.

This file contains a very low-level, hardware abstraction around the VMU's flash chip. It models it at the raw byte-level for programming.

Note
Unless you're byte-banging your own CPU core or really want to do raw byte operations on flash, you most likely want to check out the two EvmuFlash derived types:
See also
evmu_fat.h, evmu_file_manager.h
Todo:
  • Implement flash program wait cycles
  • Add capacity
Test:
  • Unit tests flexing truncated read/writes + verifying signals
Author
2023 Falco Girgis

Definition in file evmu_flash.h.

Macro Definition Documentation

◆ EVMU_FLASH

#define EVMU_FLASH (   self)    (GBL_CAST(EvmuFlash, self))

Cast GblInstance to EvmuFlash.

Definition at line 40 of file evmu_flash.h.

◆ EVMU_FLASH_BANK_SIZE

#define EVMU_FLASH_BANK_SIZE   65536

Size of a single flash bank.

Definition at line 49 of file evmu_flash.h.

◆ EVMU_FLASH_BANKS

#define EVMU_FLASH_BANKS   2

Number of flash banks.

Definition at line 50 of file evmu_flash.h.

◆ EVMU_FLASH_CLASS

#define EVMU_FLASH_CLASS (   klass)    (GBL_CLASS_CAST(EvmuFlash, klass))

Cast GblClass to EvmuFlashClass.

Definition at line 41 of file evmu_flash.h.

◆ EVMU_FLASH_GET_CLASS

#define EVMU_FLASH_GET_CLASS (   self)    (GBL_CLASSOF(EvmuFlash, self))

Get EvmuFlashClass from GblInstance

Definition at line 42 of file evmu_flash.h.

◆ EVMU_FLASH_PROGRAM_BYTE_COUNT

#define EVMU_FLASH_PROGRAM_BYTE_COUNT   128

Number of bytes software can write to flash once unlocked.

Definition at line 58 of file evmu_flash.h.

◆ EVMU_FLASH_PROGRAM_STATE_0_ADDRESS

#define EVMU_FLASH_PROGRAM_STATE_0_ADDRESS   0x5555

First target address for programming flash.

Definition at line 59 of file evmu_flash.h.

◆ EVMU_FLASH_PROGRAM_STATE_0_VALUE

#define EVMU_FLASH_PROGRAM_STATE_0_VALUE   0xaa

First value to write when programming flash.

Definition at line 60 of file evmu_flash.h.

◆ EVMU_FLASH_PROGRAM_STATE_1_ADDRESS

#define EVMU_FLASH_PROGRAM_STATE_1_ADDRESS   0x2aaa

Second target address for programming flash.

Definition at line 61 of file evmu_flash.h.

◆ EVMU_FLASH_PROGRAM_STATE_1_VALUE

#define EVMU_FLASH_PROGRAM_STATE_1_VALUE   0x55

Second value to write when programming flash.

Definition at line 62 of file evmu_flash.h.

◆ EVMU_FLASH_PROGRAM_STATE_2_ADDRESS

#define EVMU_FLASH_PROGRAM_STATE_2_ADDRESS   0x5555

Third target address for programming flash.

Definition at line 63 of file evmu_flash.h.

◆ EVMU_FLASH_PROGRAM_STATE_2_VALUE

#define EVMU_FLASH_PROGRAM_STATE_2_VALUE   0xa0

Third value to write when programming flash

Definition at line 64 of file evmu_flash.h.

◆ EVMU_FLASH_SIZE

#define EVMU_FLASH_SIZE   (EVMU_FLASH_BANK_SIZE * EVMU_FLASH_BANKS)

Total flash size in bytes

Definition at line 51 of file evmu_flash.h.

◆ EVMU_FLASH_TYPE

#define EVMU_FLASH_TYPE   (GBL_TYPEID(EvmuFlash))

Type UUID for EvmuFlash.

Definition at line 39 of file evmu_flash.h.

Enumeration Type Documentation

◆ EVMU_FLASH_PROGRAM_STATE

Current state in the flash programming sequence to unlock writing.

Enumerator
EVMU_FLASH_PROGRAM_STATE_0 

First state.

EVMU_FLASH_PROGRAM_STATE_1 

Second state.

EVMU_FLASH_PROGRAM_STATE_2 

Third state.

EVMU_FLASH_PROGRAM_STATE_COUNT 

Number of states.

Definition at line 74 of file evmu_flash.h.

74 {
EVMU_FLASH_PROGRAM_STATE
Current state in the flash programming sequence to unlock writing.
Definition evmu_flash.h:74
@ EVMU_FLASH_PROGRAM_STATE_1
Second state.
Definition evmu_flash.h:76
@ EVMU_FLASH_PROGRAM_STATE_0
First state.
Definition evmu_flash.h:75
@ EVMU_FLASH_PROGRAM_STATE_2
Third state.
Definition evmu_flash.h:77
@ EVMU_FLASH_PROGRAM_STATE_COUNT
Number of states.
Definition evmu_flash.h:78

Function Documentation

◆ EvmuFlash_programAddress()

EvmuAddress EvmuFlash_programAddress ( EVMU_FLASH_PROGRAM_STATE  state)

Returns the target address corresponding to the given state in the flash programming sequence.

◆ EvmuFlash_programValue()

EvmuWord EvmuFlash_programValue ( EVMU_FLASH_PROGRAM_STATE  state)

Returns the target value corresponding to the given state in the flash programming sequence.

◆ EvmuFlash_type()

GblType EvmuFlash_type ( void  )

Returns the GblType UUID associated with EvmuFlash, for use with the libGimbal type system.