-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdisc_io.h
100 lines (86 loc) · 2.78 KB
/
disc_io.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// SPDX-License-Identifier: Zlib
// SPDX-FileNotice: Modified from the original version by the BlocksDS project.
// SPDX-FileNotice: Modified from the BlocksDS version to provide a PC version.
//
// Copyright (c) 2006 Michael Chisholm (Chishm) and Tim Seidel (Mighty Max).
#ifndef LIBNDS_NDS_DISC_IO_H__
#define LIBNDS_NDS_DISC_IO_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "types.h"
#define FEATURE_MEDIUM_CANREAD 0x00000001 ///< This driver can be used to read sectors.
#define FEATURE_MEDIUM_CANWRITE 0x00000002 ///< This driver can be used to write sectors.
#define FEATURE_SLOT_GBA 0x00000010 ///< This driver uses Slot-2 cartridges.
#define FEATURE_SLOT_NDS 0x00000020 ///< This driver uses Slot-1 cartridges.
#define FEATURE_ARM7_CAPABLE 0x00000100 ///< This driver can be safely used from ARM7 and ARM9. BlocksDS extension.
typedef struct DISC_INTERFACE_STRUCT
{
/// Four-byte identifier of the device type implemented by this interface.
uint32_t ioType;
/// Available device features.
///
/// @see FEATURE_MEDIUM_CANREAD
/// @see FEATURE_MEDIUM_CANWRITE
/// @see FEATURE_SLOT_GBA
/// @see FEATURE_SLOT_NDS
/// @see FEATURE_ARM7_CAPABLE
uint32_t features;
/// Initialize the device.
///
/// @return
/// True on success.
uint32_t startup;
/// Check if the device's removable storage, if any, is inserted.
///
/// @return
/// True if storage is available.
uint32_t isInserted;
/// Read sectors from the device.
///
/// Sectors are assumed to always be 512 bytes in size. Note that some
/// drivers only support aligned buffers.
///
/// @param sector
/// The sector number.
/// @param numSectors
/// The number of sectors.
/// @param buffer
/// The destination buffer.
///
/// @return
/// True on success.
uint32_t readSectors;
/// Write sectors to the device.
///
/// Sectors are assumed to always be 512 bytes in size. Note that some
/// drivers only support aligned buffers.
///
/// @param sector
/// The sector number.
/// @param numSectors
/// The number of sectors.
/// @param buffer
/// The source buffer.
///
/// @return
/// True on success.
uint32_t writeSectors;
/// Reset the device's error status after an error occured.
///
/// This is not used by applications. Drivers are expected to do this
/// automatically.
///
/// @return
/// True on success.
uint32_t clearStatus;
/// Shut down the device.
///
/// @return
/// True on success.
uint32_t shutdown;
} DISC_INTERFACE;
#ifdef __cplusplus
}
#endif
#endif // LIBNDS_NDS_DISC_IO_H__