PS2SDK
PS2 Homebrew Libraries
libmc.c File Reference
#include <tamtypes.h>
#include <kernel.h>
#include <sifrpc.h>
#include <string.h>
#include <iopcontrol.h>
#include "libmc.h"
+ Include dependency graph for libmc.c:

Go to the source code of this file.

Data Structures

struct  libmc_name_param_stru
 
union  libmc_name_desc_param_unio
 
union  libmc_rdata_param_unio
 
struct  libmc_page_read_align_data_stru
 
union  libmc_extra_send_recv_unio
 
struct  mcExtraEndParam_
 
struct  libmc_interface_data_stru
 
struct  libmc_internal_data_
 
struct  libmc_target_desc_
 
union  libmc_name_param_stru.__unnamed__
 

Macros

#define LIBMC_PRE_CHECK_FLAG_ONLY_TYPE   1
 
#define LIBMC_PRE_RPC(target, flags, only_type)
 

Typedefs

typedef struct mcExtraEndParam_ mcExtraEndParam_t
 
typedef struct libmc_internal_data_ libmc_internal_data_t
 
typedef struct libmc_target_desc_ libmc_target_desc_t
 

Enumerations

enum  MC_RPCCMD_NUMBERS {
  MC_RPCCMD_INIT = 0x00, MC_RPCCMD_GET_INFO, MC_RPCCMD_OPEN, MC_RPCCMD_CLOSE,
  MC_RPCCMD_SEEK, MC_RPCCMD_READ, MC_RPCCMD_WRITE, MC_RPCCMD_FLUSH,
  MC_RPCCMD_CH_DIR, MC_RPCCMD_GET_DIR, MC_RPCCMD_SET_INFO, MC_RPCCMD_DELETE,
  MC_RPCCMD_FORMAT, MC_RPCCMD_UNFORMAT, MC_RPCCMD_GET_ENT, MC_RPCCMD_CHG_PRITY,
  MC_RPCCMD_CHECK_BLOCK, MC_RPCCMD_ERASE_BLOCK = 0x0E, MC_RPCCMD_READ_PAGE, MC_RPCCMD_WRITE_PAGE
}
 
enum  MC_INTERFACE { MC_INTERFACE_SIO2 = 0, MC_INTERFACE_DEV9, MC_INTERFACE_MAX }
 

Functions

static int libmc_pre_rpc_impl (const libmc_target_desc_t *target, int flags, int only_type)
 
static int libmc_post_rpc (const libmc_target_desc_t *target, int cmd, int desc_param_or_name_param, SifRpcEndFunc_t end_function, void *end_param)
 
static void libmc_setup_target (libmc_target_desc_t *target, int interface, int port, int slot, int fd)
 
static void mcGetInfoApdxOld (void *arg)
 
static void mcGetInfoApdxNew (void *arg)
 
static void mcReadFixAlignOld (void *arg)
 
static void mcReadFixAlignNew (void *arg)
 
static void mcStoreDir (void *arg)
 
static void libmc_ReadAlignFunction (void *arg)
 
static int libmc_rpc_reset (const libmc_target_desc_t *target)
 
static int libmc_rpc_init (const libmc_target_desc_t *target)
 
static int libmc_rpc_get_info (const libmc_target_desc_t *target, int *type, int *free, int *format)
 
static int libmc_rpc_open (const libmc_target_desc_t *target, const char *name, int mode)
 
static int libmc_rpc_close (const libmc_target_desc_t *target)
 
static int libmc_rpc_seek (const libmc_target_desc_t *target, int offset, int origin)
 
static int libmc_rpc_read (const libmc_target_desc_t *target, void *buffer, int size)
 
static int libmc_rpc_write (const libmc_target_desc_t *target, const void *buffer, int size)
 
static int libmc_rpc_flush (const libmc_target_desc_t *target)
 
static int libmc_rpc_mkdir (const libmc_target_desc_t *target, const char *name)
 
static int libmc_rpc_chdir (const libmc_target_desc_t *target, const char *newDir, char *currentDir)
 
static int libmc_rpc_getdir (const libmc_target_desc_t *target, const char *name, unsigned mode, int maxent, sceMcTblGetDir *table)
 
static int libmc_rpc_setfileinfo (const libmc_target_desc_t *target, const char *name, const sceMcTblGetDir *info, unsigned flags)
 
static int libmc_rpc_delete (const libmc_target_desc_t *target, const char *name)
 
static int libmc_rpc_format (const libmc_target_desc_t *target)
 
static int libmc_rpc_unformat (const libmc_target_desc_t *target)
 
static int libmc_rpc_get_ent_space (const libmc_target_desc_t *target, const char *path)
 
static int libmc_rpc_rename (const libmc_target_desc_t *target, const char *oldName, const char *newName)
 
static int libmc_rpc_erase_block (const libmc_target_desc_t *target, int block, int mode)
 
static int libmc_rpc_read_page (const libmc_target_desc_t *target, unsigned int page, void *buffer)
 
static int libmc_rpc_write_page (const libmc_target_desc_t *target, int page, const void *buffer)
 
static int libmc_rpc_change_thread_priority (const libmc_target_desc_t *target, int level)
 
static int libmc_rpc_sync (const libmc_target_desc_t *target, int mode, int *cmd, int *result)
 
int mcInit (int type)
 
int mcGetInfo (int port, int slot, int *type, int *free, int *format)
 
int mcOpen (int port, int slot, const char *name, int mode)
 
int mcClose (int fd)
 
int mcSeek (int fd, int offset, int origin)
 
int mcRead (int fd, void *buffer, int size)
 
int mcWrite (int fd, const void *buffer, int size)
 
int mcFlush (int fd)
 
int mcMkDir (int port, int slot, const char *name)
 
int mcChdir (int port, int slot, const char *newDir, char *currentDir)
 
int mcGetDir (int port, int slot, const char *name, unsigned mode, int maxent, sceMcTblGetDir *table)
 
int mcSetFileInfo (int port, int slot, const char *name, const sceMcTblGetDir *info, unsigned flags)
 
int mcDelete (int port, int slot, const char *name)
 
int mcFormat (int port, int slot)
 
int mcUnformat (int port, int slot)
 
int mcGetEntSpace (int port, int slot, const char *path)
 
int mcRename (int port, int slot, const char *oldName, const char *newName)
 
int mcEraseBlock (int port, int slot, int block, int mode)
 
int mcReadPage (int port, int slot, unsigned int page, void *buffer)
 
int mcWritePage (int port, int slot, int page, const void *buffer)
 
int mcChangeThreadPriority (int level)
 
int mcSync (int mode, int *cmd, int *result)
 
int mcReset (void)
 
int xfromInit (int type)
 
int xfromGetInfo (int port, int slot, int *type, int *free, int *format)
 
int xfromOpen (int port, int slot, const char *name, int mode)
 
int xfromClose (int fd)
 
int xfromSeek (int fd, int offset, int origin)
 
int xfromRead (int fd, void *buffer, int size)
 
int xfromWrite (int fd, const void *buffer, int size)
 
int xfromFlush (int fd)
 
int xfromMkDir (int port, int slot, const char *name)
 
int xfromChdir (int port, int slot, const char *newDir, char *currentDir)
 
int xfromGetDir (int port, int slot, const char *name, unsigned mode, int maxent, sceMcTblGetDir *table)
 
int xfromSetFileInfo (int port, int slot, const char *name, const sceMcTblGetDir *info, unsigned flags)
 
int xfromDelete (int port, int slot, const char *name)
 
int xfromFormat (int port, int slot)
 
int xfromUnformat (int port, int slot)
 
int xfromGetEntSpace (int port, int slot, const char *path)
 
int xfromRename (int port, int slot, const char *oldName, const char *newName)
 
int xfromEraseBlock (int port, int slot, int block, int mode)
 
int xfromReadPage (int port, int slot, unsigned int page, void *buffer)
 
int xfromWritePage (int port, int slot, int page, const void *buffer)
 
int xfromChangeThreadPriority (int level)
 
int xfromSync (int mode, int *cmd, int *result)
 
int xfromReset (void)
 

Variables

static const int mcRpcCmd [2][17]
 
static libmc_internal_data_t g_libmc_internal_data
 

Detailed Description

Function defenitions for mclib.

Definition in file libmc.c.


Data Structure Documentation

◆ libmc_name_param_stru

struct libmc_name_param_stru

Definition at line 97 of file libmc.c.

Data Fields
int m_port
int m_slot
int m_flags
int m_maxent
union libmc_name_param_stru __unnamed__
char m_name[1024]

◆ libmc_name_desc_param_unio

union libmc_name_desc_param_unio

Definition at line 111 of file libmc.c.

+ Collaboration diagram for libmc_name_desc_param_unio:
Data Fields
struct libmc_name_param_stru m_name_param
mcDescParam_t m_desc_param

◆ libmc_rdata_param_unio

union libmc_rdata_param_unio

Definition at line 117 of file libmc.c.

+ Collaboration diagram for libmc_rdata_param_unio:
Data Fields
int m_result
mcRpcStat_t m_rpcStat
u8 m_buffer[2048]

◆ libmc_page_read_align_data_stru

struct libmc_page_read_align_data_stru

Definition at line 124 of file libmc.c.

Data Fields
unsigned int m_size1
unsigned int m_size2
void * m_dest1
void * m_dest2
unsigned char m_data1[16]
unsigned char m_data2[16]
unsigned char m_padding[16]

◆ libmc_extra_send_recv_unio

union libmc_extra_send_recv_unio

Definition at line 135 of file libmc.c.

+ Collaboration diagram for libmc_extra_send_recv_unio:
Data Fields
int m_end_parameter[48]
char m_cur_dir[1024]
sceMcTblGetDir m_file_info_buff
struct libmc_page_read_align_data_stru m_page_read_align_data

◆ mcExtraEndParam_

struct mcExtraEndParam_

Definition at line 143 of file libmc.c.

+ Collaboration diagram for mcExtraEndParam_:
Data Fields
union libmc_extra_send_recv_unio * m_extra_send_recv_param
int * m_p_type
int * m_p_free
int * m_p_format
int * m_p_result
char * m_dst_cur_dir

◆ libmc_internal_data_

struct libmc_internal_data_

Definition at line 171 of file libmc.c.

+ Collaboration diagram for libmc_internal_data_:
Data Fields
struct libmc_interface_data_stru m_interface_data[MC_INTERFACE_MAX]

◆ libmc_target_desc_

struct libmc_target_desc_

Definition at line 178 of file libmc.c.

+ Collaboration diagram for libmc_target_desc_:
Data Fields
struct libmc_interface_data_stru * m_interface_data
int m_interface
int m_port
int m_slot
int m_fd

◆ libmc_name_param_stru.__unnamed__

union libmc_name_param_stru.__unnamed__

Definition at line 103 of file libmc.c.

Data Fields
sceMcTblGetDir * m_mcT
char * m_curdir

Macro Definition Documentation

◆ LIBMC_PRE_RPC

#define LIBMC_PRE_RPC (   target,
  flags,
  only_type 
)
Value:
{ \
int cur_ret; \
cur_ret = libmc_pre_rpc_impl(target, flags, only_type); \
if (cur_ret) \
return cur_ret; \
}

Definition at line 203 of file libmc.c.

Function Documentation

◆ mcGetInfoApdxOld()

static void mcGetInfoApdxOld ( void *  arg)
static

function that gets called when mcGetInfo ends and interrupts are disabled (old RPC)

Definition at line 246 of file libmc.c.

◆ mcGetInfoApdxNew()

static void mcGetInfoApdxNew ( void *  arg)
static

function that gets called when mcGetInfo ends and interrupts are disabled (new RPC)

Definition at line 266 of file libmc.c.

◆ mcReadFixAlignOld()

static void mcReadFixAlignOld ( void *  arg)
static

function that gets called when mcRead ends and interrupts are disabled (old RPC)

Definition at line 284 of file libmc.c.

◆ mcReadFixAlignNew()

static void mcReadFixAlignNew ( void *  arg)
static

function that gets called when mcRead ends and interrupts are disabled (new RPC)

Definition at line 300 of file libmc.c.

◆ mcStoreDir()

static void mcStoreDir ( void *  arg)
static

function that gets called when mcChDir ends and interrupts are disabled

Definition at line 316 of file libmc.c.

◆ mcInit()

int mcInit ( int  type)

init memcard lib

Parameters
typeRetained for backwards compatibility. Nominally specify MC_TYPE_MC.
Returns
0 = successful; < 0 = error

Definition at line 856 of file libmc.c.

◆ mcGetInfo()

int mcGetInfo ( int  port,
int  slot,
int *  type,
int *  free,
int *  format 
)

get memcard state mcSync result: 0 = same card as last getInfo call -1 = formatted card inserted since last getInfo call -2 = unformatted card inserted since last getInfo call < -2 = memcard access error (could be due to accessing psx memcard)

Parameters
portport number
slotslot number
typepointer to get memcard type
freepointer to get number of free clusters
formatpointer to get whether or not the card is formatted (Note: Originally, sceMcGetInfo didn't have a 5th argument for returning the format status. As this is emulated based on the return value of sceMcSync() when rom0:MCSERV is used, please keep track of the return value from sceMcSync instead!)
Returns
0 = successful; < 0 = error

Definition at line 865 of file libmc.c.

◆ mcOpen()

int mcOpen ( int  port,
int  slot,
const char *  name,
int  mode 
)

open a file on memcard mcSync returns: 0 or more = file descriptor (success) < 0 = error

Parameters
portport number
slotslot number
namefilename to open
modeopen file mode (O_RDWR, O_CREAT, etc)
Returns
0 = successful; < 0 = error

Definition at line 873 of file libmc.c.

◆ mcClose()

int mcClose ( int  fd)

close an open file on memcard mcSync returns: 0 if closed successfully < 0 = error

Parameters
fdfile descriptor of open file
Returns
0 successful; < 0 = error

Definition at line 881 of file libmc.c.

◆ mcSeek()

int mcSeek ( int  fd,
int  offset,
int  origin 
)

move memcard file pointer mcSync returns: 0 or more = offset of file pointer from start of file < 0 = error

Parameters
fdfile descriptor
offsetnumber of bytes from origin
origininitial position for offset
Returns
0 = successful; < 0 = error

Definition at line 889 of file libmc.c.

◆ mcRead()

int mcRead ( int  fd,
void *  buffer,
int  size 
)

read from file on memcard mcSync returns: 0 or more = number of bytes read from memcard < 0 = error

Parameters
fdfile descriptor
bufferbuffer to read to
sizenumber of bytes to read
Returns
0 = successful; < 0 = error

Definition at line 897 of file libmc.c.

◆ mcWrite()

int mcWrite ( int  fd,
const void *  buffer,
int  size 
)

write to file on memcard mcSync returns: 0 or more = number of bytes written to memcard < 0 = error

Parameters
fdfile descriptor
bufferto write from write
sizenumber of bytes to read
Returns
0 = successful; < 0 = error

Definition at line 905 of file libmc.c.

◆ mcFlush()

int mcFlush ( int  fd)

flush file cache to memcard mcSync returns: 0 if ok < 0 if error

Parameters
fdfile descriptor
Returns
0 = successful; < 0 = error

Definition at line 913 of file libmc.c.

◆ mcMkDir()

int mcMkDir ( int  port,
int  slot,
const char *  name 
)

create a dir mcSync returns: 0 if ok < 0 if error

Parameters
portport number
slotslot number
namedirectory name
Returns
0 = successful; < 0 = error

Definition at line 921 of file libmc.c.

◆ mcChdir()

int mcChdir ( int  port,
int  slot,
const char *  newDir,
char *  currentDir 
)

change current dir (can also get current dir) mcSync returns: 0 if ok < 0 if error

Parameters
portport number
slotslot number
newDirnew dir to change to
currentDirbuffer to get current dir (use 0 if not needed)
Returns
0 = successful; < 0 = error

Definition at line 929 of file libmc.c.

◆ mcGetDir()

int mcGetDir ( int  port,
int  slot,
const char *  name,
unsigned  mode,
int  maxent,
sceMcTblGetDir table 
)

get memcard filelist mcSync result: 0 or more = number of file entries obtained (success) -2 = unformatted card -4 = dirname error

Parameters
portport number of memcard
slotslot number of memcard
namefilename to search for (can use wildcard and relative dirs)
modemode: 0 = first call, otherwise = followup call
maxextmaximum number of entries to be written to filetable in 1 call
tablemc table array
Returns
0 = successful; < 0 = error

Definition at line 937 of file libmc.c.

◆ mcSetFileInfo()

int mcSetFileInfo ( int  port,
int  slot,
const char *  name,
const sceMcTblGetDir info,
unsigned  flags 
)

change file information mcSync returns: 0 if ok < 0 if error

Parameters
portport number
slotslot number
namefilename to access
infodata to be changed
flagsflags to show which data is valid
Returns
0 = successful; < 0 = error

Definition at line 945 of file libmc.c.

◆ mcDelete()

int mcDelete ( int  port,
int  slot,
const char *  name 
)

delete file mcSync returns: 0 if deleted successfully < 0 if error

Parameters
portport number to delete from
slotslot number to delete from
namefilename to delete
Returns
0 = successful; < 0 = error

Definition at line 953 of file libmc.c.

◆ mcFormat()

int mcFormat ( int  port,
int  slot 
)

format memory card mcSync returns: 0 if ok < 0 if error

Parameters
portport number
slotslot number
Returns
0 = success; -1 = error

Definition at line 961 of file libmc.c.

◆ mcUnformat()

int mcUnformat ( int  port,
int  slot 
)

unformat memory card mcSync returns: 0 if ok < 0 if error

Parameters
portport number
slotslot number
Returns
0 = success; -1 = error

Definition at line 969 of file libmc.c.

◆ mcGetEntSpace()

int mcGetEntSpace ( int  port,
int  slot,
const char *  path 
)

get free space info mcSync returns: 0 or more = number of free entries (success) < 0 if error

Parameters
portport number
slotslot number
pathpath to be checked
Returns
0 or more = number of empty entries; -1 = error

Definition at line 977 of file libmc.c.

◆ mcRename()

int mcRename ( int  port,
int  slot,
const char *  oldName,
const char *  newName 
)

rename file or dir on memcard Note: rom0:MCSERV does not support this. mcSync returns: 0 if ok < 0 if error

Parameters
portport number
slotslot number
oldNamename of file/dir to rename
newNamenew name to give to file/dir
Returns
1 = success; < 0 = error

Definition at line 985 of file libmc.c.

◆ mcEraseBlock()

int mcEraseBlock ( int  port,
int  slot,
int  block,
int  mode 
)

Erases a block on the memory card. Note: rom0:XMCSERV does not support this. mcSync returns: 0 if ok < 0 if error

Parameters
portport number
slotslot number
blockBlock number of the block to be erased.
modeMode: -1 to inhibit ECC recalculation of the erased block's pages (useful if sceMcWritePage is used to fill in its contents later on), 0 for normal operation.
Returns
0 = success; -1 = error

Definition at line 993 of file libmc.c.

◆ mcReadPage()

int mcReadPage ( int  port,
int  slot,
unsigned int  page,
void *  buffer 
)

Reads a page from the memory card. Note: rom0:XMCSERV does not support this. mcSync returns: 0 if ok < 0 if error

Parameters
portport number
slotslot number
pagePage number of the page to be read.
bufferPointer to buffer that will contain the read data.
Returns
0 = success; -1 = error

Definition at line 1001 of file libmc.c.

◆ mcWritePage()

int mcWritePage ( int  port,
int  slot,
int  page,
const void *  buffer 
)

Writes a page to the memory card. (The block which the page resides on must be erased first!) Note: rom0:XMCSERV does not support this. mcSync returns: 0 if ok < 0 if error

Parameters
portport number
slotslot number
pagePage number of the page to be written.
bufferPointer to buffer containing data to be written.
Returns
0 = success; -1 = error

Definition at line 1009 of file libmc.c.

◆ mcChangeThreadPriority()

int mcChangeThreadPriority ( int  level)

change mcserv thread priority (I don't think this is implemented properly) Note: rom0:MCSERV does not support this. mcSync returns: 0 if ok < 0 if error

Parameters
levelthread priority
Returns
0 = success; -1 = error

Definition at line 1017 of file libmc.c.

◆ mcSync()

int mcSync ( int  mode,
int *  cmd,
int *  result 
)

wait for mc functions to finish or check if they have finished yet

Parameters
modemode 0=wait till function finishes, 1=check function status
cmdpointer for storing the number of the currenlty processing function
resultpointer for storing result of function if it finishes
Returns
0 = function is still executing (mode=1); 1 = function has finished executing; -1 = no function registered

Definition at line 1025 of file libmc.c.

◆ mcReset()

int mcReset ( void  )

Reset (force deinit) of library

Returns
0 = success

Definition at line 1033 of file libmc.c.

◆ xfromInit()

int xfromInit ( int  type)

init external flash ROM lib

Returns
0 = successful; < 0 = error

Definition at line 1041 of file libmc.c.

◆ xfromGetInfo()

int xfromGetInfo ( int  port,
int  slot,
int *  type,
int *  free,
int *  format 
)

get external flash ROM state xfromSync result: 0 = same external flash ROM as last getInfo call -1 = formatted external flash ROM inserted since last getInfo call -2 = unformatted external flash ROM inserted since last getInfo call < -2 = external flash ROM access error (could be due to accessing psx external flash ROM)

Parameters
portport number
slotslot number
typepointer to get external flash ROM type
freepointer to get number of free clusters
formatpointer to get whether or not the external flash ROM is formatted
Returns
0 = successful; < 0 = error

Definition at line 1050 of file libmc.c.

◆ xfromOpen()

int xfromOpen ( int  port,
int  slot,
const char *  name,
int  mode 
)

open a file on external flash ROM xfromSync returns: 0 or more = file descriptor (success) < 0 = error

Parameters
portport number
slotslot number
namefilename to open
modeopen file mode (O_RDWR, O_CREAT, etc)
Returns
0 = successful; < 0 = error

Definition at line 1058 of file libmc.c.

◆ xfromClose()

int xfromClose ( int  fd)

close an open file on external flash ROM xfromSync returns: 0 if closed successfully < 0 = error

Parameters
fdfile descriptor of open file
Returns
0 successful; < 0 = error

Definition at line 1066 of file libmc.c.

◆ xfromSeek()

int xfromSeek ( int  fd,
int  offset,
int  origin 
)

move external flash ROM file pointer xfromSync returns: 0 or more = offset of file pointer from start of file < 0 = error

Parameters
fdfile descriptor
offsetnumber of bytes from origin
origininitial position for offset
Returns
0 = successful; < 0 = error

Definition at line 1074 of file libmc.c.

◆ xfromRead()

int xfromRead ( int  fd,
void *  buffer,
int  size 
)

read from file on external flash ROM xfromSync returns: 0 or more = number of bytes read from external flash ROM < 0 = error

Parameters
fdfile descriptor
bufferbuffer to read to
sizenumber of bytes to read
Returns
0 = successful; < 0 = error

Definition at line 1082 of file libmc.c.

◆ xfromWrite()

int xfromWrite ( int  fd,
const void *  buffer,
int  size 
)

write to file on external flash ROM xfromSync returns: 0 or more = number of bytes written to external flash ROM < 0 = error

Parameters
fdfile descriptor
bufferto write from write
sizenumber of bytes to read
Returns
0 = successful; < 0 = error

Definition at line 1090 of file libmc.c.

◆ xfromFlush()

int xfromFlush ( int  fd)

flush file cache to external flash ROM xfromSync returns: 0 if ok < 0 if error

Parameters
fdfile descriptor
Returns
0 = successful; < 0 = error

Definition at line 1098 of file libmc.c.

◆ xfromMkDir()

int xfromMkDir ( int  port,
int  slot,
const char *  name 
)

create a dir xfromSync returns: 0 if ok < 0 if error

Parameters
portport number
slotslot number
namedirectory name
Returns
0 = successful; < 0 = error

Definition at line 1106 of file libmc.c.

◆ xfromChdir()

int xfromChdir ( int  port,
int  slot,
const char *  newDir,
char *  currentDir 
)

change current dir (can also get current dir) xfromSync returns: 0 if ok < 0 if error

Parameters
portport number
slotslot number
newDirnew dir to change to
currentDirbuffer to get current dir (use 0 if not needed)
Returns
0 = successful; < 0 = error

Definition at line 1114 of file libmc.c.

◆ xfromGetDir()

int xfromGetDir ( int  port,
int  slot,
const char *  name,
unsigned  mode,
int  maxent,
sceMcTblGetDir table 
)

get external flash ROM filelist xfromSync result: 0 or more = number of file entries obtained (success) -2 = unformatted external flash ROM -4 = dirname error

Parameters
portport number of external flash ROM
slotslot number of external flash ROM
namefilename to search for (can use wildcard and relative dirs)
modemode: 0 = first call, otherwise = followup call
maxextmaximum number of entries to be written to filetable in 1 call
tableexternal flash ROM table array
Returns
0 = successful; < 0 = error

Definition at line 1122 of file libmc.c.

◆ xfromSetFileInfo()

int xfromSetFileInfo ( int  port,
int  slot,
const char *  name,
const sceMcTblGetDir info,
unsigned  flags 
)

change file information xfromSync returns: 0 if ok < 0 if error

Parameters
portport number
slotslot number
namefilename to access
infodata to be changed
flagsflags to show which data is valid
Returns
0 = successful; < 0 = error

Definition at line 1130 of file libmc.c.

◆ xfromDelete()

int xfromDelete ( int  port,
int  slot,
const char *  name 
)

delete file xfromSync returns: 0 if deleted successfully < 0 if error

Parameters
portport number to delete from
slotslot number to delete from
namefilename to delete
Returns
0 = successful; < 0 = error

Definition at line 1138 of file libmc.c.

◆ xfromFormat()

int xfromFormat ( int  port,
int  slot 
)

format external flash ROM xfromSync returns: 0 if ok < 0 if error

Parameters
portport number
slotslot number
Returns
0 = success; -1 = error

Definition at line 1146 of file libmc.c.

◆ xfromUnformat()

int xfromUnformat ( int  port,
int  slot 
)

unformat external flash ROM xfromSync returns: 0 if ok < 0 if error

Parameters
portport number
slotslot number
Returns
0 = success; -1 = error

Definition at line 1154 of file libmc.c.

◆ xfromGetEntSpace()

int xfromGetEntSpace ( int  port,
int  slot,
const char *  path 
)

get free space info xfromSync returns: 0 or more = number of free entries (success) < 0 if error

Parameters
portport number
slotslot number
pathpath to be checked
Returns
0 or more = number of empty entries; -1 = error

Definition at line 1162 of file libmc.c.

◆ xfromRename()

int xfromRename ( int  port,
int  slot,
const char *  oldName,
const char *  newName 
)

rename file or dir on external flash ROM xfromSync returns: 0 if ok < 0 if error

Parameters
portport number
slotslot number
oldNamename of file/dir to rename
newNamenew name to give to file/dir
Returns
1 = success; < 0 = error

Definition at line 1170 of file libmc.c.

◆ xfromEraseBlock()

int xfromEraseBlock ( int  port,
int  slot,
int  block,
int  mode 
)

Erases a block on the external flash ROM. Note: The current implementation of xfromserv does not support this. xfromSync returns: 0 if ok < 0 if error

Parameters
portport number
slotslot number
blockBlock number of the block to be erased.
modeMode: -1 to inhibit ECC recalculation of the erased block's pages (useful if xfromWritePage is used to fill in its contents later on), 0 for normal operation.
Returns
0 = success; -1 = error

Definition at line 1178 of file libmc.c.

◆ xfromReadPage()

int xfromReadPage ( int  port,
int  slot,
unsigned int  page,
void *  buffer 
)

Reads a page from the external flash ROM. Note: The current implementation of xfromserv does not support this. xfromSync returns: 0 if ok < 0 if error

Parameters
portport number
slotslot number
pagePage number of the page to be read.
bufferPointer to buffer that will contain the read data.
Returns
0 = success; -1 = error

Definition at line 1186 of file libmc.c.

◆ xfromWritePage()

int xfromWritePage ( int  port,
int  slot,
int  page,
const void *  buffer 
)

Writes a page to the external flash ROM. (The block which the page resides on must be erased first!) Note: The current implementation of xfromserv does not support this. xfromSync returns: 0 if ok < 0 if error

Parameters
portport number
slotslot number
pagePage number of the page to be written.
bufferPointer to buffer containing data to be written.
Returns
0 = success; -1 = error

Definition at line 1194 of file libmc.c.

◆ xfromChangeThreadPriority()

int xfromChangeThreadPriority ( int  level)

change xfromserv thread priority (I don't think this is implemented properly) xfromSync returns: 0 if ok < 0 if error

Parameters
levelthread priority
Returns
0 = success; -1 = error

Definition at line 1202 of file libmc.c.

◆ xfromSync()

int xfromSync ( int  mode,
int *  cmd,
int *  result 
)

wait for external flash ROM functions to finish or check if they have finished yet

Parameters
modemode 0=wait till function finishes, 1=check function status
cmdpointer for storing the number of the currenlty processing function
resultpointer for storing result of function if it finishes
Returns
0 = function is still executing (mode=1); 1 = function has finished executing; -1 = no function registered

Definition at line 1210 of file libmc.c.

◆ xfromReset()

int xfromReset ( void  )

Reset (force deinit) of library

Returns
0 = success

Definition at line 1218 of file libmc.c.