Skip to content

Commit

Permalink
Document usb
Browse files Browse the repository at this point in the history
  • Loading branch information
dogo committed Sep 1, 2024
1 parent 439a5dc commit 00a223e
Showing 1 changed file with 51 additions and 15 deletions.
66 changes: 51 additions & 15 deletions src/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,69 @@
#include <pspusbstor.h>
#include <pspsdk.h>

/** @file usb.h
* @brief USB Module Header File
*
* This file contains functions and definitions related to USB operations,
* including initializing, starting, stopping, and deinitializing USB storage.
*/

/** @brief Gets the current USB state.
*
* This macro retrieves the current state of the USB connection.
* It maps directly to `sceUsbGetState`.
*/
#define oslGetUsbState sceUsbGetState

/** @defgroup Usb USB
* @brief USB functions to start/stop USB storage.
* @{
*/

USB functions to start/stop usb storage
@{
*/

enum {OSL_USB_ACTIVATED=PSP_USB_ACTIVATED,
OSL_USB_CABLE_CONNECTED=PSP_USB_CABLE_CONNECTED,
OSL_USB_CONNECTION_ESTABLISHED=PSP_USB_CONNECTION_ESTABLISHED};
/** @brief USB State Enum.
*
* Enum containing the possible states of the USB connection.
*/
enum {
OSL_USB_ACTIVATED = PSP_USB_ACTIVATED, /**< USB is activated */
OSL_USB_CABLE_CONNECTED = PSP_USB_CABLE_CONNECTED, /**< USB cable is connected */
OSL_USB_CONNECTION_ESTABLISHED = PSP_USB_CONNECTION_ESTABLISHED /**< USB connection is established */
};

/** Initializes USB modules, must be called before oslStartUsbStorage.
Returns 0 on success.*/
/** @brief Initializes the USB storage modules.
*
* This function initializes the necessary USB modules. It must be called
* before any other USB storage operations.
*
* @return Returns 0 on success, a negative value on failure.
*/
extern int oslInitUsbStorage();

/** Starts USB storage
Returns 0 on success.*/
/** @brief Starts USB storage.
*
* This function starts the USB storage, making the PSP appear as a USB storage
* device when connected to a host.
*
* @return Returns 0 on success, a negative value on failure.
*/
extern int oslStartUsbStorage();

/** Stops USB storage
Returns 0 on success.*/
/** @brief Stops USB storage.
*
* This function stops the USB storage, safely disconnecting the PSP from the
* host system.
*
* @return Returns 0 on success, a negative value on failure.
*/
extern int oslStopUsbStorage();

/** Deinitializes USB modules. */
/** @brief Deinitializes the USB storage modules.
*
* This function deinitializes the USB modules, releasing any resources that
* were allocated during initialization.
*/
extern int oslDeinitUsbStorage();

/** @} */ // end of USB
/** @} */ // end of Usb

#endif

0 comments on commit 00a223e

Please sign in to comment.