In memory of Ben “bushing” Byer, who passed away on Monday, February 8th, 2016.

Changes

Jump to navigation Jump to search
963 bytes added ,  02:35, 15 April 2016
Do some Filesystem cleanup so page is (slightly) more streamlined, add some OSSystem stuff
Line 202: Line 202:  
|void OSScreenPutFontEx(int bufferNum, uint32_t posX, uint32_t posY, const char *str)
 
|void OSScreenPutFontEx(int bufferNum, uint32_t posX, uint32_t posY, const char *str)
 
|Write text to the specified buffer; unlike OSFatal() this doesn't halt your system.
 
|Write text to the specified buffer; unlike OSFatal() this doesn't halt your system.
 +
|}
 +
 +
===OSSystem=== <!-- TODO: Find better name?? -->
 +
 +
{| class="wikitable"
 +
!Name
 +
!Prototype
 +
!Description
 +
|-
 +
|OSGetSystemTime
 +
|<code>OSTime OSGetSystemTime(void)</code>
 +
|Gets OSTime (which is just an int64_t) from tbu/tb (timebase upper/lower special purpose registers), same as get_timebase in kernel (FFF099E0 on 5.5.X)
 +
|-
 +
|OSGetSystemInfo
 +
|<code>uint32_t* OSGetSystemInfo(void)</code>
 +
|Returns pointer to OSSystemInfo struct (see below)
 +
|}
 +
 +
==Filesystem==
 +
The FS* functions appear to only be used by regular applications, while the FSA* functions appear to only be used by system rpls.
 +
===Setup===
 +
{| class="wikitable"
 +
!Name
 +
!Signature
 +
!Description
 +
!Notes
 +
|-
 +
|FSInit
 +
|<code>void FSInit(void)</code>
 +
|Initializes the FS library
 +
|Must be called before anything else! Can be called multiple times safely.
 +
|-
 +
|FSShutdown
 +
|<code>void FSShutdown(void)</code>
 +
|Deinitializes the FS library
 +
|The current implementation of this function doesn't do anything.
 +
|-
 +
|FSAddClient
 +
|<code>FSStatus FSAddClient(FSClient *client, FSRetflag flag)</code>
 +
|Registers a new client for use
 +
|Returns OK or MAX_CLIENTS(-3). Client size is 0x1700 bytes, should be 0x20 byte padded.
 +
|-
 +
|FSDelClient
 +
|<code>FSStatus FSDelClient(FSClient *client, FSRetflag flag)</code>
 +
|Unregisters an existing client
 +
|See above for data size. The current implementation of this function never fails.
 +
|-
 +
|FSGetClientNum
 +
|<code>int FSGetClientNum(void)</code>
 +
|Gets the number of registered clients
 +
|
 +
|}
 +
 +
===Command Blocks===
 +
{| class="wikitable"
 +
!Name
 +
!Prototype
 +
!Description
 +
!Notes
 +
|-
 +
|FSInitCmdBlock
 +
|<code>void FSInitCmdBlock(FSCmdBlock *block)</code>
 +
|Initializes a command block for use.
 +
|Command Block size is 0xA80 bytes, should be 0x20 byte padded.
 +
|-
 +
|FSCancelCommand
 +
|<code>void FSCancelCommand(FSClient *client, FSCmdBlock *block)</code>
 +
|Cancels the pending command
 +
|Cannot cancel an ongoing command, it has to complete.
 +
|-
 +
|FSCancelAllCommands
 +
|<code>void FSCancelAllCommands(FSClient *client)
 +
|Cancels all pending commands for the passed client.
 +
|Cannot cancel an ongoing command, it has to complete.
 +
|-
 +
|FSSetUserData
 +
|<code>void FSSetUserData(FSCmdBlock *block, void *user_data)</code>
 +
|Sets the user data for the passed command block
 +
|
 +
|-
 +
|FSGetUserData
 +
|<code>void* FSGetUserData(FSCmdBlock *block)</code>
 +
|Returns pointer to the user data
 +
|Can return NULL if invalid, please error check.
 +
|-
 +
|FSSetCmdPriority
 +
|<code>void FSSetCmdPriority(FSCmdBlock *block, uint8_t priority)</code>
 +
|Sets the priority for the passed command block
 +
|Priority 0 is highest, 31 is lowest, 16 is default.
 +
|-
 +
|FSGetCmdPriority
 +
|<code>int FSGetCmdPriority(FSCmdBlock *block)</code>
 +
|Gets the priority for the passed command block
 +
|Priority 0 is highest, 31 is lowest, 16 is default.
 +
|-
 +
|FSGetCurrentCmdBlock
 +
|<code>FSCmdBlock* FSGetCurrentCmdBlock(FSClient *client)
 +
|Returns a pointer to the command block being processed.
 +
|May return NULL if invalid client or if nothing's processed, please error check.
 
|}
 
|}
   Line 327: Line 426:  
|}
 
|}
   −
==Filesystem==
+
===System Info===
The FS* functions appear to only be used by regular applications, while the FSA* functions appear to only be used by system rpls.
  −
===Setup===
   
{| class="wikitable"
 
{| class="wikitable"
 
!Name
 
!Name
!Signature
+
!Prototype
!Description
  −
!Notes
  −
|-
  −
|FSInit
  −
|<code>void FSInit(void)</code>
  −
|Initializes the FS library
  −
|Must be called before anything else! Can be called multiple times safely.
  −
|-
  −
|FSShutdown
  −
|<code>void FSShutdown(void)</code>
  −
|Deinitializes the FS library
  −
|The current implementation of this function doesn't do anything.
  −
|-
  −
|FSAddClient
  −
|<code>FSStatus FSAddClient(FSClient *client, FSRetflag flag)</code>
  −
|Registers a new client for use
  −
|Returns OK or MAX_CLIENTS(-3). Client size is 0x1700 bytes, should be 0x20 byte padded.
  −
|-
  −
|FSDelClient
  −
|<code>FSStatus FSDelClient(FSClient *client, FSRetflag flag)</code>
  −
|Unregisters an existing client
  −
|See above for data size. The current implementation of this function never fails.
   
|-
 
|-
|FSGetClientNum
+
|OSSystemInfo
|<code>int FSGetClientNum(void)</code>
  −
|Gets the number of registered clients
   
|
 
|
 +
<syntaxhighlight lang="C">
 +
typedef struct {
 +
    /* 0x00 */ uint32_t busClockSpeed;
 +
    /* 0x04 */ uint32_t coreClockSpeed;
 +
    /* 0x08 */ OSTime  timeBase;
 +
    /* 0x0C+*/ uint32_t unknown[5]; //Length is 8 words/32 bytes
 +
} OSSystemInfo;
 +
</syntaxhighlight>
 
|}
 
|}
   −
===Command Blocks===
+
===Filesystem===
{| class="wikitable"
+
<syntaxhighlight lang="C">
!Name
+
typedef struct {uint8_t buffer[FS_CLIENT_BUFFER_SIZE];} FSClient;
!Prototype
+
typedef struct {uint8_t buffer[FS_CMD_BLOCK_SIZE];} FSCmdBlock;
!Description
+
 
!Notes
+
typedef enum {
|-
+
    FS_VOLSTATE_INITIAL = 0,
|FSInitCmdBlock
+
    FS_VOLSTATE_READY,
|<code>void FSInitCmdBlock(FSCmdBlock *block)</code>
+
|Initializes a command block for use.
+
    FS_VOLSTATE_NO_MEDIA,
|Command Block size is 0xA80 bytes, should be 0x20 byte padded.
+
|-
+
    FS_VOLSTATE_INVALID_MEDIA,
|FSCancelCommand
+
    FS_VOLSTATE_DIRTY_MEDIA,
|<code>void FSCancelCommand(FSClient *client, FSCmdBlock *block)</code>
+
    FS_VOLSTATE_WRONG_MEDIA,
|Cancels the pending command
+
    FS_VOLSTATE_MEDIA_ERROR,
|Cannot cancel an ongoing command, it has to complete.
+
    FS_VOLSTATE_DATA_CORRUPTED,
|-
+
    FS_VOLSTATE_WRITE_PROTECTED,
|FSCancelAllCommands
+
|<code>void FSCancelAllCommands(FSClient *client)
+
    FS_VOLSTATE_JOURNAL_FULL,
|Cancels all pending commands for the passed client.
+
    FS_VOLSTATE_FATAL,
|Cannot cancel an ongoing command, it has to complete.
+
|-
+
    FS_VOLSTATE_INVALID
|FSSetUserData
+
} FSVolumeState;
|<code>void FSSetUserData(FSCmdBlock *block, void *user_data)</code>
+
</syntaxhighlight>
|Sets the user data for the passed command block
  −
|
  −
|-
  −
|FSGetUserData
  −
|<code>void* FSGetUserData(FSCmdBlock *block)</code>
  −
|Returns pointer to the user data
  −
|Can return NULL if invalid, please error check.
  −
|-
  −
|FSSetCmdPriority
  −
|<code>void FSSetCmdPriority(FSCmdBlock *block, uint8_t priority)</code>
  −
|Sets the priority for the passed command block
  −
|Priority 0 is highest, 31 is lowest, 16 is default.
  −
|-
  −
|FSGetCmdPriority
  −
|<code>int FSGetCmdPriority(FSCmdBlock *block)</code>
  −
|Gets the priority for the passed command block
  −
|Priority 0 is highest, 31 is lowest, 16 is default.
  −
|-
  −
|FSGetCurrentCmdBlock
  −
|<code>FSCmdBlock* FSGetCurrentCmdBlock(FSClient *client)
  −
|Returns a pointer to the command block being processed.
  −
|May return NULL if invalid client or if nothing's processed, please error check.
  −
|}
     −
===Defines===
+
== Defines ==
 +
===Filesystem===
 
<syntaxhighlight lang="C">
 
<syntaxhighlight lang="C">
 
#define FS_CLIENT_BUFFER_SIZE  (5888) /* 0x1700 */
 
#define FS_CLIENT_BUFFER_SIZE  (5888) /* 0x1700 */
Line 460: Line 519:  
#define FS_ERROR_LIB_NOT_INIT          (FS_ERROR_BASE - 1)
 
#define FS_ERROR_LIB_NOT_INIT          (FS_ERROR_BASE - 1)
 
#define FS_ERROR_INVALID_CLIENT_HANDLE  (FS_ERROR_BASE -37) /* ??? */
 
#define FS_ERROR_INVALID_CLIENT_HANDLE  (FS_ERROR_BASE -37) /* ??? */
  −
typedef struct {uint8_t buffer[FS_CLIENT_BUFFER_SIZE];} FSClient;
  −
typedef struct {uint8_t buffer[FS_CMD_BLOCK_SIZE];} FSCmdBlock;
  −
  −
typedef enum {
  −
    FS_VOLSTATE_INITIAL = 0,
  −
    FS_VOLSTATE_READY,
  −
  −
    FS_VOLSTATE_NO_MEDIA,
  −
  −
    FS_VOLSTATE_INVALID_MEDIA,
  −
    FS_VOLSTATE_DIRTY_MEDIA,
  −
    FS_VOLSTATE_WRONG_MEDIA,
  −
    FS_VOLSTATE_MEDIA_ERROR,
  −
    FS_VOLSTATE_DATA_CORRUPTED,
  −
    FS_VOLSTATE_WRITE_PROTECTED,
  −
  −
    FS_VOLSTATE_JOURNAL_FULL,
  −
    FS_VOLSTATE_FATAL,
  −
  −
    FS_VOLSTATE_INVALID
  −
} FSVolumeState;
   
</syntaxhighlight>
 
</syntaxhighlight>
   −
== Defines ==
   
=== Disassembler ===
 
=== Disassembler ===
 
printf_func() and find_symbol() have the following types:
 
printf_func() and find_symbol() have the following types:
Line 497: Line 533:  
#define DISASM_OMIT_OPCODE    0x80    /* Don't print the opcode of the instruction */
 
#define DISASM_OMIT_OPCODE    0x80    /* Don't print the opcode of the instruction */
 
#define DISASM_GETSYM        0x100    /* Print the nearest symbol and the instruction's offset from it */
 
#define DISASM_GETSYM        0x100    /* Print the nearest symbol and the instruction's offset from it */
 +
</syntaxhighlight>
 +
 +
===OSSystem===
 +
<syntaxhighlight lang="C">
 +
#define OSTime int64_t /* stored in timebase upper/lower */
 
</syntaxhighlight>
 
</syntaxhighlight>
  
52

edits

Navigation menu