-/*! \file console.h\r
- \brief 3ds stdio support.\r
-\r
-<div class="fileHeader">\r
-Provides stdio integration for printing to the 3DS screen as well as debug print\r
-functionality provided by stderr.\r
-\r
-General usage is to initialize the console by:\r
-consoleDemoInit()\r
-or to customize the console usage by:\r
-consoleInit()\r
-\r
+/**\r
+ * @file console.h\r
+ * @brief 3ds stdio support.\r
+ *\r
+ * Provides stdio integration for printing to the 3DS screen as well as debug print\r
+ * functionality provided by stderr.\r
+ *\r
+ * General usage is to initialize the console by:\r
+ * consoleDemoInit()\r
+ * or to customize the console usage by:\r
+ * consoleInit()\r
*/\r
-\r
-#ifndef CONSOLE_H\r
-#define CONSOLE_H\r
+#pragma once\r
\r
#include <3ds/types.h>\r
#include <3ds/gfx.h>\r
extern "C" {\r
#endif\r
\r
-typedef bool(* ConsolePrint)(void* con, int c);\r
+/// A callback for printing a character.\r
+typedef bool(*ConsolePrint)(void* con, int c);\r
\r
-//! a font struct for the console.\r
+/// A font struct for the console.\r
typedef struct ConsoleFont\r
{\r
- u8* gfx; //!< A pointer to the font graphics\r
- u16 asciiOffset; //!< Offset to the first valid character in the font table\r
- u16 numChars; //!< Number of characters in the font graphics\r
+ u8* gfx; ///< A pointer to the font graphics\r
+ u16 asciiOffset; ///< Offset to the first valid character in the font table\r
+ u16 numChars; ///< Number of characters in the font graphics\r
\r
}ConsoleFont;\r
\r
-/** \brief console structure used to store the state of a console render context.\r
-\r
-Default values from consoleGetDefault();\r
-<div class="fixedFont"><pre>\r
-PrintConsole defaultConsole =\r
-{\r
- //Font:\r
- {\r
- (u8*)default_font_bin, //font gfx\r
- 0, //first ascii character in the set\r
- 128, //number of characters in the font set\r
- },\r
- 0,0, //cursorX cursorY\r
- 0,0, //prevcursorX prevcursorY\r
- 40, //console width\r
- 30, //console height\r
- 0, //window x\r
- 0, //window y\r
- 32, //window width\r
- 24, //window height\r
- 3, //tab size\r
- 0, //font character offset\r
- 0, //print callback\r
- false //console initialized\r
-};\r
-</pre></div>\r
-*/\r
+/**\r
+ * @brief console structure used to store the state of a console render context.\r
+ *\r
+ * Default values from consoleGetDefault();\r
+ * <div class="fixedFont"><pre>\r
+ * PrintConsole defaultConsole =\r
+ * {\r
+ * //Font:\r
+ * {\r
+ * (u8*)default_font_bin, //font gfx\r
+ * 0, //first ascii character in the set\r
+ * 128, //number of characters in the font set\r
+ * },\r
+ * 0,0, //cursorX cursorY\r
+ * 0,0, //prevcursorX prevcursorY\r
+ * 40, //console width\r
+ * 30, //console height\r
+ * 0, //window x\r
+ * 0, //window y\r
+ * 32, //window width\r
+ * 24, //window height\r
+ * 3, //tab size\r
+ * 0, //font character offset\r
+ * 0, //print callback\r
+ * false //console initialized\r
+ * };\r
+ * </pre></div>\r
+ */\r
typedef struct PrintConsole\r
{\r
- ConsoleFont font; //!< font of the console.\r
+ ConsoleFont font; ///< Font of the console.\r
\r
- u16 *frameBuffer; //!< framebuffer address.\r
+ u16 *frameBuffer; ///< Framebuffer address.\r
\r
- int cursorX; /*!< Current X location of the cursor (as a tile offset by default) */\r
- int cursorY; /*!< Current Y location of the cursor (as a tile offset by default) */\r
+ int cursorX; ///< Current X location of the cursor (as a tile offset by default)\r
+ int cursorY; ///< Current Y location of the cursor (as a tile offset by default)\r
\r
- int prevCursorX; /*!< Internal state */\r
- int prevCursorY; /*!< Internal state */\r
+ int prevCursorX; ///< Internal state\r
+ int prevCursorY; ///< Internal state\r
\r
- int consoleWidth; /*!< Width of the console hardware layer in characters */\r
- int consoleHeight; /*!< Height of the console hardware layer in characters */\r
+ int consoleWidth; ///< Width of the console hardware layer in characters\r
+ int consoleHeight; ///< Height of the console hardware layer in characters\r
\r
- int windowX; /*!< Window X location in characters (not implemented) */\r
- int windowY; /*!< Window Y location in characters (not implemented) */\r
- int windowWidth; /*!< Window width in characters (not implemented) */\r
- int windowHeight; /*!< Window height in characters (not implemented) */\r
+ int windowX; ///< Window X location in characters (not implemented)\r
+ int windowY; ///< Window Y location in characters (not implemented)\r
+ int windowWidth; ///< Window width in characters (not implemented)\r
+ int windowHeight; ///< Window height in characters (not implemented)\r
\r
- int tabSize; /*!< Size of a tab*/\r
- int fg; /*!< foreground color*/\r
- int bg; /*!< background color*/\r
- int flags; /*!< reverse/bright flags*/\r
+ int tabSize; ///< Size of a tab\r
+ int fg; ///< Foreground color\r
+ int bg; ///< Background color\r
+ int flags; ///< Reverse/bright flags\r
\r
- ConsolePrint PrintChar; /*!< callback for printing a character. Should return true if it has handled rendering the graphics\r
- (else the print engine will attempt to render via tiles) */\r
+ 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).\r
\r
- bool consoleInitialised; /*!< True if the console is initialized */\r
+ bool consoleInitialised; ///< True if the console is initialized\r
}PrintConsole;\r
\r
#define CONSOLE_COLOR_BOLD (1<<0)\r
#define CONSOLE_CONCEAL (1<<7)\r
#define CONSOLE_CROSSED_OUT (1<<8)\r
\r
-//! Console debug devices supported by libnds.\r
+/// Console debug devices supported by libnds.\r
typedef enum {\r
- debugDevice_NULL, //!< swallows prints to stderr\r
- debugDevice_3DMOO, //!< Directs stderr debug statements to 3dmoo\r
- debugDevice_CONSOLE, //!< Directs stderr debug statements to 3DS console window\r
+ debugDevice_NULL, ///< swallows prints to stderr\r
+ debugDevice_3DMOO, ///< Directs stderr debug statements to 3dmoo\r
+ debugDevice_CONSOLE, ///< Directs stderr debug statements to 3DS console window\r
} debugDevice;\r
\r
-/*! \brief Loads the font into the console\r
- \param console pointer to the console to update, if NULL it will update the current console\r
- \param font the font to load\r
+/**\r
+ * @brief Loads the font into the console.\r
+ * @param console Pointer to the console to update, if NULL it will update the current console.\r
+ * @param font The font to load.\r
*/\r
void consoleSetFont(PrintConsole* console, ConsoleFont* font);\r
\r
-/*! \brief Sets the print window\r
- \param console console to set, if NULL it will set the current console window\r
- \param x x location of the window\r
- \param y y location of the window\r
- \param width width of the window\r
- \param height height of the window\r
+/**\r
+ * @brief Sets the print window.\r
+ * @param console Console to set, if NULL it will set the current console window.\r
+ * @param x X location of the window.\r
+ * @param y Y location of the window.\r
+ * @param width Width of the window.\r
+ * @param height Height of the window.\r
*/\r
void consoleSetWindow(PrintConsole* console, int x, int y, int width, int height);\r
\r
-/*! \brief Gets a pointer to the console with the default values\r
- this should only be used when using a single console or without changing the console that is returned, other wise use consoleInit()\r
- \return A pointer to the console with the default values\r
+/**\r
+ * @brief Gets a pointer to the console with the default values.\r
+ * This should only be used when using a single console or without changing the console that is returned, otherwise use consoleInit().\r
+ * @return A pointer to the console with the default values.\r
*/\r
PrintConsole* consoleGetDefault(void);\r
\r
-/*! \brief Make the specified console the render target\r
- \param console A pointer to the console struct (must have been initialized with consoleInit(PrintConsole* console)\r
- \return a pointer to the previous console\r
+/**\r
+ * @brief Make the specified console the render target.\r
+ * @param console A pointer to the console struct (must have been initialized with consoleInit(PrintConsole* console)).\r
+ * @return A pointer to the previous console.\r
*/\r
PrintConsole *consoleSelect(PrintConsole* console);\r
\r
-/*! \brief Initialise the console.\r
- \param screen The screen to use for the console\r
- \param console A pointer to the console data to initialze (if it's NULL, the default console will be used)\r
- \return A pointer to the current console.\r
+/**\r
+ * @brief Initialise the console.\r
+ * @param screen The screen to use for the console.\r
+ * @param console A pointer to the console data to initialize (if it's NULL, the default console will be used).\r
+ * @return A pointer to the current console.\r
*/\r
PrintConsole* consoleInit(gfxScreen_t screen, PrintConsole* console);\r
\r
-/*! \brief Initializes debug console output on stderr to the specified device\r
- \param device The debug device (or devices) to output debug print statements to\r
+/**\r
+ * @brief Initializes debug console output on stderr to the specified device.\r
+ * @param device The debug device (or devices) to output debug print statements to.\r
*/\r
void consoleDebugInit(debugDevice device);\r
\r
-\r
-//! Clears the screan by using iprintf("\x1b[2J");\r
+/// Clears the screan by using iprintf("\x1b[2J");\r
void consoleClear(void);\r
\r
#ifdef __cplusplus\r
}\r
#endif\r
-\r
-#endif\r
#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
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
#include <3ds/types.h>
-//! IPC buffer access rights.
+/// IPC buffer access rights.
typedef enum
{
IPC_BUFFER_R = BIT(1), ///< Readable
#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.
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.
*
u32 osGetKernelVersion(void);
/**
+ * @brief Gets the current time.
* @return The number of milliseconds since 1st Jan 1900 00:00.
*/
u64 osGetTime(void);
#include <3ds/types.h>
-//! RomFS header.
+/// RomFS header.
typedef struct
{
u32 headerSize; ///< Size of the header.
u32 fileDataOff; ///< Offset of the file data.
} romfs_header;
-//! RomFS directory.
+/// RomFS directory.
typedef struct
{
u32 parent; ///< Offset of the parent directory.
u16 name[]; ///< Name. (UTF-16)
} romfs_dir;
-//! RomFS file.
+/// RomFS file.
typedef struct
{
u32 parent; ///< Offset of the parent directory.
u16 name[]; ///< Name. (UTF-16)
} romfs_file;
-//! Initializes the RomFS driver.
+/// Initializes the RomFS driver.
Result romfsInit(void);
/**
*/
Result romfsInitFromFile(Handle file, u32 offset);
-//! Exits the RomFS driver.
+/// Exits the RomFS driver.
Result romfsExit(void);
#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);
+/**
+ * @file FS.h
+ * @brief Filesystem Services
+ */
#pragma once
-#include <3ds/types.h>
-/*! @file FS.h
- *
- * Filesystem Services
- */
+#include <3ds/types.h>
-/*! @defgroup fs_open_flags FS Open Flags
+/**
+ * @defgroup fs_open_flags FS Open Flags
*
- * @sa FSUSER_OpenFile
- * @sa FSUSER_OpenFileDirectly
+ * @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,
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);
*/
#pragma once
-//! Initializes the service API.
+/// Initializes the service API.
Result srvInit(void);
-//! Exits the service API.
+/// Exits the service API.
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);
/**
*/
Result srvUnregisterService(const char* name);
-//! Initializes the srv:pm port.
+/// Initializes the srv:pm port.
Result srvPmInit(void);
/**
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
MEMSTATE_LOCKED = 11 ///< Locked memory
} MemState;
-//! Memory permission flags
+/// Memory permission flags
typedef enum {
MEMPERM_READ = 1, ///< Readable
MEMPERM_WRITE = 2, ///< Writable
MEMPERM_DONTCARE = 0x10000000 ///< Don't care
} MemPerm;
-//! Memory information.
+/// Memory information.
typedef struct {
u32 base_addr; ///< Base address.
u32 size; ///< Size.
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.
///@name Multithreading
///@{
-//! Types of thread info.
+/// Types of thread info.
typedef enum {
THREADINFO_TYPE_UNKNOWN ///< Unknown.
} ThreadInfoType;
///@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.
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.
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)
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.
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.
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.
*/
Result svcOpenProcess(Handle* process, u32 processId);
-//! Exits the current process.
+/// Exits the current process.
void svcExitProcess() __attribute__((noreturn));
/**
*/
void svcSleepThread(s64 ns);
-//! Retrieves the priority of a thread.
+/// Retrieves the priority of a thread.
Result svcGetThreadPriority(s32 *out, Handle handle);
/**
*/
#pragma once
-//! A light lock.
+/// A light lock.
typedef s32 LightLock;
-//! A recursive lock.
+/// A recursive lock.
typedef struct
{
LightLock lock; ///< Inner light lock.
u32 counter; ///< Lock count.
} RecursiveLock;
-//! Performs a clrex operation.
+/// Performs a clrex operation.
static inline void __clrex(void)
{
__asm__ __volatile__("clrex");
#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
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
#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)))
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.
#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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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