sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
bdm.h
Go to the documentation of this file.
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Licenced under Academic Free License version 2.0
7# Review ps2sdk README & LICENSE files for further details.
8*/
9
15
16#ifndef __BDM_H__
17#define __BDM_H__
18
19#include <irx.h>
20#include <types.h>
21
23{
24 // Private driver data
25 void *priv;
26
27 // Device name + number + partition number
28 // Can be used to create device names like:
29 // - mass0p1
30 char *name;
31 unsigned int devNr;
32 unsigned int parNr;
33 unsigned char parId;
34
35 unsigned int sectorSize; // Size of a sector in bytes
36 u64 sectorOffset; // Starting sector number
37 u64 sectorCount; // Maximum number of sectors usable
38
39 int (*read)(struct block_device *bd, u64 sector, void *buffer, u16 count);
40 int (*write)(struct block_device *bd, u64 sector, const void *buffer, u16 count);
41 void (*flush)(struct block_device *bd);
42 int (*stop)(struct block_device *bd);
43
44 // Desired iomanX path prefix for this device type (e.g. "usb", "ata").
45 // When set, the fatfs driver exposes the device under this prefix (e.g. usb0:, ata0:).
46 // Partition drivers should copy this from the parent block device.
47 // NULL means the device is only accessible via the legacy "mass:" prefix.
48 char *path;
49};
50
52{
53 // Private driver data
54 void *priv;
55
56 // Filesystem (/partition) name
57 char *name;
58
59 // mount / umount block device
60 int (*connect_bd)(struct block_device *bd);
61 void (*disconnect_bd)(struct block_device *bd);
62};
63
64typedef void (*bdm_cb)(int event);
65
66// Exported functions
67extern void bdm_connect_bd(struct block_device *bd);
68extern void bdm_disconnect_bd(struct block_device *bd);
69extern void bdm_connect_fs(struct file_system *fs);
70extern void bdm_disconnect_fs(struct file_system *fs);
71extern void bdm_get_bd(struct block_device **pbd, unsigned int count);
72extern void bdm_RegisterCallback(bdm_cb cb);
73
74#define bdm_IMPORTS_start DECLARE_IMPORT_TABLE(bdm, 1, 1)
75#define bdm_IMPORTS_end END_IMPORT_TABLE
76
77#define I_bdm_connect_bd DECLARE_IMPORT(4, bdm_connect_bd)
78#define I_bdm_disconnect_bd DECLARE_IMPORT(5, bdm_disconnect_bd)
79#define I_bdm_connect_fs DECLARE_IMPORT(6, bdm_connect_fs)
80#define I_bdm_disconnect_fs DECLARE_IMPORT(7, bdm_disconnect_fs)
81#define I_bdm_get_bd DECLARE_IMPORT(8, bdm_get_bd)
82#define I_bdm_RegisterCallback DECLARE_IMPORT(9, bdm_RegisterCallback)
83
84#endif
u32 count
start sector of fragmented bd/file