PS2SDK
PS2 Homebrew Libraries
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#ifndef __BDM_H__
16#define __BDM_H__
17
18#include <irx.h>
19#include <types.h>
20
22{
23 // Private driver data
24 void *priv;
25
26 // Device name + number + partition number
27 // Can be used to create device names like:
28 // - mass0p1
29 char *name;
30 unsigned int devNr;
31 unsigned int parNr;
32 unsigned char parId;
33
34 unsigned int sectorSize; // Size of a sector in bytes
35 u64 sectorOffset; // Starting sector number
36 u64 sectorCount; // Maximum number of sectors usable
37
38 int (*read)(struct block_device *bd, u64 sector, void *buffer, u16 count);
39 int (*write)(struct block_device *bd, u64 sector, const void *buffer, u16 count);
40 void (*flush)(struct block_device *bd);
41 int (*stop)(struct block_device *bd);
42};
43
45{
46 // Private driver data
47 void *priv;
48
49 // Filesystem (/partition) name
50 char *name;
51
52 // mount / umount block device
53 int (*connect_bd)(struct block_device *bd);
54 void (*disconnect_bd)(struct block_device *bd);
55};
56
57typedef void (*bdm_cb)(int event);
58
59// Exported functions
60void bdm_connect_bd(struct block_device *bd);
61void bdm_disconnect_bd(struct block_device *bd);
62void bdm_connect_fs(struct file_system *fs);
63void bdm_disconnect_fs(struct file_system *fs);
64void bdm_get_bd(struct block_device **pbd, unsigned int count);
65void bdm_RegisterCallback(bdm_cb cb);
66
67#define bdm_IMPORTS_start DECLARE_IMPORT_TABLE(bdm, 1, 1)
68#define bdm_IMPORTS_end END_IMPORT_TABLE
69
70#define I_bdm_connect_bd DECLARE_IMPORT(4, bdm_connect_bd)
71#define I_bdm_disconnect_bd DECLARE_IMPORT(5, bdm_disconnect_bd)
72#define I_bdm_connect_fs DECLARE_IMPORT(6, bdm_connect_fs)
73#define I_bdm_disconnect_fs DECLARE_IMPORT(7, bdm_disconnect_fs)
74#define I_bdm_get_bd DECLARE_IMPORT(8, bdm_get_bd)
75#define I_bdm_RegisterCallback DECLARE_IMPORT(9, bdm_RegisterCallback)
76
77#endif
u32 count
start sector of fragmented bd/file