Doc consistency.
This commit is contained in:
parent
2656225392
commit
d6962f2122
@ -1,19 +1,16 @@
|
||||
/*! \file console.h
|
||||
\brief 3ds stdio support.
|
||||
|
||||
<div class="fileHeader">
|
||||
Provides stdio integration for printing to the 3DS screen as well as debug print
|
||||
functionality provided by stderr.
|
||||
|
||||
General usage is to initialize the console by:
|
||||
consoleDemoInit()
|
||||
or to customize the console usage by:
|
||||
consoleInit()
|
||||
|
||||
/**
|
||||
* @file console.h
|
||||
* @brief 3ds stdio support.
|
||||
*
|
||||
* Provides stdio integration for printing to the 3DS screen as well as debug print
|
||||
* functionality provided by stderr.
|
||||
*
|
||||
* General usage is to initialize the console by:
|
||||
* consoleDemoInit()
|
||||
* or to customize the console usage by:
|
||||
* consoleInit()
|
||||
*/
|
||||
|
||||
#ifndef CONSOLE_H
|
||||
#define CONSOLE_H
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
#include <3ds/gfx.h>
|
||||
@ -22,73 +19,74 @@ consoleInit()
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef bool(* ConsolePrint)(void* con, int c);
|
||||
/// A callback for printing a character.
|
||||
typedef bool(*ConsolePrint)(void* con, int c);
|
||||
|
||||
//! a font struct for the console.
|
||||
/// A font struct for the console.
|
||||
typedef struct ConsoleFont
|
||||
{
|
||||
u8* gfx; //!< A pointer to the font graphics
|
||||
u16 asciiOffset; //!< Offset to the first valid character in the font table
|
||||
u16 numChars; //!< Number of characters in the font graphics
|
||||
u8* gfx; ///< A pointer to the font graphics
|
||||
u16 asciiOffset; ///< Offset to the first valid character in the font table
|
||||
u16 numChars; ///< Number of characters in the font graphics
|
||||
|
||||
}ConsoleFont;
|
||||
|
||||
/** \brief console structure used to store the state of a console render context.
|
||||
|
||||
Default values from consoleGetDefault();
|
||||
<div class="fixedFont"><pre>
|
||||
PrintConsole defaultConsole =
|
||||
{
|
||||
//Font:
|
||||
{
|
||||
(u8*)default_font_bin, //font gfx
|
||||
0, //first ascii character in the set
|
||||
128, //number of characters in the font set
|
||||
},
|
||||
0,0, //cursorX cursorY
|
||||
0,0, //prevcursorX prevcursorY
|
||||
40, //console width
|
||||
30, //console height
|
||||
0, //window x
|
||||
0, //window y
|
||||
32, //window width
|
||||
24, //window height
|
||||
3, //tab size
|
||||
0, //font character offset
|
||||
0, //print callback
|
||||
false //console initialized
|
||||
};
|
||||
</pre></div>
|
||||
*/
|
||||
/**
|
||||
* @brief console structure used to store the state of a console render context.
|
||||
*
|
||||
* Default values from consoleGetDefault();
|
||||
* <div class="fixedFont"><pre>
|
||||
* PrintConsole defaultConsole =
|
||||
* {
|
||||
* //Font:
|
||||
* {
|
||||
* (u8*)default_font_bin, //font gfx
|
||||
* 0, //first ascii character in the set
|
||||
* 128, //number of characters in the font set
|
||||
* },
|
||||
* 0,0, //cursorX cursorY
|
||||
* 0,0, //prevcursorX prevcursorY
|
||||
* 40, //console width
|
||||
* 30, //console height
|
||||
* 0, //window x
|
||||
* 0, //window y
|
||||
* 32, //window width
|
||||
* 24, //window height
|
||||
* 3, //tab size
|
||||
* 0, //font character offset
|
||||
* 0, //print callback
|
||||
* false //console initialized
|
||||
* };
|
||||
* </pre></div>
|
||||
*/
|
||||
typedef struct PrintConsole
|
||||
{
|
||||
ConsoleFont font; //!< font of the console.
|
||||
ConsoleFont font; ///< Font of the console.
|
||||
|
||||
u16 *frameBuffer; //!< framebuffer address.
|
||||
u16 *frameBuffer; ///< Framebuffer address.
|
||||
|
||||
int cursorX; /*!< Current X location of the cursor (as a tile offset by default) */
|
||||
int cursorY; /*!< Current Y location of the cursor (as a tile offset by default) */
|
||||
int cursorX; ///< Current X location of the cursor (as a tile offset by default)
|
||||
int cursorY; ///< Current Y location of the cursor (as a tile offset by default)
|
||||
|
||||
int prevCursorX; /*!< Internal state */
|
||||
int prevCursorY; /*!< Internal state */
|
||||
int prevCursorX; ///< Internal state
|
||||
int prevCursorY; ///< Internal state
|
||||
|
||||
int consoleWidth; /*!< Width of the console hardware layer in characters */
|
||||
int consoleHeight; /*!< Height of the console hardware layer in characters */
|
||||
int consoleWidth; ///< Width of the console hardware layer in characters
|
||||
int consoleHeight; ///< Height of the console hardware layer in characters
|
||||
|
||||
int windowX; /*!< Window X location in characters (not implemented) */
|
||||
int windowY; /*!< Window Y location in characters (not implemented) */
|
||||
int windowWidth; /*!< Window width in characters (not implemented) */
|
||||
int windowHeight; /*!< Window height in characters (not implemented) */
|
||||
int windowX; ///< Window X location in characters (not implemented)
|
||||
int windowY; ///< Window Y location in characters (not implemented)
|
||||
int windowWidth; ///< Window width in characters (not implemented)
|
||||
int windowHeight; ///< Window height in characters (not implemented)
|
||||
|
||||
int tabSize; /*!< Size of a tab*/
|
||||
int fg; /*!< foreground color*/
|
||||
int bg; /*!< background color*/
|
||||
int flags; /*!< reverse/bright flags*/
|
||||
int tabSize; ///< Size of a tab
|
||||
int fg; ///< Foreground color
|
||||
int bg; ///< Background color
|
||||
int flags; ///< Reverse/bright flags
|
||||
|
||||
ConsolePrint PrintChar; /*!< callback for printing a character. Should return true if it has handled rendering the graphics
|
||||
(else the print engine will attempt to render via tiles) */
|
||||
ConsolePrint PrintChar; ///< Callback for printing a character. Should return true if it has handled rendering the graphics (else the print engine will attempt to render via tiles).
|
||||
|
||||
bool consoleInitialised; /*!< True if the console is initialized */
|
||||
bool consoleInitialised; ///< True if the console is initialized
|
||||
}PrintConsole;
|
||||
|
||||
#define CONSOLE_COLOR_BOLD (1<<0)
|
||||
@ -101,58 +99,61 @@ typedef struct PrintConsole
|
||||
#define CONSOLE_CONCEAL (1<<7)
|
||||
#define CONSOLE_CROSSED_OUT (1<<8)
|
||||
|
||||
//! Console debug devices supported by libnds.
|
||||
/// Console debug devices supported by libnds.
|
||||
typedef enum {
|
||||
debugDevice_NULL, //!< swallows prints to stderr
|
||||
debugDevice_3DMOO, //!< Directs stderr debug statements to 3dmoo
|
||||
debugDevice_CONSOLE, //!< Directs stderr debug statements to 3DS console window
|
||||
debugDevice_NULL, ///< swallows prints to stderr
|
||||
debugDevice_3DMOO, ///< Directs stderr debug statements to 3dmoo
|
||||
debugDevice_CONSOLE, ///< Directs stderr debug statements to 3DS console window
|
||||
} debugDevice;
|
||||
|
||||
/*! \brief Loads the font into the console
|
||||
\param console pointer to the console to update, if NULL it will update the current console
|
||||
\param font the font to load
|
||||
/**
|
||||
* @brief Loads the font into the console.
|
||||
* @param console Pointer to the console to update, if NULL it will update the current console.
|
||||
* @param font The font to load.
|
||||
*/
|
||||
void consoleSetFont(PrintConsole* console, ConsoleFont* font);
|
||||
|
||||
/*! \brief Sets the print window
|
||||
\param console console to set, if NULL it will set the current console window
|
||||
\param x x location of the window
|
||||
\param y y location of the window
|
||||
\param width width of the window
|
||||
\param height height of the window
|
||||
/**
|
||||
* @brief Sets the print window.
|
||||
* @param console Console to set, if NULL it will set the current console window.
|
||||
* @param x X location of the window.
|
||||
* @param y Y location of the window.
|
||||
* @param width Width of the window.
|
||||
* @param height Height of the window.
|
||||
*/
|
||||
void consoleSetWindow(PrintConsole* console, int x, int y, int width, int height);
|
||||
|
||||
/*! \brief Gets a pointer to the console with the default values
|
||||
this should only be used when using a single console or without changing the console that is returned, other wise use consoleInit()
|
||||
\return A pointer to the console with the default values
|
||||
/**
|
||||
* @brief Gets a pointer to the console with the default values.
|
||||
* This should only be used when using a single console or without changing the console that is returned, otherwise use consoleInit().
|
||||
* @return A pointer to the console with the default values.
|
||||
*/
|
||||
PrintConsole* consoleGetDefault(void);
|
||||
|
||||
/*! \brief Make the specified console the render target
|
||||
\param console A pointer to the console struct (must have been initialized with consoleInit(PrintConsole* console)
|
||||
\return a pointer to the previous console
|
||||
/**
|
||||
* @brief Make the specified console the render target.
|
||||
* @param console A pointer to the console struct (must have been initialized with consoleInit(PrintConsole* console)).
|
||||
* @return A pointer to the previous console.
|
||||
*/
|
||||
PrintConsole *consoleSelect(PrintConsole* console);
|
||||
|
||||
/*! \brief Initialise the console.
|
||||
\param screen The screen to use for the console
|
||||
\param console A pointer to the console data to initialze (if it's NULL, the default console will be used)
|
||||
\return A pointer to the current console.
|
||||
/**
|
||||
* @brief Initialise the console.
|
||||
* @param screen The screen to use for the console.
|
||||
* @param console A pointer to the console data to initialize (if it's NULL, the default console will be used).
|
||||
* @return A pointer to the current console.
|
||||
*/
|
||||
PrintConsole* consoleInit(gfxScreen_t screen, PrintConsole* console);
|
||||
|
||||
/*! \brief Initializes debug console output on stderr to the specified device
|
||||
\param device The debug device (or devices) to output debug print statements to
|
||||
/**
|
||||
* @brief Initializes debug console output on stderr to the specified device.
|
||||
* @param device The debug device (or devices) to output debug print statements to.
|
||||
*/
|
||||
void consoleDebugInit(debugDevice device);
|
||||
|
||||
|
||||
//! Clears the screan by using iprintf("\x1b[2J");
|
||||
/// Clears the screan by using iprintf("\x1b[2J");
|
||||
void consoleClear(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -13,7 +13,7 @@
|
||||
#define RGB565(r,g,b) (((b)&0x1f)|(((g)&0x3f)<<5)|(((r)&0x1f)<<11))
|
||||
#define RGB8_to_565(r,g,b) (((b)>>3)&0x1f)|((((g)>>2)&0x3f)<<5)|((((r)>>3)&0x1f)<<11)
|
||||
|
||||
//! Available screens.
|
||||
/// Available screens.
|
||||
typedef enum
|
||||
{
|
||||
GFX_TOP = 0, ///< Top screen
|
||||
|
@ -32,9 +32,7 @@ typedef enum
|
||||
GX_TRANSFER_SCALE_XY = 2, ///< 2x2 anti-aliasing
|
||||
} GX_TRANSFER_SCALE;
|
||||
|
||||
/**
|
||||
* @brief GX transfer control flags
|
||||
*/
|
||||
/// GX transfer control flags
|
||||
typedef enum
|
||||
{
|
||||
GX_FILL_TRIGGER = 0x001, ///< Trigger the PPF event
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include <3ds/types.h>
|
||||
|
||||
//! IPC buffer access rights.
|
||||
/// IPC buffer access rights.
|
||||
typedef enum
|
||||
{
|
||||
IPC_BUFFER_R = BIT(1), ///< Readable
|
||||
|
@ -13,20 +13,20 @@
|
||||
#define GET_VERSION_REVISION(version) (((version)>> 8)&0xFF)
|
||||
|
||||
/**
|
||||
* Converts an address from virtual (process) memory to physical memory.
|
||||
* @brief Converts an address from virtual (process) memory to physical memory.
|
||||
* It is sometimes required by services or when using the GPU command buffer.
|
||||
*/
|
||||
u32 osConvertVirtToPhys(u32 vaddr);
|
||||
|
||||
/**
|
||||
* Converts 0x14* vmem to 0x30*.
|
||||
* @brief Converts 0x14* vmem to 0x30*.
|
||||
* @return The input address when it's already within the new vmem.
|
||||
* @return 0 when outside of either LINEAR mem areas.
|
||||
*/
|
||||
u32 osConvertOldLINEARMemToNew(u32 addr);
|
||||
|
||||
/**
|
||||
* @brief Basic information about a service error.
|
||||
* @brief Retreives basic information about a service error.
|
||||
* @return A string of the summary of an error.
|
||||
*
|
||||
* This can be used to get some details about an error returned by a service call.
|
||||
@ -34,14 +34,16 @@ u32 osConvertOldLINEARMemToNew(u32 addr);
|
||||
const char* osStrError(u32 error);
|
||||
|
||||
/**
|
||||
* @return The Firm version
|
||||
* @brief Gets the system's FIRM version.
|
||||
* @return The FIRM version.
|
||||
*
|
||||
* This can be used to compare system versions easily with @ref SYSTEM_VERSION.
|
||||
*/
|
||||
u32 osGetFirmVersion(void);
|
||||
|
||||
/**
|
||||
* @return The kernel version
|
||||
* @brief Gets the system's kernel version.
|
||||
* @return The kernel version.
|
||||
*
|
||||
* This can be used to compare system versions easily with @ref SYSTEM_VERSION.
|
||||
*
|
||||
@ -52,6 +54,7 @@ u32 osGetFirmVersion(void);
|
||||
u32 osGetKernelVersion(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the current time.
|
||||
* @return The number of milliseconds since 1st Jan 1900 00:00.
|
||||
*/
|
||||
u64 osGetTime(void);
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <3ds/types.h>
|
||||
|
||||
//! RomFS header.
|
||||
/// RomFS header.
|
||||
typedef struct
|
||||
{
|
||||
u32 headerSize; ///< Size of the header.
|
||||
@ -21,7 +21,7 @@ typedef struct
|
||||
u32 fileDataOff; ///< Offset of the file data.
|
||||
} romfs_header;
|
||||
|
||||
//! RomFS directory.
|
||||
/// RomFS directory.
|
||||
typedef struct
|
||||
{
|
||||
u32 parent; ///< Offset of the parent directory.
|
||||
@ -33,7 +33,7 @@ typedef struct
|
||||
u16 name[]; ///< Name. (UTF-16)
|
||||
} romfs_dir;
|
||||
|
||||
//! RomFS file.
|
||||
/// RomFS file.
|
||||
typedef struct
|
||||
{
|
||||
u32 parent; ///< Offset of the parent directory.
|
||||
@ -45,7 +45,7 @@ typedef struct
|
||||
u16 name[]; ///< Name. (UTF-16)
|
||||
} romfs_file;
|
||||
|
||||
//! Initializes the RomFS driver.
|
||||
/// Initializes the RomFS driver.
|
||||
Result romfsInit(void);
|
||||
|
||||
/**
|
||||
@ -55,5 +55,5 @@ Result romfsInit(void);
|
||||
*/
|
||||
Result romfsInitFromFile(Handle file, u32 offset);
|
||||
|
||||
//! Exits the RomFS driver.
|
||||
/// Exits the RomFS driver.
|
||||
Result romfsExit(void);
|
||||
|
@ -6,8 +6,8 @@
|
||||
|
||||
#include <3ds/types.h>
|
||||
|
||||
//! Initializes the SDMC driver.
|
||||
/// Initializes the SDMC driver.
|
||||
Result sdmcInit(void);
|
||||
|
||||
//! Exits the SDMC driver.
|
||||
/// Exits the SDMC driver.
|
||||
Result sdmcExit(void);
|
||||
|
@ -1,72 +1,75 @@
|
||||
/**
|
||||
* @file FS.h
|
||||
* @brief Filesystem Services
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
|
||||
/*! @file FS.h
|
||||
/**
|
||||
* @defgroup fs_open_flags FS Open Flags
|
||||
*
|
||||
* Filesystem Services
|
||||
* @sa FSUSER_OpenFile
|
||||
* @sa FSUSER_OpenFileDirectly
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*! @defgroup fs_open_flags FS Open Flags
|
||||
*
|
||||
* @sa FSUSER_OpenFile
|
||||
* @sa FSUSER_OpenFileDirectly
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*! Open file for read. */
|
||||
/// Open file for read.
|
||||
#define FS_OPEN_READ (1<<0)
|
||||
/*! Open file for write. */
|
||||
/// Open file for write.
|
||||
#define FS_OPEN_WRITE (1<<1)
|
||||
/*! Create file if it doesn't exist. */
|
||||
/// Create file if it doesn't exist.
|
||||
#define FS_OPEN_CREATE (1<<2)
|
||||
/* @} */
|
||||
/// @}
|
||||
|
||||
/*! @defgroup fs_create_attributes FS Create Attributes
|
||||
/**
|
||||
* @defgroup fs_create_attributes FS Create Attributes
|
||||
*
|
||||
* @sa FSUSER_OpenFile
|
||||
* @sa FSUSER_OpenFileDirectly
|
||||
* @sa FSUSER_OpenFile
|
||||
* @sa FSUSER_OpenFileDirectly
|
||||
*
|
||||
* @{
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*! No attributes. */
|
||||
/// No attributes.
|
||||
#define FS_ATTRIBUTE_NONE (0x00000000)
|
||||
/*! Create with read-only attribute. */
|
||||
/// Create with read-only attribute.
|
||||
#define FS_ATTRIBUTE_READONLY (0x00000001)
|
||||
/*! Create with archive attribute. */
|
||||
/// Create with archive attribute.
|
||||
#define FS_ATTRIBUTE_ARCHIVE (0x00000100)
|
||||
/*! Create with hidden attribute. */
|
||||
/// Create with hidden attribute.
|
||||
#define FS_ATTRIBUTE_HIDDEN (0x00010000)
|
||||
/*! Create with directory attribute. */
|
||||
/// Create with directory attribute.
|
||||
#define FS_ATTRIBUTE_DIRECTORY (0x01000000)
|
||||
/*! @} */
|
||||
/// @}
|
||||
|
||||
/*! @defgroup fs_write_flush_flags FS Flush Flags
|
||||
/**
|
||||
* @defgroup fs_write_flush_flags FS Flush Flags
|
||||
*
|
||||
* @sa FSFILE_Write
|
||||
* @sa FSFILE_Write
|
||||
*
|
||||
* @{
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*! Don't flush */
|
||||
/// Don't flush
|
||||
#define FS_WRITE_NOFLUSH (0x00000000)
|
||||
/*! Flush */
|
||||
/// Flush
|
||||
#define FS_WRITE_FLUSH (0x00010001)
|
||||
|
||||
/* @} */
|
||||
/// @}
|
||||
|
||||
/*! FS path type */
|
||||
/// FS path type
|
||||
typedef enum
|
||||
{
|
||||
PATH_INVALID = 0, //!< Specifies an invalid path.
|
||||
PATH_EMPTY = 1, //!< Specifies an empty path.
|
||||
PATH_BINARY = 2, //!< Specifies a binary path, which is non-text based.
|
||||
PATH_CHAR = 3, //!< Specifies a text based path with a 8-bit byte per character.
|
||||
PATH_WCHAR = 4, //!< Specifies a text based path with a 16-bit short per character.
|
||||
PATH_INVALID = 0, ///< Specifies an invalid path.
|
||||
PATH_EMPTY = 1, ///< Specifies an empty path.
|
||||
PATH_BINARY = 2, ///< Specifies a binary path, which is non-text based.
|
||||
PATH_CHAR = 3, ///< Specifies a text based path with a 8-bit byte per character.
|
||||
PATH_WCHAR = 4, ///< Specifies a text based path with a 16-bit short per character.
|
||||
} FS_pathType;
|
||||
|
||||
/*! FS archive ids */
|
||||
/// FS archive ids
|
||||
typedef enum
|
||||
{
|
||||
ARCH_ROMFS = 0x3,
|
||||
@ -83,48 +86,48 @@ typedef enum
|
||||
ARCH_NAND_RO_WRITE_ACCESS = 0x1234567F,
|
||||
} FS_archiveIds;
|
||||
|
||||
/*! FS path */
|
||||
/// FS path
|
||||
typedef struct
|
||||
{
|
||||
FS_pathType type; //!< FS path type.
|
||||
u32 size; //!< FS path size.
|
||||
const u8 *data; //!< Pointer to FS path data.
|
||||
FS_pathType type; ///< FS path type.
|
||||
u32 size; ///< FS path size.
|
||||
const u8 *data; ///< Pointer to FS path data.
|
||||
} FS_path;
|
||||
|
||||
/*! FS archive */
|
||||
/// FS archive
|
||||
typedef struct
|
||||
{
|
||||
u32 id; //!< Archive ID.
|
||||
FS_path lowPath; //!< FS path.
|
||||
Handle handleLow; //!< High word of handle.
|
||||
Handle handleHigh; //!< Low word of handle.
|
||||
u32 id; ///< Archive ID.
|
||||
FS_path lowPath; ///< FS path.
|
||||
Handle handleLow; ///< High word of handle.
|
||||
Handle handleHigh; ///< Low word of handle.
|
||||
} FS_archive;
|
||||
|
||||
/*! Directory entry */
|
||||
/// Directory entry
|
||||
typedef struct
|
||||
{
|
||||
// 0x00
|
||||
u16 name[0x106]; //!< UTF-16 encoded name
|
||||
u16 name[0x106]; ///< UTF-16 encoded name
|
||||
// 0x20C
|
||||
u8 shortName[0x09]; //!< 8.3 file name
|
||||
u8 shortName[0x09]; ///< 8.3 file name
|
||||
// 0x215
|
||||
u8 unknown1; //!< ???
|
||||
u8 unknown1; ///< ???
|
||||
// 0x216
|
||||
u8 shortExt[0x04]; //!< 8.3 file extension (set to spaces for directories)
|
||||
u8 shortExt[0x04]; ///< 8.3 file extension (set to spaces for directories)
|
||||
// 0x21A
|
||||
u8 unknown2; //!< ???
|
||||
u8 unknown2; ///< ???
|
||||
// 0x21B
|
||||
u8 unknown3; //!< ???
|
||||
u8 unknown3; ///< ???
|
||||
// 0x21C
|
||||
u8 isDirectory; //!< directory bit
|
||||
u8 isDirectory; ///< directory bit
|
||||
// 0x21D
|
||||
u8 isHidden; //!< hidden bit
|
||||
u8 isHidden; ///< hidden bit
|
||||
// 0x21E
|
||||
u8 isArchive; //!< archive bit
|
||||
u8 isArchive; ///< archive bit
|
||||
// 0x21F
|
||||
u8 isReadOnly; //!< read-only bit
|
||||
u8 isReadOnly; ///< read-only bit
|
||||
// 0x220
|
||||
u64 fileSize; //!< file size
|
||||
u64 fileSize; ///< file size
|
||||
} FS_dirent;
|
||||
|
||||
Result fsInit(void);
|
||||
|
@ -4,10 +4,10 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
//! Initializes the service API.
|
||||
/// Initializes the service API.
|
||||
Result srvInit(void);
|
||||
|
||||
//! Exits the service API.
|
||||
/// Exits the service API.
|
||||
Result srvExit(void);
|
||||
|
||||
/**
|
||||
@ -16,7 +16,7 @@ Result srvExit(void);
|
||||
*/
|
||||
Handle *srvGetSessionHandle(void);
|
||||
|
||||
//! Registers the current process as a client to the service API.
|
||||
/// Registers the current process as a client to the service API.
|
||||
Result srvRegisterClient(void);
|
||||
|
||||
/**
|
||||
@ -47,7 +47,7 @@ Result srvRegisterService(Handle* out, const char* name, int maxSessions);
|
||||
*/
|
||||
Result srvUnregisterService(const char* name);
|
||||
|
||||
//! Initializes the srv:pm port.
|
||||
/// Initializes the srv:pm port.
|
||||
Result srvPmInit(void);
|
||||
|
||||
/**
|
||||
|
@ -37,7 +37,7 @@ typedef enum {
|
||||
MEMOP_ALLOC_LINEAR = MEMOP_LINEAR_FLAG | MEMOP_ALLOC, ///< Allocates linear memory.
|
||||
} MemOp;
|
||||
|
||||
//! The state of a memory block.
|
||||
/// The state of a memory block.
|
||||
typedef enum {
|
||||
MEMSTATE_FREE = 0, ///< Free memory
|
||||
MEMSTATE_RESERVED = 1, ///< Reserved memory
|
||||
@ -53,7 +53,7 @@ typedef enum {
|
||||
MEMSTATE_LOCKED = 11 ///< Locked memory
|
||||
} MemState;
|
||||
|
||||
//! Memory permission flags
|
||||
/// Memory permission flags
|
||||
typedef enum {
|
||||
MEMPERM_READ = 1, ///< Readable
|
||||
MEMPERM_WRITE = 2, ///< Writable
|
||||
@ -61,7 +61,7 @@ typedef enum {
|
||||
MEMPERM_DONTCARE = 0x10000000 ///< Don't care
|
||||
} MemPerm;
|
||||
|
||||
//! Memory information.
|
||||
/// Memory information.
|
||||
typedef struct {
|
||||
u32 base_addr; ///< Base address.
|
||||
u32 size; ///< Size.
|
||||
@ -69,12 +69,12 @@ typedef struct {
|
||||
u32 state; ///< Memory state. See @ref MemState
|
||||
} MemInfo;
|
||||
|
||||
//! Memory page information.
|
||||
/// Memory page information.
|
||||
typedef struct {
|
||||
u32 flags; ///< Page flags.
|
||||
} PageInfo;
|
||||
|
||||
//! Arbitration modes.
|
||||
/// Arbitration modes.
|
||||
typedef enum {
|
||||
ARBITRATION_SIGNAL = 0, ///< Signal #value threads for wake-up.
|
||||
ARBITRATION_WAIT_IF_LESS_THAN = 1, ///< If the memory at the address is strictly lower than #value, then wait for signal.
|
||||
@ -91,7 +91,7 @@ typedef enum {
|
||||
///@name Multithreading
|
||||
///@{
|
||||
|
||||
//! Types of thread info.
|
||||
/// Types of thread info.
|
||||
typedef enum {
|
||||
THREADINFO_TYPE_UNKNOWN ///< Unknown.
|
||||
} ThreadInfoType;
|
||||
@ -105,13 +105,13 @@ typedef enum {
|
||||
///@name Debugging
|
||||
///@{
|
||||
|
||||
//! Reasons for a process event.
|
||||
/// Reasons for a process event.
|
||||
typedef enum {
|
||||
REASON_CREATE = 1, ///< Process created.
|
||||
REASON_ATTACH = 2 ///< Process attached.
|
||||
} ProcessEventReason;
|
||||
|
||||
//! Event relating to a process.
|
||||
/// Event relating to a process.
|
||||
typedef struct {
|
||||
u64 program_id; ///< ID of the program.
|
||||
u8 process_name[8]; ///< Name of the process.
|
||||
@ -119,26 +119,26 @@ typedef struct {
|
||||
u32 reason; ///< Reason for the event. See @ref ProcessEventReason
|
||||
} ProcessEvent;
|
||||
|
||||
//! Reasons for an exit process event.
|
||||
/// Reasons for an exit process event.
|
||||
typedef enum {
|
||||
EXITPROCESS_EVENT_NONE = 0, ///< No reason.
|
||||
EXITPROCESS_EVENT_TERMINATE = 1, ///< Process terminated.
|
||||
EXITPROCESS_EVENT_UNHANDLED_EXCEPTION = 2 ///< Unhandled exception occurred.
|
||||
} ExitProcessEventReason;
|
||||
|
||||
//! Event relating to the exiting of a process.
|
||||
/// Event relating to the exiting of a process.
|
||||
typedef struct {
|
||||
u32 reason; ///< Reason for exiting. See @ref ExitProcessEventReason
|
||||
} ExitProcessEvent;
|
||||
|
||||
//! Event relating to the creation of a thread.
|
||||
/// Event relating to the creation of a thread.
|
||||
typedef struct {
|
||||
u32 creator_thread_id; ///< ID of the creating thread.
|
||||
u32 base_addr; ///< Base address.
|
||||
u32 entry_point; ///< Entry point of the thread.
|
||||
} CreateThreadEvent;
|
||||
|
||||
//! Reasons for an exit thread event.
|
||||
/// Reasons for an exit thread event.
|
||||
typedef enum {
|
||||
EXITTHREAD_EVENT_NONE = 0, ///< No reason.
|
||||
EXITTHREAD_EVENT_TERMINATE = 1, ///< Thread terminated.
|
||||
@ -146,19 +146,19 @@ typedef enum {
|
||||
EXITTHREAD_EVENT_TERMINATE_PROCESS = 3 ///< Process terminated.
|
||||
} ExitThreadEventReason;
|
||||
|
||||
//! Event relating to the exiting of a thread.
|
||||
/// Event relating to the exiting of a thread.
|
||||
typedef struct {
|
||||
u32 reason; ///< Reason for exiting. See @ref ExitThreadEventReason
|
||||
} ExitThreadEvent;
|
||||
|
||||
//! Reasons for a user break.
|
||||
/// Reasons for a user break.
|
||||
typedef enum {
|
||||
USERBREAK_PANIC = 0, ///< Panic.
|
||||
USERBREAK_ASSERT = 1, ///< Assertion failed.
|
||||
USERBREAK_USER = 2 ///< User related.
|
||||
} UserBreakType;
|
||||
|
||||
//! Reasons for an exception event.
|
||||
/// Reasons for an exception event.
|
||||
typedef enum {
|
||||
EXC_EVENT_UNDEFINED_INSTRUCTION = 0, ///< Undefined instruction. arg: (None)
|
||||
EXC_EVENT_UNKNOWN1 = 1, ///< Unknown. arg: (None)
|
||||
@ -171,31 +171,31 @@ typedef enum {
|
||||
EXC_EVENT_UNDEFINED_SYSCALL = 8 ///< Undefined syscall. arg: attempted syscall
|
||||
} ExceptionEventType;
|
||||
|
||||
//! Event relating to exceptions.
|
||||
/// Event relating to exceptions.
|
||||
typedef struct {
|
||||
u32 type; ///< Type of event. See @ref ExceptionEventType
|
||||
u32 address; ///< Address of the exception.
|
||||
u32 argument; ///< Event argument. See @ref ExceptionEventType
|
||||
} ExceptionEvent;
|
||||
|
||||
//! Event relating to the scheduler.
|
||||
/// Event relating to the scheduler.
|
||||
typedef struct {
|
||||
u64 clock_tick; ///< Clock tick that the event occurred.
|
||||
} SchedulerInOutEvent;
|
||||
|
||||
//! Event relating to syscalls.
|
||||
/// Event relating to syscalls.
|
||||
typedef struct {
|
||||
u64 clock_tick; ///< Clock tick that the event occurred.
|
||||
u32 syscall; ///< Syscall sent/received.
|
||||
} SyscallInOutEvent;
|
||||
|
||||
//! Event relating to debug output.
|
||||
/// Event relating to debug output.
|
||||
typedef struct {
|
||||
u32 string_addr; ///< Address of the outputted string.
|
||||
u32 string_size; ///< Size of the outputted string.
|
||||
} OutputStringEvent;
|
||||
|
||||
//! Event relating to the mapping of memory.
|
||||
/// Event relating to the mapping of memory.
|
||||
typedef struct {
|
||||
u32 mapped_addr; ///< Mapped address.
|
||||
u32 mapped_size; ///< Mapped size.
|
||||
@ -203,7 +203,7 @@ typedef struct {
|
||||
u32 memstate; ///< Memory state. See @ref MemState
|
||||
} MapEvent;
|
||||
|
||||
//! Debug event type.
|
||||
/// Debug event type.
|
||||
typedef enum {
|
||||
DBG_EVENT_PROCESS = 0, ///< Process event.
|
||||
DBG_EVENT_CREATE_THREAD = 1, ///< Thread creation event.
|
||||
@ -220,7 +220,7 @@ typedef enum {
|
||||
DBG_EVENT_MAP = 12 ///< Map event.
|
||||
} DebugEventType;
|
||||
|
||||
//! Information about a debug event.
|
||||
/// Information about a debug event.
|
||||
typedef struct {
|
||||
u32 type; ///< Type of event. See @ref DebugEventType
|
||||
u32 thread_id; ///< ID of the thread.
|
||||
@ -441,7 +441,7 @@ Result svcWriteProcessMemory(Handle debug, const void* buffer, u32 addr, u32 siz
|
||||
*/
|
||||
Result svcOpenProcess(Handle* process, u32 processId);
|
||||
|
||||
//! Exits the current process.
|
||||
/// Exits the current process.
|
||||
void svcExitProcess() __attribute__((noreturn));
|
||||
|
||||
/**
|
||||
@ -535,7 +535,7 @@ void svcExitThread(void) __attribute__((noreturn));
|
||||
*/
|
||||
void svcSleepThread(s64 ns);
|
||||
|
||||
//! Retrieves the priority of a thread.
|
||||
/// Retrieves the priority of a thread.
|
||||
Result svcGetThreadPriority(s32 *out, Handle handle);
|
||||
|
||||
/**
|
||||
|
@ -4,10 +4,10 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
//! A light lock.
|
||||
/// A light lock.
|
||||
typedef s32 LightLock;
|
||||
|
||||
//! A recursive lock.
|
||||
/// A recursive lock.
|
||||
typedef struct
|
||||
{
|
||||
LightLock lock; ///< Inner light lock.
|
||||
@ -15,7 +15,7 @@ typedef struct
|
||||
u32 counter; ///< Lock count.
|
||||
} RecursiveLock;
|
||||
|
||||
//! Performs a clrex operation.
|
||||
/// Performs a clrex operation.
|
||||
static inline void __clrex(void)
|
||||
{
|
||||
__asm__ __volatile__("clrex");
|
||||
|
@ -8,10 +8,10 @@
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
//! The maximum value of a u64.
|
||||
/// The maximum value of a u64.
|
||||
#define U64_MAX UINT64_MAX
|
||||
|
||||
//! Possible media types.
|
||||
/// Possible media types.
|
||||
typedef enum
|
||||
{
|
||||
mediatype_NAND, ///< NAND
|
||||
@ -43,15 +43,15 @@ typedef u32 Handle; ///< Resource handle.
|
||||
typedef s32 Result; ///< Function result.
|
||||
typedef void (*ThreadFunc)(void *); ///< Thread entrypoint function.
|
||||
|
||||
//! Creates a bitmask from a bit number.
|
||||
/// Creates a bitmask from a bit number.
|
||||
#define BIT(n) (1U<<(n))
|
||||
|
||||
//! aligns a struct (and other types?) to m, making sure that the size of the struct is a multiple of m.
|
||||
/// aligns a struct (and other types?) to m, making sure that the size of the struct is a multiple of m.
|
||||
#define ALIGN(m) __attribute__((aligned(m)))
|
||||
//! packs a struct (and other types?) so it won't include padding bytes.
|
||||
/// packs a struct (and other types?) so it won't include padding bytes.
|
||||
#define PACKED __attribute__((packed))
|
||||
|
||||
//! flags a function as deprecated.
|
||||
/// flags a function as deprecated.
|
||||
#ifndef LIBCTRU_NO_DEPRECATION
|
||||
#define DEPRECATED __attribute__ ((deprecated))
|
||||
#else
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
//! brief Retreives an rbtree item.
|
||||
/// brief Retreives an rbtree item.
|
||||
#define rbtree_item(ptr, type, member) \
|
||||
((type*)(((char*)ptr) - offsetof(type, member)))
|
||||
|
||||
@ -18,14 +18,14 @@ typedef void (*rbtree_node_destructor_t)(rbtree_node_t *Node); ///< rbtree
|
||||
typedef int (*rbtree_node_comparator_t)(const rbtree_node_t *lhs,
|
||||
const rbtree_node_t *rhs); ///< rbtree node comparator.
|
||||
|
||||
//! An rbtree node.
|
||||
/// An rbtree node.
|
||||
struct rbtree_node
|
||||
{
|
||||
uintptr_t parent_color; ///< Parent color.
|
||||
rbtree_node_t *child[2]; ///< Node children.
|
||||
};
|
||||
|
||||
//! An rbtree.
|
||||
/// An rbtree.
|
||||
struct rbtree
|
||||
{
|
||||
rbtree_node_t *root; ///< Root node.
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/*! Convert a UTF-8 sequence into a UTF-32 codepoint
|
||||
/** Convert a UTF-8 sequence into a UTF-32 codepoint
|
||||
*
|
||||
* @param[out] out Output codepoint
|
||||
* @param[in] in Input sequence
|
||||
@ -17,7 +17,7 @@
|
||||
*/
|
||||
ssize_t decode_utf8 (uint32_t *out, const uint8_t *in);
|
||||
|
||||
/*! Convert a UTF-16 sequence into a UTF-32 codepoint
|
||||
/** Convert a UTF-16 sequence into a UTF-32 codepoint
|
||||
*
|
||||
* @param[out] out Output codepoint
|
||||
* @param[in] in Input sequence
|
||||
@ -27,7 +27,7 @@ ssize_t decode_utf8 (uint32_t *out, const uint8_t *in);
|
||||
*/
|
||||
ssize_t decode_utf16(uint32_t *out, const uint16_t *in);
|
||||
|
||||
/*! Convert a UTF-32 codepoint into a UTF-8 sequence
|
||||
/** Convert a UTF-32 codepoint into a UTF-8 sequence
|
||||
*
|
||||
* @param[out] out Output sequence
|
||||
* @param[in] in Input codepoint
|
||||
@ -39,7 +39,7 @@ ssize_t decode_utf16(uint32_t *out, const uint16_t *in);
|
||||
*/
|
||||
ssize_t encode_utf8 (uint8_t *out, uint32_t in);
|
||||
|
||||
/*! Convert a UTF-32 codepoint into a UTF-16 sequence
|
||||
/** Convert a UTF-32 codepoint into a UTF-16 sequence
|
||||
*
|
||||
* @param[out] out Output sequence
|
||||
* @param[in] in Input codepoint
|
||||
@ -51,7 +51,7 @@ ssize_t encode_utf8 (uint8_t *out, uint32_t in);
|
||||
*/
|
||||
ssize_t encode_utf16(uint16_t *out, uint32_t in);
|
||||
|
||||
/*! Convert a UTF-8 sequence into a UTF-16 sequence
|
||||
/** Convert a UTF-8 sequence into a UTF-16 sequence
|
||||
*
|
||||
* @param[out] out Output sequence
|
||||
* @param[in] in Input sequence
|
||||
@ -61,7 +61,7 @@ ssize_t encode_utf16(uint16_t *out, uint32_t in);
|
||||
*/
|
||||
size_t utf8_to_utf16(uint16_t *out, const uint8_t *in, size_t len);
|
||||
|
||||
/*! Convert a UTF-8 sequence into a UTF-32 sequence
|
||||
/** Convert a UTF-8 sequence into a UTF-32 sequence
|
||||
*
|
||||
* @param[out] out Output sequence
|
||||
* @param[in] in Input sequence
|
||||
@ -71,7 +71,7 @@ size_t utf8_to_utf16(uint16_t *out, const uint8_t *in, size_t len);
|
||||
*/
|
||||
size_t utf8_to_utf32(uint32_t *out, const uint8_t *in, size_t len);
|
||||
|
||||
/*! Convert a UTF-16 sequence into a UTF-8 sequence
|
||||
/** Convert a UTF-16 sequence into a UTF-8 sequence
|
||||
*
|
||||
* @param[out] out Output sequence
|
||||
* @param[in] in Input sequence
|
||||
@ -81,7 +81,7 @@ size_t utf8_to_utf32(uint32_t *out, const uint8_t *in, size_t len);
|
||||
*/
|
||||
size_t utf16_to_utf8(uint8_t *out, const uint16_t *in, size_t len);
|
||||
|
||||
/*! Convert a UTF-16 sequence into a UTF-32 sequence
|
||||
/** Convert a UTF-16 sequence into a UTF-32 sequence
|
||||
*
|
||||
* @param[out] out Output sequence
|
||||
* @param[in] in Input sequence
|
||||
@ -91,7 +91,7 @@ size_t utf16_to_utf8(uint8_t *out, const uint16_t *in, size_t len);
|
||||
*/
|
||||
size_t utf16_to_utf32(uint32_t *out, const uint16_t *in, size_t len);
|
||||
|
||||
/*! Convert a UTF-32 sequence into a UTF-8 sequence
|
||||
/** Convert a UTF-32 sequence into a UTF-8 sequence
|
||||
*
|
||||
* @param[out] out Output sequence
|
||||
* @param[in] in Input sequence
|
||||
@ -101,7 +101,7 @@ size_t utf16_to_utf32(uint32_t *out, const uint16_t *in, size_t len);
|
||||
*/
|
||||
size_t utf32_to_utf8(uint8_t *out, const uint32_t *in, size_t len);
|
||||
|
||||
/*! Convert a UTF-32 sequence into a UTF-16 sequence
|
||||
/** Convert a UTF-32 sequence into a UTF-16 sequence
|
||||
*
|
||||
* @param[out] out Output sequence
|
||||
* @param[in] in Input sequence
|
||||
|
Loading…
Reference in New Issue
Block a user