remove trailing spaces
[libfat.git] / source / disc.c
blob90c6444cadaa238cf199fe9f1589a3bf497e9787
1 /*
2 disc.c
3 Interface to the low level disc functions. Used by the higher level
4 file system code.
6 Copyright (c) 2008 Michael "Chishm" Chisholm
8 Redistribution and use in source and binary forms, with or without modification,
9 are permitted provided that the following conditions are met:
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.
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.
30 #include "disc.h"
33 The list of interfaces consists of a series of name/interface pairs.
34 The interface is returned via a simple function. This allows for
35 platforms where the interface has to be "assembled" before it can
36 be used, like DLDI on the NDS. For cases where a simple struct
37 is available, wrapper functions are used.
38 The list is terminated by a NULL/NULL entry.
41 /* ====================== Wii ====================== */
42 #if defined (__wii__)
43 #include <sdcard/wiisd_io.h>
44 #include <ogc/usbstorage.h>
46 static const DISC_INTERFACE* get_io_wiisd (void) {
47 return &__io_wiisd;
49 static const DISC_INTERFACE* get_io_usbstorage (void) {
50 return &__io_usbstorage;
52 const INTERFACE_ID _FAT_disc_interfaces[] = {
53 {"sd", get_io_wiisd},
54 {"usb", get_io_usbstorage},
55 {NULL, NULL}
56 };
58 /* ==================== Gamecube ==================== */
59 #elif defined (__gamecube__)
60 #include <sdcard/gcsd.h>
61 #include <sdcard/wiisd_io.h>
63 static const DISC_INTERFACE* get_io_gcsda (void) {
64 return &__io_gcsda;
66 static const DISC_INTERFACE* get_io_gcsdb (void) {
67 return &__io_gcsdb;
70 const INTERFACE_ID _FAT_disc_interfaces[] = {
71 {"carda", get_io_gcsda},
72 {"cardb", get_io_gcsdb},
73 {NULL, NULL}
74 };
76 /* ====================== NDS ====================== */
77 #elif defined (NDS)
78 #include <nds/arm9/dldi.h>
80 const INTERFACE_ID _FAT_disc_interfaces[] = {
81 {"fat", dldiGetInternal},
82 {NULL, NULL}
83 };
85 /* ====================== GBA ====================== */
86 #elif defined (GBA)
87 #include <disc.h>
89 const INTERFACE_ID _FAT_disc_interfaces[] = {
90 {"fat", discGetInterface},
91 {NULL, NULL}
92 };
94 #endif