diff options
Diffstat (limited to 'sdk-modifications/libsrc/fs/disc_io')
-rwxr-xr-x | sdk-modifications/libsrc/fs/disc_io/disc.c | 194 | ||||
-rwxr-xr-x | sdk-modifications/libsrc/fs/disc_io/disc.h | 128 | ||||
-rwxr-xr-x | sdk-modifications/libsrc/fs/disc_io/disc_io.h | 83 | ||||
-rwxr-xr-x | sdk-modifications/libsrc/fs/disc_io/io_ds2_mmcf.c | 13 | ||||
-rwxr-xr-x | sdk-modifications/libsrc/fs/disc_io/io_ds2_mmcf.h | 63 |
5 files changed, 0 insertions, 481 deletions
diff --git a/sdk-modifications/libsrc/fs/disc_io/disc.c b/sdk-modifications/libsrc/fs/disc_io/disc.c deleted file mode 100755 index 8b50953..0000000 --- a/sdk-modifications/libsrc/fs/disc_io/disc.c +++ /dev/null @@ -1,194 +0,0 @@ -/*
-
- disc.c
-
- uniformed io-interface to work with Chishm's FAT library
-
- Written by MightyMax
-
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2005-11-06 - Chishm
- * Added WAIT_CR modifications for NDS
-
- 2006-02-03 www.neoflash.com
- * Added SUPPORT_* defines, comment out any of the SUPPORT_* defines in disc_io.h to remove support
- for the given interface and stop code being linked to the binary
-
- * Added support for MK2 MMC interface
-
- * Added disc_Cache* functions
-
- 2006-02-05 - Chishm
- * Added Supercard SD support
-
- 2006-02-26 - Cytex
- * Added EFA2 support
-
- 2006-05-18 - Chishm
- * Rewritten for FATlib disc.c
-
- 2006-06-19 - Chishm
- * Changed read and write interface to accept a u32 instead of a u8 for the number of sectors
-
- 2006-07-11 - Chishm
- * Removed disc_Cache* functions, since there is now a proper unified cache
- * Removed SUPPORT_* defines
- * Rewrote device detection functions
- * First libfat release
-
- 2006-07-25 - Chishm
- * Changed IO_INTERFACEs to const
-
- 2006-08-02 - Chishm
- * Added NinjaDS
-*/
-
-#include "disc.h"
-#include "disc_io.h"
-
-// Include known io-interfaces:
-//#include "io_dldi.h"
-//#include "io_mpcf.h"
-//#include "io_m3cf.h"
-//#include "io_m3sd.h"
-//#include "io_sccf.h"
-//#include "io_scsd.h"
-//#include "io_fcsr.h"
-//#include "io_nmmc.h"
-//#include "io_efa2.h"
-//#include "io_mmcf.h"
-//#include "io_njsd.h"
-//#include "io_acekard.h"
-//#include "io_rpg_nand.h"
-//#include "io_rpg_sd.h"
-//#include "iointerface_sc.h" -#include "io_ds2_mmcf.h"
-
-const IO_INTERFACE* ioInterfaces[] = {
- //&_io_dldi,
- //&_io_fcsr,
-#ifdef NDS
- // Place Slot 1 (DS Card) interfaces here
- //&_io_rpg_sd, //&_io_rpg_nand, /*&_io_acekard, */
- // Place Slot 2 (GBA Cart) interfaces here
- //&_io_scsd, &_io_mpcf, &_io_m3cf, &_io_sccf, &_io_m3sd, &_io_fcsr
- // Experimental Slot 2 interfaces
- //, &_io_mmcf, &_io_efa2
- &_io_ds2_mmcf,
-#endif
-};
-
-/*
-
- Hardware level disc funtions
-
-*/
-
-
-const IO_INTERFACE* _FAT_disc_gbaSlotFindInterface (void)
-{
- // If running on an NDS, make sure the correct CPU can access
- // the GBA cart. First implemented by SaTa.
-#ifdef NDS
- #ifdef ARM9
- REG_EXMEMCNT &= ~ARM7_OWNS_ROM;
- #endif
- #ifdef ARM7
- REG_EXMEMCNT |= ARM7_OWNS_ROM;
- #endif
-#endif
-
- int i;
-
- for (i = 0; i < (sizeof(ioInterfaces) / sizeof(IO_INTERFACE*)); i++) {
- if ((ioInterfaces[i]->features & FEATURE_SLOT_GBA) && (ioInterfaces[i]->fn_startup())) {
- return ioInterfaces[i];
- }
- }
- return NULL;
-}
-
-#ifdef NDS
-/*
- * Check the DS card slot for a valid memory card interface
- * If an interface is found, it is set as the default interace
- * and it returns true. Otherwise the default interface is left
- * untouched and it returns false.
- */
-const IO_INTERFACE* _FAT_disc_dsSlotFindInterface (void)
-{
-#ifdef ARM9
- REG_EXMEMCNT &= ~ARM7_OWNS_CARD;
-#endif
-#ifdef ARM7
- REG_EXMEMCNT |= ARM7_OWNS_CARD;
-#endif
- int i;
-
- for (i = 0; i < (sizeof(ioInterfaces) / sizeof(IO_INTERFACE*)); i++) {
- if ((ioInterfaces[i]->features & FEATURE_SLOT_NDS) && (ioInterfaces[i]->fn_startup())) {
- return ioInterfaces[i];
- }
- }
-
- return NULL;
-}
-#endif
-
-/*
- * When running on an NDS, check the either slot for a valid memory
- * card interface.
- * When running on a GBA, call _FAT_disc_gbaSlotFindInterface
- * If an interface is found, it is set as the default interace
- * and it returns true. Otherwise the default interface is left
- * untouched and it returns false.
- */
-#ifdef NDS
-const IO_INTERFACE* _FAT_disc_findInterface (void)
-{
-#ifdef ARM9
- REG_EXMEMCNT &= ~(ARM7_OWNS_CARD | ARM7_OWNS_ROM);
-#endif
-#ifdef ARM7
- REG_EXMEMCNT |= (ARM7_OWNS_CARD | ARM7_OWNS_ROM);
-#endif
-
- int i;
-
- for (i = 0; i < (sizeof(ioInterfaces) / sizeof(IO_INTERFACE*)); i++) {
- if (ioInterfaces[i]->fn_startup()) {
- return ioInterfaces[i];
- }
- }
-
- return NULL;
-}
-#else
-const IO_INTERFACE* _FAT_disc_findInterface (void)
-{
- return _FAT_disc_gbaSlotFindInterface();
-}
-#endif
diff --git a/sdk-modifications/libsrc/fs/disc_io/disc.h b/sdk-modifications/libsrc/fs/disc_io/disc.h deleted file mode 100755 index 2129359..0000000 --- a/sdk-modifications/libsrc/fs/disc_io/disc.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - disc.h - Interface to the low level disc functions. Used by the higher level - file system code. - - Copyright (c) 2006 Michael "Chishm" Chisholm - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation and/or - other materials provided with the distribution. - 3. The name of the author may not be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - 2006-07-11 - Chishm - * Original release - -*/ -#ifndef _DISC_H -#define _DISC_H - -#include "../fs_common.h" -#include "disc_io.h" - -/* -Search for a block based device in the GBA slot. -Return a pointer to a usable interface if one is found, -NULL if not. -*/ -extern const IO_INTERFACE* _FAT_disc_gbaSlotFindInterface (void); - -/* -Search for a block based device in the DS slot. -Return a pointer to a usable interface if one is found, -NULL if not. -*/ -#ifdef NDS -extern const IO_INTERFACE* _FAT_disc_dsSlotFindInterface (void); -#endif - -/* -Search for a block based device in the both slots. -Return a pointer to a usable interface if one is found, -NULL if not. -*/ -extern const IO_INTERFACE* _FAT_disc_findInterface (void); - -/* -Check if a disc is inserted -Return true if a disc is inserted and ready, false otherwise -*/ -static inline bool _FAT_disc_isInserted (const IO_INTERFACE* disc) { - return disc->fn_isInserted(); -} - -/* -Read numSectors sectors from a disc, starting at sector. -numSectors is between 1 and 256 -sector is from 0 to 2^28 -buffer is a pointer to the memory to fill -*/ -//return non-zero is sucess -static inline bool _FAT_disc_readSectors (const IO_INTERFACE* disc, unsigned long sector, unsigned long numSectors, void* buffer) { - return disc->fn_readSectors (sector, numSectors, buffer); -} - -/* -Write numSectors sectors to a disc, starting at sector. -numSectors is between 1 and 256 -sector is from 0 to 2^28 -buffer is a pointer to the memory to read from -*/ -//return non-zero is sucess -static inline bool _FAT_disc_writeSectors (const IO_INTERFACE* disc, unsigned long sector, unsigned long numSectors, const void* buffer) { - return disc->fn_writeSectors (sector, numSectors, buffer); -} - -/* -Reset the card back to a ready state -*/ -static inline bool _FAT_disc_clearStatus (const IO_INTERFACE* disc) { - return disc->fn_clearStatus(); -} - -/* -Initialise the disc to a state ready for data reading or writing -*/ -static inline bool _FAT_disc_startup (const IO_INTERFACE* disc) { - return disc->fn_startup(); -} - -/* -Put the disc in a state ready for power down. -Complete any pending writes and disable the disc if necessary -*/ -static inline bool _FAT_disc_shutdown (const IO_INTERFACE* disc) { - return disc->fn_shutdown(); -} - -/* -Return a 32 bit value unique to each type of interface -*/ -static inline unsigned long _FAT_disc_hostType (const IO_INTERFACE* disc) { - return disc->ioType; -} - -/* -Return a 32 bit value that specifies the capabilities of the disc -*/ -static inline unsigned long _FAT_disc_features (const IO_INTERFACE* disc) { - return disc->features; -} - -#endif // _DISC_H diff --git a/sdk-modifications/libsrc/fs/disc_io/disc_io.h b/sdk-modifications/libsrc/fs/disc_io/disc_io.h deleted file mode 100755 index 6ac0c31..0000000 --- a/sdk-modifications/libsrc/fs/disc_io/disc_io.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - disc_io.h - Interface template for low level disc functions. - - Copyright (c) 2006 Michael "Chishm" Chisholm - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation and/or - other materials provided with the distribution. - 3. The name of the author may not be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - 2006-07-11 - Chishm - * Original release - - 2006-07-16 - Chishm - * Renamed _CF_USE_DMA to _IO_USE_DMA - * Renamed _CF_ALLOW_UNALIGNED to _IO_ALLOW_UNALIGNED -*/ - -#ifndef _DISC_IO_H -#define _DISC_IO_H - -#include "../fs_common.h" - -//---------------------------------------------------------------------- -// Customisable features - -// Use DMA to read the card, remove this line to use normal reads/writes -// #define _IO_USE_DMA - -// Allow buffers not alligned to 16 bits when reading files. -// Note that this will slow down access speed, so only use if you have to. -// It is also incompatible with DMA -//#define _IO_ALLOW_UNALIGNED - -#define _IO_USE_DMA - -#if defined _IO_USE_DMA && defined _IO_ALLOW_UNALIGNED - #error You can't use both DMA and unaligned memory -#endif - -#define FEATURE_MEDIUM_CANREAD 0x00000001 -#define FEATURE_MEDIUM_CANWRITE 0x00000002 -#define FEATURE_SLOT_GBA 0x00000010 -#define FEATURE_SLOT_NDS 0x00000020 - -typedef bool (* FN_MEDIUM_STARTUP)(void) ; -typedef bool (* FN_MEDIUM_ISINSERTED)(void) ; -typedef bool (* FN_MEDIUM_READSECTORS)(unsigned long sector, unsigned long numSectors, void* buffer) ; -typedef bool (* FN_MEDIUM_WRITESECTORS)(unsigned long sector, unsigned long numSectors, const void* buffer) ; -typedef bool (* FN_MEDIUM_CLEARSTATUS)(void) ; -typedef bool (* FN_MEDIUM_SHUTDOWN)(void) ; - -struct IO_INTERFACE_STRUCT { - unsigned long ioType ; - unsigned long features ; - FN_MEDIUM_STARTUP fn_startup ; - FN_MEDIUM_ISINSERTED fn_isInserted ; - FN_MEDIUM_READSECTORS fn_readSectors ; - FN_MEDIUM_WRITESECTORS fn_writeSectors ; - FN_MEDIUM_CLEARSTATUS fn_clearStatus ; - FN_MEDIUM_SHUTDOWN fn_shutdown ; -} ; - -typedef struct IO_INTERFACE_STRUCT IO_INTERFACE ; - -#endif // define _DISC_IO_H diff --git a/sdk-modifications/libsrc/fs/disc_io/io_ds2_mmcf.c b/sdk-modifications/libsrc/fs/disc_io/io_ds2_mmcf.c deleted file mode 100755 index c432d84..0000000 --- a/sdk-modifications/libsrc/fs/disc_io/io_ds2_mmcf.c +++ /dev/null @@ -1,13 +0,0 @@ -//io_ds2_mmcf.c
-#include "io_ds2_mmcf.h"
-
-const IO_INTERFACE _io_ds2_mmcf = {
- DEVICE_TYPE_DS2_MMCF,
- FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE,
- (FN_MEDIUM_STARTUP)&_MMC_StartUp,
- (FN_MEDIUM_ISINSERTED)&_MMC_IsInserted,
- (FN_MEDIUM_READSECTORS)&_MMC_ReadSectors,
- (FN_MEDIUM_WRITESECTORS)&_MMC_WriteSectors,
- (FN_MEDIUM_CLEARSTATUS)&_MMC_ClearStatus,
- (FN_MEDIUM_SHUTDOWN)&_MMC_ShutDown
-};
diff --git a/sdk-modifications/libsrc/fs/disc_io/io_ds2_mmcf.h b/sdk-modifications/libsrc/fs/disc_io/io_ds2_mmcf.h deleted file mode 100755 index 334a9bc..0000000 --- a/sdk-modifications/libsrc/fs/disc_io/io_ds2_mmcf.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef __IO_DS2_H__
-#define __IO_DS2_H__
-
-// 'DS2F'
-#define DEVICE_TYPE_DS2_MMCF 0x46434D4D
-
-#include "disc_io.h"
-#include "ds2_mmc_api.h"
-
-// export interface
-extern const IO_INTERFACE _io_ds2_mmcf ;
-
-/* initialize MMC/SD card */
-static inline bool _MMC_StartUp(void)
-{
- return MMC_Initialize();
-}
-
-/* read multi blocks from MMC/SD card */
-/* read a single block from MMC/SD card */
-static inline bool _MMC_ReadSectors(u32 sector, u32 numSectors, void* buffer)
-{ - int flag; -
- if(numSectors > 1)
- flag= MMC_ReadMultiBlock(sector, numSectors, (unsigned char*)buffer);
- else
- flag= MMC_ReadBlock(sector, (unsigned char*)buffer); - return (flag==MMC_NO_ERROR);
-}
-
-/* write multi blocks from MMC/SD card */
-/* write a single block from MMC/SD card */
-static inline bool _MMC_WriteSectors(u32 sector, u32 numSectors, const void* buffer)
-{
- int flag; - - if(numSectors > 1)
- flag= MMC_WriteMultiBlock(sector, numSectors, (unsigned char*)buffer);
- else
- flag= MMC_WriteBlock(sector, (unsigned char*)buffer); - - return (flag==MMC_NO_ERROR);
-}
-
-static inline bool _MMC_ClearStatus(void)
-{
- return true;
-}
-
-static inline bool _MMC_ShutDown(void)
-{
- return true;
-}
-
-static inline bool _MMC_IsInserted(void)
-{
- return true;
-}
-
-
-#endif //__IO_DS2_H__ - |