RetroArch
disc.h
Go to the documentation of this file.
1 /*
2  disc.h
3  Interface to the low level disc functions. Used by the higher level
4  file system code.
5 
6  Copyright (c) 2006 Michael "Chishm" Chisholm
7 
8  Redistribution and use in source and binary forms, with or without modification,
9  are permitted provided that the following conditions are met:
10 
11  1. Redistributions of source code must retain the above copyright notice,
12  this list of conditions and the following disclaimer.
13  2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation and/or
15  other materials provided with the distribution.
16  3. The name of the author may not be used to endorse or promote products derived
17  from this software without specific prior written permission.
18 
19  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
20  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21  AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
22  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29 #ifndef _DISC_H
30 #define _DISC_H
31 
32 #include "common.h"
33 
34 /*
35 A list of all default devices to try at startup,
36 terminated by a {NULL,NULL} entry.
37 */
38 typedef struct {
39  const char* name;
40  const DISC_INTERFACE* (*getInterface)(void);
41 } INTERFACE_ID;
42 extern const INTERFACE_ID _FAT_disc_interfaces[];
43 
44 /*
45 Check if a disc is inserted
46 Return true if a disc is inserted and ready, false otherwise
47 */
48 static inline bool _FAT_disc_isInserted (const DISC_INTERFACE* disc) {
49  return disc->isInserted();
50 }
51 
52 /*
53 Read numSectors sectors from a disc, starting at sector.
54 numSectors is between 1 and LIMIT_SECTORS if LIMIT_SECTORS is defined,
55 else it is at least 1
56 sector is 0 or greater
57 buffer is a pointer to the memory to fill
58 */
59 static inline bool _FAT_disc_readSectors (const DISC_INTERFACE* disc, sec_t sector, sec_t numSectors, void* buffer) {
60  return disc->readSectors (sector, numSectors, buffer);
61 }
62 
63 /*
64 Write numSectors sectors to a disc, starting at sector.
65 numSectors is between 1 and LIMIT_SECTORS if LIMIT_SECTORS is defined,
66 else it is at least 1
67 sector is 0 or greater
68 buffer is a pointer to the memory to read from
69 */
70 static inline bool _FAT_disc_writeSectors (const DISC_INTERFACE* disc, sec_t sector, sec_t numSectors, const void* buffer) {
71  return disc->writeSectors (sector, numSectors, buffer);
72 }
73 
74 /*
75 Reset the card back to a ready state
76 */
77 static inline bool _FAT_disc_clearStatus (const DISC_INTERFACE* disc) {
78  return disc->clearStatus();
79 }
80 
81 /*
82 Initialise the disc to a state ready for data reading or writing
83 */
84 static inline bool _FAT_disc_startup (const DISC_INTERFACE* disc) {
85  return disc->startup();
86 }
87 
88 /*
89 Put the disc in a state ready for power down.
90 Complete any pending writes and disable the disc if necessary
91 */
92 static inline bool _FAT_disc_shutdown (const DISC_INTERFACE* disc) {
93  return disc->shutdown();
94 }
95 
96 /*
97 Return a 32 bit value unique to each type of interface
98 */
99 static inline uint32_t _FAT_disc_hostType (const DISC_INTERFACE* disc) {
100  return disc->ioType;
101 }
102 
103 /*
104 Return a 32 bit value that specifies the capabilities of the disc
105 */
106 static inline uint32_t _FAT_disc_features (const DISC_INTERFACE* disc) {
107  return disc->features;
108 }
109 
110 #endif // _DISC_H
GLuint const GLchar * name
Definition: glext.h:6671
static bool _FAT_disc_writeSectors(const DISC_INTERFACE *disc, sec_t sector, sec_t numSectors, const void *buffer)
Definition: disc.h:70
static uint32_t _FAT_disc_hostType(const DISC_INTERFACE *disc)
Definition: disc.h:99
static uint32_t _FAT_disc_features(const DISC_INTERFACE *disc)
Definition: disc.h:106
static bool _FAT_disc_readSectors(const DISC_INTERFACE *disc, sec_t sector, sec_t numSectors, void *buffer)
Definition: disc.h:59
FN_MEDIUM_CLEARSTATUS clearStatus
Definition: iosuhax_disc_interface.h:59
static bool _FAT_disc_isInserted(const DISC_INTERFACE *disc)
Definition: disc.h:48
static bool _FAT_disc_shutdown(const DISC_INTERFACE *disc)
Definition: disc.h:92
typedef void(__stdcall *PFN_DESTRUCTION_CALLBACK)(void *pData)
FN_MEDIUM_STARTUP startup
Definition: iosuhax_disc_interface.h:55
static bool _FAT_disc_startup(const DISC_INTERFACE *disc)
Definition: disc.h:84
uint32_t sec_t
Definition: iosuhax_disc_interface.h:40
const INTERFACE_ID _FAT_disc_interfaces[]
Definition: disc.h:38
FN_MEDIUM_SHUTDOWN shutdown
Definition: iosuhax_disc_interface.h:60
FN_MEDIUM_READSECTORS readSectors
Definition: iosuhax_disc_interface.h:57
unsigned long features
Definition: iosuhax_disc_interface.h:54
static bool _FAT_disc_clearStatus(const DISC_INTERFACE *disc)
Definition: disc.h:77
Definition: iosuhax_disc_interface.h:52
unsigned long ioType
Definition: iosuhax_disc_interface.h:53
FN_MEDIUM_ISINSERTED isInserted
Definition: iosuhax_disc_interface.h:56
Definition: video4linux2.c:51
unsigned int uint32_t
Definition: stdint.h:126
FN_MEDIUM_WRITESECTORS writeSectors
Definition: iosuhax_disc_interface.h:58