PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
scache.h
1
#ifndef _SCACHE_H
2
#define _SCACHE_H 1
3
4
#ifdef BUILDING_IEEE1394_DISK
5
#define BLOCK_SIZE 16384
6
#else
7
#define BLOCK_SIZE (4 * 1024)
8
#endif
9
10
#ifndef BUILDING_USBHDFSD
11
// number of cache slots (1 slot = block)
12
#define CACHE_SIZE 32
13
14
// when the flushCounter reaches FLUSH_TRIGGER then flushSectors is called
15
// #define FLUSH_TRIGGER 16
16
17
typedef
struct
_cache_record
18
{
19
unsigned
int
sector;
20
int
tax;
21
char
writeDirty;
22
}
cache_record
;
23
24
typedef
struct
_cache_set
25
{
26
#if !defined(BUILDING_IEEE1394_DISK) && !defined(BUILDING_USBHDFSD)
27
struct
block_device
*bd;
28
#else
29
struct
SBP2Device
*dev;
30
#endif
31
unsigned
int
sectorSize;
32
unsigned
int
indexLimit;
33
unsigned
char
*sectorBuf;
// = NULL; // sector content - the cache buffer
34
cache_record
rec[CACHE_SIZE];
// cache info record
35
36
// statistical infos
37
unsigned
int
cacheAccess;
38
unsigned
int
cacheHits;
39
unsigned
int
writeFlag;
40
// unsigned int flushCounter;
41
42
// unsigned int cacheDumpCounter = 0;
43
}
cache_set
;
44
#endif
/* BUILDING_USBHDFSD */
45
#if defined(BUILDING_USBHDFSD)
46
extern
cache_set
*scache_init(
mass_dev
*dev,
int
sectorSize);
47
#elif defined(BUILDING_IEEE1394_DISK)
48
extern
cache_set
*scache_init(
struct
SBP2Device
*dev,
int
sectorSize);
49
#else
50
extern
cache_set
*scache_init(
struct
block_device
*bd);
51
#endif
52
53
extern
void
scache_close(
cache_set
*cache);
54
extern
void
scache_kill(
cache_set
*cache);
// dlanor: added for disconnection events (flush impossible)
55
#if 0
56
extern
int
scache_allocSector(
cache_set
*cache,
unsigned
int
sector,
void
**buf);
57
#endif
58
extern
int
scache_readSector(
cache_set
*cache,
unsigned
int
sector,
void
**buf);
59
extern
int
scache_writeSector(
cache_set
*cache,
unsigned
int
sector);
60
extern
int
scache_flushSectors(
cache_set
*cache);
61
#ifdef BUILDING_USBHDFSD
62
extern
void
scache_invalidate(
cache_set
*cache,
unsigned
int
sector,
int
count
);
63
#endif
/* BUILDING_USBHDFSD */
64
65
extern
void
scache_getStat(
cache_set
*cache,
unsigned
int
*access,
unsigned
int
*hits);
66
67
#endif
block_device
Definition
bdm.h:22
_mass_dev
Definition
usbhdfsd.h:65
SBP2Device
Definition
sbp2_disk.h:126
count
u32 count
start sector of fragmented bd/file
Definition
usbhdfsd-common.h:1
_cache_record
Definition
scache.h:18
_cache_set
Definition
scache.h:25
iop
fs
vfat
src
include
scache.h
Generated on Tue Feb 11 2025 21:35:58 for PS2SDK by
1.12.0