|
RetroArch
|
#include <stdlib.h>#include <stdio.h>#include <string.h>#include <malloc.h>#include <time.h>#include <gcutil.h>#include "asm.h"#include "processor.h"#include "system.h"#include "ogcsys.h"#include "cache.h"#include "dsp.h"#include "lwp.h"#include "exi.h"#include "card.h"Classes | |
| struct | card_header |
| struct | card_direntry |
| struct | card_dat |
| struct | card_dircntrl |
| struct | card_bat |
| struct | _card_block |
Macros | |
| #define | CARD_SYSAREA 5 |
| #define | CARD_SYSDIR 0x2000 |
| #define | CARD_SYSDIR_BACK 0x4000 |
| #define | CARD_SYSBAT 0x6000 |
| #define | CARD_SYSBAT_BACK 0x8000 |
| #define | _SHIFTL(v, s, w) ((u32) (((u32)(v) & ((0x01 << (w)) - 1)) << (s))) |
| #define | _SHIFTR(v, s, w) ((u32)(((u32)(v) >> (s)) & ((0x01 << (w)) - 1))) |
| #define | _ROTL(v, s) (((u32)v<<s)|((u32)v>>(0x20-s))) |
| #define | CARD_STATUS_UNLOCKED 0x40 |
Typedefs | |
| typedef struct _card_block | card_block |
Functions | |
| static void | __card_mountcallback (s32 chn, s32 result) |
| static void | __erase_callback (s32 chn, s32 result) |
| static s32 | __dounlock (s32 chn, u32 *key) |
| static s32 | __card_readsegment (s32 chn, cardcallback callback) |
| static s32 | __card_read (s32 chn, u32 address, u32 block_len, void *buffer, cardcallback callback) |
| static s32 | __card_updatefat (s32 chn, struct card_bat *fatblock, cardcallback callback) |
| static s32 | __card_updatedir (s32 chn, cardcallback callback) |
| static s32 | __card_write (s32 chn, u32 address, u32 block_len, void *buffer, cardcallback callback) |
| static s32 | __card_writepage (s32 chn, cardcallback callback) |
| static s32 | __card_sectorerase (s32 chn, u32 sector, cardcallback callback) |
| static s32 | __card_onreset (s32 final) |
| unsigned long | gettick () |
| long long | gettime () |
| syssram * | __SYS_LockSram () |
| syssramex * | __SYS_LockSramEx () |
| u32 | __SYS_UnlockSram (u32 write) |
| u32 | __SYS_UnlockSramEx (u32 write) |
| static void | __card_checksum (u16 *buff, u32 len, u16 *cs1, u16 *cs2) |
| static s32 | __card_putcntrlblock (card_block *card, s32 result) |
| static s32 | __card_getcntrlblock (s32 chn, card_block **card) |
| static __inline__ struct card_dat * | __card_getdirblock (card_block *card) |
| static __inline__ struct card_bat * | __card_getbatblock (card_block *card) |
| static s32 | __card_sync (s32 chn) |
| static void | __card_synccallback (s32 chn, s32 result) |
| static void | __card_updateiconoffsets (struct card_direntry *entry, card_stat *stats) |
| static s32 | __card_getstatusex (s32 chn, s32 fileno, struct card_direntry *entry) |
| static s32 | __card_setstatusexasync (s32 chn, s32 fileno, struct card_direntry *entry, cardcallback callback) |
| static s32 | __card_getfilenum (card_block *card, const char *filename, const char *gamecode, const char *company, s32 *fileno) |
| static s32 | __card_seek (card_file *file, s32 len, s32 offset, card_block **rcard) |
| static u32 | __card_checkdir (card_block *card, u32 *currdir) |
| static u32 | __card_checkfat (card_block *card, u32 *currfat) |
| static s32 | __card_verify (card_block *card) |
| static u32 | __card_iscard (u32 id) |
| static s32 | __card_allocblock (s32 chn, u32 blocksneed, cardcallback callback) |
| static s32 | __card_freeblock (s32 chn, u16 block, cardcallback callback) |
| static s32 | __card_unlockedhandler (s32 chn, s32 dev) |
| static s32 | __card_readstatus (s32 chn, u8 *pstatus) |
| static s32 | __card_clearstatus (s32 chn) |
| static s32 | __card_enableinterrupt (s32 chn, u32 enable) |
| static s32 | __card_txhandler (s32 chn, s32 dev) |
| static void | __timeouthandler (syswd_t alarm, void *cbarg) |
| static void | __setuptimeout (card_block *card) |
| static s32 | __retry (s32 chn) |
| static void | __card_defaultapicallback (s32 chn, s32 result) |
| static s32 | __card_exihandler (s32 chn, s32 dev) |
| static s32 | __card_exthandler (s32 chn, s32 dev) |
| static void | __write_callback (s32 chn, s32 result) |
| static void | __read_callback (s32 chn, s32 result) |
| static void | __delete_callback (s32 chn, s32 result) |
| static void | __format_callback (s32 chn, s32 result) |
| static void | __blockwritecallback (s32 chn, s32 result) |
| static void | __blockreadcallback (s32 chn, s32 result) |
| static void | __unlocked_callback (s32 chn, s32 result) |
| static s32 | __card_start (s32 chn, cardcallback tx_cb, cardcallback exi_cb) |
| static void | __card_fatwritecallback (s32 chn, s32 result) |
| static void | __card_dirwritecallback (s32 chn, s32 result) |
| static s32 | __card_formatregion (s32 chn, u32 encode, cardcallback callback) |
| static void | __card_faterasecallback (s32 chn, s32 result) |
| static void | __card_direrasecallback (s32 chn, s32 result) |
| static void | __card_createfatcallback (s32 chn, s32 result) |
| static void | __card_dounmount (s32 chn, s32 result) |
| static s32 | __card_domount (s32 chn) |
| static __inline__ void | __card_srand (u32 val) |
| static __inline__ u32 | __card_rand () |
| static u32 | __card_initval () |
| static u32 | __card_dummylen () |
| static u32 | exnor_1st (u32 a, u32 b) |
| static u32 | exnor (u32 a, u32 b) |
| static u32 | bitrev (u32 val) |
| static s32 | __card_readarrayunlock (s32 chn, u32 address, void *buffer, u32 len, u32 flag) |
| static void | __dsp_initcallback (dsptask_t *task) |
| static u8 tmp_buffer [64] | ATTRIBUTE_ALIGN (32) |
| static void | __dsp_donecallback (dsptask_t *task) |
| s32 | CARD_Init (const char *gamecode, const char *company) |
| Performs the initialization of the memory card subsystem. More... | |
| s32 | CARD_Probe (s32 chn) |
| Performs a check against the desired EXI channel if a device is inserted. More... | |
| s32 | CARD_ProbeEx (s32 chn, s32 *mem_size, s32 *sect_size) |
| Performs a check against the desired EXI channel if a memory card is inserted or mounted. More... | |
| s32 | CARD_MountAsync (s32 chn, void *workarea, cardcallback detach_cb, cardcallback attach_cb) |
| Mounts the memory card in the slot CHN. This function returns immediately. Asynchronous version. More... | |
| s32 | CARD_Mount (s32 chn, void *workarea, cardcallback detach_cb) |
| Mounts the memory card in the slot CHN. Synchronous version. More... | |
| s32 | CARD_Unmount (s32 chn) |
| Unmounts the memory card in the slot CHN and releases the EXI bus. More... | |
| s32 | CARD_ReadAsync (card_file *file, void *buffer, u32 len, u32 offset, cardcallback callback) |
| Reads the data from the file into the buffer from the given offset with the given length. This function returns immediately. Asynchronous version. More... | |
| s32 | CARD_Read (card_file *file, void *buffer, u32 len, u32 offset) |
| Reads the data from the file into the buffer from the given offset with the given length. Synchronous version. More... | |
| s32 | CARD_WriteAsync (card_file *file, void *buffer, u32 len, u32 offset, cardcallback callback) |
| Writes the data to the file from the buffer to the given offset with the given length. This function returns immediately. Asynchronous version. More... | |
| s32 | CARD_Write (card_file *file, void *buffer, u32 len, u32 offset) |
| Writes the data to the file from the buffer to the given offset with the given length. Synchronous version. More... | |
| s32 | CARD_CreateAsync (s32 chn, const char *filename, u32 size, card_file *file, cardcallback callback) |
| Creates a new file with the given filename and fills in the fileinformations. This function returns immediately. Asynchronous version. More... | |
| s32 | CARD_Create (s32 chn, const char *filename, u32 size, card_file *file) |
| Creates a new file with the given filename and fills in the fileinformations. Synchronous version. More... | |
| s32 | CARD_CreateEntryAsync (s32 chn, card_dir *direntry, card_file *file, cardcallback callback) |
| Creates a new file with the given filename and fills in the fileinformations. This function returns immediately. Asynchronous version. More... | |
| s32 | CARD_CreateEntry (s32 chn, card_dir *direntry, card_file *file) |
| Creates a new file with the given filename and fills in the fileinformations. Synchronous version. More... | |
| s32 | CARD_Open (s32 chn, const char *filename, card_file *file) |
| Opens the file with the given filename and fills in the fileinformations. More... | |
| s32 | CARD_OpenEntry (s32 chn, card_dir *entry, card_file *file) |
| Opens the file with the given filename and fills in the fileinformations. More... | |
| s32 | CARD_Close (card_file *file) |
| Closes the file with the given card_file structure and releases the handle. More... | |
| s32 | CARD_DeleteAsync (s32 chn, const char *filename, cardcallback callback) |
| Deletes a file with the given filename. This function returns immediately. Asynchronous version. More... | |
| s32 | CARD_Delete (s32 chn, const char *filename) |
| Deletes a file with the given filename. Synchronous version. More... | |
| s32 | CARD_DeleteEntryAsync (s32 chn, card_dir *dir_entry, cardcallback callback) |
| Deletes a file with the given directory entry informations. This function returns immediately. Asynchronous version. More... | |
| s32 | CARD_DeleteEntry (s32 chn, card_dir *dir_entry) |
| Deletes a file with the given directory entry informations. More... | |
| s32 | CARD_FormatAsync (s32 chn, cardcallback callback) |
| s32 | CARD_Format (s32 chn) |
| s32 | CARD_GetErrorCode (s32 chn) |
| Returns the result code from the last operation. More... | |
| s32 | __card_findnext (card_dir *dir) |
| s32 | CARD_FindFirst (s32 chn, card_dir *dir, bool showall) |
| Start to iterate thru the memory card's directory structure and returns the first directory entry. More... | |
| s32 | CARD_FindNext (card_dir *dir) |
| Returns the next directory entry from the memory cards directory structure. More... | |
| s32 | CARD_GetDirectory (s32 chn, card_dir *dir_entries, s32 *count, bool showall) |
| Returns the directory entries. size of entries is max. 128. More... | |
| s32 | CARD_GetSectorSize (s32 chn, u32 *sector_size) |
| Returns the next directory entry from the memory cards directory structure. More... | |
| s32 | CARD_GetBlockCount (s32 chn, u32 *block_count) |
| Returns the next directory entry from the memory cards directory structure. More... | |
| s32 | CARD_GetStatus (s32 chn, s32 fileno, card_stat *stats) |
| Get additional file statistic informations. More... | |
| s32 | CARD_SetStatusAsync (s32 chn, s32 fileno, card_stat *stats, cardcallback callback) |
| Set additional file statistic informations. This function returns immediately. Asynchronous version. More... | |
| s32 | CARD_SetStatus (s32 chn, s32 fileno, card_stat *stats) |
| Set additional file statistic informations. Synchronous version. More... | |
| s32 | CARD_GetAttributes (s32 chn, s32 fileno, u8 *attr) |
| Get additional file attributes. Synchronous version. More... | |
| s32 | CARD_SetAttributesAsync (s32 chn, s32 fileno, u8 attr, cardcallback callback) |
| Set additional file attributes. This function returns immediately. Asynchronous version. More... | |
| s32 | CARD_SetAttributes (s32 chn, s32 fileno, u8 attr) |
| Set additional file attributes. Synchronous version. More... | |
| s32 | CARD_SetCompany (const char *company) |
| Set additional file attributes. This function returns immediately. Asynchronous version. More... | |
| s32 | CARD_SetGamecode (const char *gamecode) |
| Set additional file attributes. This function returns immediately. Asynchronous version. More... | |
Variables | |
| struct card_header | ATTRIBUTE_PACKED |
| static u32 | card_sector_size [] |
| static u32 | card_latency [] |
| static u32 | card_inited = 0 |
| static u32 | crand_next = 1 |
| static u8 | card_gamecode [4] = {0xff,0xff,0xff,0xff} |
| static u8 | card_company [2] = {0xff,0xff} |
| static card_block | cardmap [2] |
| static sys_resetinfo | card_resetinfo |
| static vu16 *const | _viReg = (u16*)0xCC002000 |
| #define CARD_STATUS_UNLOCKED 0x40 |
| #define CARD_SYSAREA 5 |
| #define CARD_SYSBAT 0x6000 |
| #define CARD_SYSBAT_BACK 0x8000 |
| #define CARD_SYSDIR 0x2000 |
| #define CARD_SYSDIR_BACK 0x4000 |
| typedef struct _card_block card_block |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| syssram* __SYS_LockSram | ( | ) |
| syssramex* __SYS_LockSramEx | ( | ) |
|
static |
Closes the file with the given card_file structure and releases the handle.
| [in] | file | pointer to the card_file structure to close. |
Creates a new file with the given filename and fills in the fileinformations. Synchronous version.
| [in] | chn | CARD slot |
| [in] | filename | name of the file to create. |
| [in] | size | size of the newly created file. This must be a multiple of the memory card's sector size. |
| [out] | file | pointer to the card_file structure. It receives the fileinformations for later usage. |
| s32 CARD_CreateAsync | ( | s32 | chn, |
| const char * | filename, | ||
| u32 | size, | ||
| card_file * | file, | ||
| cardcallback | callback | ||
| ) |
Creates a new file with the given filename and fills in the fileinformations. This function returns immediately. Asynchronous version.
| [in] | chn | CARD slot |
| [in] | filename | name of the file to create. |
| [in] | size | size of the newly created file. This must be a multiple of the memory card's sector size. |
| [out] | file | pointer to the card_file structure. It receives the fileinformations for later usage. |
| [in] | callback | pointer to a callback function. This callback will be called when the create process has finished. |
Creates a new file with the given filename and fills in the fileinformations. Synchronous version.
| [in] | chn | CARD slot |
| [in] | entry | pointer to the directory entry to create. |
| [out] | file | pointer to the card_file structure. It receives the fileinformations for later usage. |
| s32 CARD_CreateEntryAsync | ( | s32 | chn, |
| card_dir * | direntry, | ||
| card_file * | file, | ||
| cardcallback | callback | ||
| ) |
Creates a new file with the given filename and fills in the fileinformations. This function returns immediately. Asynchronous version.
| [in] | chn | CARD slot |
| [in] | entry | pointer to the directory entry to create |
| [out] | file | pointer to the card_file structure. It receives the fileinformations for later usage. |
| [in] | callback | pointer to a callback function. This callback will be called when the create process has finished. |
Deletes a file with the given filename. Synchronous version.
| [in] | chn | CARD slot |
| [in] | filename | name of the file to delete. |
| s32 CARD_DeleteAsync | ( | s32 | chn, |
| const char * | filename, | ||
| cardcallback | callback | ||
| ) |
Deletes a file with the given filename. This function returns immediately. Asynchronous version.
| [in] | chn | CARD slot |
| [in] | filename | name of the file to delete. |
| [in] | callback | pointer to a callback function. This callback will be called when the delete process has finished. |
Deletes a file with the given directory entry informations.
| [in] | chn | CARD slot |
| [in] | dir_entry | pointer to the card_dir structure which holds the informations for the delete operation. |
| s32 CARD_DeleteEntryAsync | ( | s32 | chn, |
| card_dir * | dir_entry, | ||
| cardcallback | callback | ||
| ) |
Deletes a file with the given directory entry informations. This function returns immediately. Asynchronous version.
| [in] | chn | CARD slot |
| [in] | dir_entry | pointer to the card_dir structure which holds the informations for the delete operation. |
| [in] | callback | pointer to a callback function. This callback will be called when the delete process has finished. |
Start to iterate thru the memory card's directory structure and returns the first directory entry.
| [in] | chn | CARD slot |
| [out] | dir | pointer to card_dir structure to receive the result set. |
| [in] | showall | Whether to show all files of the memory card or only those which are identified by the company and gamecode string. |
Returns the next directory entry from the memory cards directory structure.
| [out] | dir | pointer to card_dir structure to receive the result set. |
| s32 CARD_FormatAsync | ( | s32 | chn, |
| cardcallback | callback | ||
| ) |
Not finished function
Get additional file attributes. Synchronous version.
| [in] | chn | CARD slot. |
| [in] | fileno | file index. returned by a previous call to CARD_Open(). |
| [out] | attr | pointer to receive attribute value. |
Returns the next directory entry from the memory cards directory structure.
| [in] | chn | CARD slot. |
| [out] | sector_size | pointer to receive the result. |
Returns the directory entries. size of entries is max. 128.
| [in] | chn | CARD slot |
| [out] | dir_entries | pointer to card_dir structure to receive the result set. |
| [out] | count | pointer to an integer to receive the counted entries. |
| [in] | showall | Whether to show all files of the memory card or only those which are identified by the company and gamecode string. |
Returns the result code from the last operation.
| [in] | chn | CARD slot |
Returns the next directory entry from the memory cards directory structure.
| [in] | chn | CARD slot. |
| [out] | sector_size | pointer to receive the result. |
Get additional file statistic informations.
| [in] | chn | CARD slot. |
| [in] | fileno | file index. returned by a previous call to CARD_Open(). |
| [out] | stats | pointer to receive the result set. |
Performs the initialization of the memory card subsystem.
| [in] | gamecode | pointer to a 4byte long string to specify the vendors game code. May be NULL |
| [in] | company | pointer to a 2byte long string to specify the vendors company code. May be NULL |
| s32 CARD_Mount | ( | s32 | chn, |
| void * | workarea, | ||
| cardcallback | detach_cb | ||
| ) |
Mounts the memory card in the slot CHN. Synchronous version.
| [in] | chn | CARD slot |
| [in] | workarea | pointer to memory area to hold the cards system area. The startaddress of the workdarea should be aligned on a 32byte boundery |
| [in] | detach_cb | pointer to a callback function. This callback function will be called when the card is removed from the slot. |
| s32 CARD_MountAsync | ( | s32 | chn, |
| void * | workarea, | ||
| cardcallback | detach_cb, | ||
| cardcallback | attach_cb | ||
| ) |
Mounts the memory card in the slot CHN. This function returns immediately. Asynchronous version.
| [in] | chn | CARD slot |
| [in] | workarea | pointer to memory area to hold the cards system area. The startaddress of the workdarea should be aligned on a 32byte boundery |
| [in] | detach_cb | pointer to a callback function. This callback function will be called when the card is removed from the slot. |
| [in] | attach_cb | pointer to a callback function. This callback function will be called when the mount process has finished. |
Opens the file with the given filename and fills in the fileinformations.
| [in] | chn | CARD slot |
| [in] | filename | name of the file to open. |
| [out] | file | pointer to the card_file structure. It receives the fileinformations for later usage. |
Opens the file with the given filename and fills in the fileinformations.
| [in] | chn | CARD slot |
| [in] | entry | pointer to the directory entry to open. |
| [out] | file | pointer to the card_file structure. It receives the fileinformations for later usage. |
Performs a check against the desired EXI channel if a device is inserted.
| [in] | chn | CARD slot |
Performs a check against the desired EXI channel if a memory card is inserted or mounted.
| [in] | chn | CARD slot |
| [out] | mem_size | pointer to a integer variable, ready to take the resulting value (this param is optional and can be NULL) |
| [out] | sect_size | pointer to a integer variable, ready to take the resulting value (this param is optional and can be NULL) |
Reads the data from the file into the buffer from the given offset with the given length. Synchronous version.
| [in] | file | pointer to the card_file structure. It holds the fileinformations to read from. |
| [out] | buffer | pointer to memory area read-in the data. The startaddress of the buffer should be aligned to a 32byte boundery. |
| [in] | len | length of data to read. |
| [in] | offset | offset into the file to read from. |
Reads the data from the file into the buffer from the given offset with the given length. This function returns immediately. Asynchronous version.
| [in] | file | pointer to the card_file structure. It holds the fileinformations to read from. |
| [out] | buffer | pointer to memory area read-in the data. The startaddress of the buffer should be aligned to a 32byte boundery. |
| [in] | len | length of data to read. |
| [in] | offset | offset into the file to read from. |
| [in] | callback | pointer to a callback function. This callback will be called when the read process has finished. |
Set additional file attributes. Synchronous version.
| [in] | chn | CARD slot. |
| [in] | fileno | file index. returned by a previous call to CARD_Open(). |
| [in] | attr | attribute value to set. |
| s32 CARD_SetAttributesAsync | ( | s32 | chn, |
| s32 | fileno, | ||
| u8 | attr, | ||
| cardcallback | callback | ||
| ) |
Set additional file attributes. This function returns immediately. Asynchronous version.
| [in] | chn | CARD slot. |
| [in] | fileno | file index. returned by a previous call to CARD_Open(). |
| [in] | attr | attribute value to set. |
| [in] | callback | pointer to a callback function. This callback will be called when the setattributes process has finished. |
Set additional file attributes. This function returns immediately. Asynchronous version.
| [in] | chn | CARD slot. |
Set additional file attributes. This function returns immediately. Asynchronous version.
| [in] | chn | CARD slot. |
Set additional file statistic informations. Synchronous version.
| [in] | chn | CARD slot. |
| [in] | fileno | file index. returned by a previous call to CARD_Open(). |
| [out] | stats | pointer which holds the informations to set. |
| s32 CARD_SetStatusAsync | ( | s32 | chn, |
| s32 | fileno, | ||
| card_stat * | stats, | ||
| cardcallback | callback | ||
| ) |
Set additional file statistic informations. This function returns immediately. Asynchronous version.
| [in] | chn | CARD slot. |
| [in] | fileno | file index. returned by a previous call to CARD_Open(). |
| [out] | stats | pointer which holds the informations to set. |
| [in] | callback | pointer to a callback function. This callback will be called when the setstatus process has finished. |
Unmounts the memory card in the slot CHN and releases the EXI bus.
| [in] | chn | CARD slot |
Writes the data to the file from the buffer to the given offset with the given length. Synchronous version.
| [in] | file | pointer to the card_file structure which holds the fileinformations. |
| [in] | buffer | pointer to the memory area to read from. The startaddress of the buffer should be aligned on a 32byte boundery. |
| [in] | len | length of data to write. |
| [in] | offset | starting point in the file to start writing. |
Writes the data to the file from the buffer to the given offset with the given length. This function returns immediately. Asynchronous version.
| [in] | file | pointer to the card_file structure which holds the fileinformations. |
| [in] | buffer | pointer to the memory area to read from. The startaddress of the buffer should be aligned on a 32byte boundery. |
| [in] | len | length of data to write. |
| [in] | offset | starting point in the file to start writing. |
| [in] | callback | pointer to a callback function. This callback will be called when the write process has finished. |
| unsigned long gettick | ( | ) |
| long long gettime | ( | ) |
| struct card_bat ATTRIBUTE_PACKED |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
1.8.15