mirror of
https://github.com/switchbrew/libnx.git
synced 2025-08-07 00:29:23 +02:00
Miscellaneous documentation fixes
This commit is contained in:
parent
4094c014ff
commit
d911c47d2e
@ -1,18 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* @file atomics.h
|
||||||
|
* @brief AArch64 atomic operations.
|
||||||
|
* @author plutoo
|
||||||
|
* @copyright libnx Authors
|
||||||
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "../types.h"
|
#include "../types.h"
|
||||||
|
|
||||||
|
/// Atomically increments a 32-bit value.
|
||||||
static inline u32 atomicIncrement32(u32* p) {
|
static inline u32 atomicIncrement32(u32* p) {
|
||||||
return __atomic_fetch_add(p, 1, __ATOMIC_SEQ_CST);
|
return __atomic_fetch_add(p, 1, __ATOMIC_SEQ_CST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Atomically decrements a 32-bit value.
|
||||||
static inline u32 atomicDecrement32(u32* p) {
|
static inline u32 atomicDecrement32(u32* p) {
|
||||||
return __atomic_sub_fetch(p, 1, __ATOMIC_SEQ_CST);
|
return __atomic_sub_fetch(p, 1, __ATOMIC_SEQ_CST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Atomically increments a 64-bit value.
|
||||||
static inline u64 atomicIncrement64(u64* p) {
|
static inline u64 atomicIncrement64(u64* p) {
|
||||||
return __atomic_fetch_add(p, 1, __ATOMIC_SEQ_CST);
|
return __atomic_fetch_add(p, 1, __ATOMIC_SEQ_CST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Atomically decrements a 64-bit value.
|
||||||
static inline u64 atomicDecrement64(u64* p) {
|
static inline u64 atomicDecrement64(u64* p) {
|
||||||
return __atomic_sub_fetch(p, 1, __ATOMIC_SEQ_CST);
|
return __atomic_sub_fetch(p, 1, __ATOMIC_SEQ_CST);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,19 @@
|
|||||||
// Copyright 2018 plutoo
|
/**
|
||||||
|
* @file event.h
|
||||||
|
* @brief Kernel-mode event synchronization primitive.
|
||||||
|
* @author plutoo
|
||||||
|
* @copyright libnx Authors
|
||||||
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "../types.h"
|
#include "../types.h"
|
||||||
#include "../result.h"
|
#include "../result.h"
|
||||||
#include "wait.h"
|
#include "wait.h"
|
||||||
|
|
||||||
|
/// Kernel-mode event structure.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Handle revent;
|
Handle revent; ///< Read-only event handle
|
||||||
Handle wevent;
|
Handle wevent; ///< Write-only event handle
|
||||||
bool autoclear;
|
bool autoclear; ///< Autoclear flag
|
||||||
} Event;
|
} Event;
|
||||||
|
|
||||||
/// Creates a \ref Waiter for a kernel-mode event.
|
/// Creates a \ref Waiter for a kernel-mode event.
|
||||||
@ -19,16 +25,60 @@ static inline Waiter waiterForEvent(Event* t)
|
|||||||
return wait_obj;
|
return wait_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Creates a kernel-mode event.
|
||||||
|
* @param[out] t Pointer to \ref Event structure.
|
||||||
|
* @param[in] autoclear Autoclear flag.
|
||||||
|
* @return Result code.
|
||||||
|
* @warning This is a privileged operation; in normal circumstances applications shouldn't use this function.
|
||||||
|
*/
|
||||||
Result eventCreate(Event* t, bool autoclear);
|
Result eventCreate(Event* t, bool autoclear);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Loads a kernel-mode event obtained from IPC.
|
||||||
|
* @param[out] t Pointer to \ref Event structure.
|
||||||
|
* @param[in] handle Read-only event handle.
|
||||||
|
* @param[in] autoclear Autoclear flag.
|
||||||
|
*/
|
||||||
void eventLoadRemote(Event* t, Handle handle, bool autoclear);
|
void eventLoadRemote(Event* t, Handle handle, bool autoclear);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Closes a kernel-mode event.
|
||||||
|
* @param[in] t Pointer to \ref Event structure.
|
||||||
|
*/
|
||||||
void eventClose(Event* t);
|
void eventClose(Event* t);
|
||||||
|
|
||||||
/// Returns whether the Event is initialized.
|
/**
|
||||||
|
* @brief Returns whether an \ref Event is initialized.
|
||||||
|
* @param[in] t Pointer to \ref Event structure.
|
||||||
|
* @return Initialization status.
|
||||||
|
*/
|
||||||
static inline bool eventActive(Event* t)
|
static inline bool eventActive(Event* t)
|
||||||
{
|
{
|
||||||
return t->revent != INVALID_HANDLE;
|
return t->revent != INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Waits on a kernel-mode event.
|
||||||
|
* @param[in] t Pointer to \ref Event structure.
|
||||||
|
* @param[in] timeout Timeout in nanoseconds (pass UINT64_MAX to wait indefinitely).
|
||||||
|
* @return Result code.
|
||||||
|
*/
|
||||||
Result eventWait(Event* t, u64 timeout);
|
Result eventWait(Event* t, u64 timeout);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Signals a kernel-mode event.
|
||||||
|
* @param[in] t Pointer to \ref Event structure.
|
||||||
|
* @return Result code.
|
||||||
|
* @note This function only works for events initialized with \ref eventCreate, it doesn't work with events initialized with \ref eventLoadRemote.
|
||||||
|
* @warning This is a privileged operation; in normal circumstances applications shouldn't use this function.
|
||||||
|
*/
|
||||||
Result eventFire(Event* t);
|
Result eventFire(Event* t);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Clears a kernel-mode event.
|
||||||
|
* @param[in] t Pointer to \ref Event structure.
|
||||||
|
* @return Result code.
|
||||||
|
* @note This function shouldn't be used on autoclear events.
|
||||||
|
*/
|
||||||
Result eventClear(Event* t);
|
Result eventClear(Event* t);
|
||||||
|
@ -1,10 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* @file nxlink.h
|
||||||
|
* @brief Netloader (nxlink) utilities
|
||||||
|
* @author WinterMute
|
||||||
|
* @copyright libnx Authors
|
||||||
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
struct in_addr;
|
struct in_addr;
|
||||||
|
|
||||||
|
/// Address of the host connected through nxlink
|
||||||
extern struct in_addr __nxlink_host;
|
extern struct in_addr __nxlink_host;
|
||||||
|
|
||||||
#define NXLINK_SERVER_PORT 28280
|
#define NXLINK_SERVER_PORT 28280 ///< nxlink TCP server port
|
||||||
#define NXLINK_CLIENT_PORT 28771
|
#define NXLINK_CLIENT_PORT 28771 ///< nxlink TCP client port
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets up stdout/stderr redirection to the nxlink host.
|
||||||
|
* @return Socket fd on success, negative number on failure.
|
||||||
|
* @note The socket should be closed with close() during application cleanup.
|
||||||
|
*/
|
||||||
int nxlinkStdio(void);
|
int nxlinkStdio(void);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @file i2c.h
|
* @file gpio.h
|
||||||
* @brief I2C service IPC wrapper.
|
* @brief GPIO service IPC wrapper.
|
||||||
* @author SciresM
|
* @author SciresM
|
||||||
* @copyright libnx Authors
|
* @copyright libnx Authors
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user