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