diff options
Diffstat (limited to '')
-rw-r--r-- | include/kernel/display.h | 87 | ||||
-rw-r--r-- | include/kernel/kernel/cpu.h | 78 | ||||
-rw-r--r-- | include/kernel/kernel/intrmgr.h | 60 | ||||
-rw-r--r-- | include/kernel/kernel/threadmgr.h | 2 | ||||
-rw-r--r-- | include/kernel/udcd.h | 1 | ||||
-rw-r--r-- | include/kernel/usbd.h | 63 | ||||
-rw-r--r-- | include/user/appmgr.h | 3 | ||||
-rw-r--r-- | include/user/kernel/threadmgr.h | 2 | ||||
-rw-r--r-- | include/user/power.h | 7 | ||||
-rw-r--r-- | include/user/usbd.h | 87 |
10 files changed, 374 insertions, 16 deletions
diff --git a/include/kernel/display.h b/include/kernel/display.h new file mode 100644 index 0000000..0f49bee --- /dev/null +++ b/include/kernel/display.h @@ -0,0 +1,87 @@ +#ifndef _PSP2_KERNEL_DISPLAY_H_ +#define _PSP2_KERNEL_DISPLAY_H_ + +#include <psp2/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + SCE_DISPLAY_ERROR_OK = 0, + SCE_DISPLAY_ERROR_INVALID_HEAD = 0x80290000, + SCE_DISPLAY_ERROR_INVALID_VALUE = 0x80290001, + SCE_DISPLAY_ERROR_INVALID_ADDR = 0x80290002, + SCE_DISPLAY_ERROR_INVALID_PIXELFORMAT = 0x80290003, + SCE_DISPLAY_ERROR_INVALID_PITCH = 0x80290004, + SCE_DISPLAY_ERROR_INVALID_RESOLUTION = 0x80290005, + SCE_DISPLAY_ERROR_INVALID_UPDATETIMING = 0x80290006, + SCE_DISPLAY_ERROR_NO_FRAME_BUFFER = 0x80290007, + SCE_DISPLAY_ERROR_NO_PIXEL_DATA = 0x80290008 +}; + +#define SCE_DISPLAY_PIXELFORMAT_A8B8G8R8 0x00000000U + +enum { + /** Buffer change effective immediately */ + SCE_DISPLAY_SETBUF_IMMEDIATE = 0, + /** Buffer change effective next frame */ + SCE_DISPLAY_SETBUF_NEXTFRAME = 1 +}; + +/** + * Structure used with sceDisplaySetFrameBuf to set/update framebuffer. + * Original screen resolution is 960x544, but the following resolutions + * can also be supplied as width and height : + * 480x272, 640x368, 720x408 + * + * @note - This structure is returned by sceDisplayGetFrameBuf +*/ +typedef struct SceDisplayFrameBuf { + SceSize size; //!< sizeof(SceDisplayFrameBuf) + void *base; //!< Pointer to framebuffer + unsigned int pitch; //!< pitch pixels + unsigned int pixelformat; //!< use SCE_DISPLAY_PIXELFORMAT_A8B8G8R8 + unsigned int width; //!< framebuffer width + unsigned int height; //!< framebuffer height +} SceDisplayFrameBuf; + +/** + * Set/Update framebuffer parameters + * + * @param[in] pParam - Pointer to a ::SceDisplayFrameBuf structure. + * @param[in] sync - One of ::DisplaySetBufSync + * + * @return 0 on success, < 0 on error. + * @note - If NULL is provided as pParam pointer, output is blacked out. +*/ +int sceDisplaySetFrameBuf(const SceDisplayFrameBuf *pParam, int sync); + +/** + * Get current framebuffer parameters + * + * @param[out] pParam - Pointer to a ::SceDisplayFrameBuf structure + * which will receive framebuffer parameters. + * + * @param[in] sync - One of ::DisplaySetBufSync + * + * @return 0 on success, < 0 on error. +*/ +int sceDisplayGetFrameBuf(SceDisplayFrameBuf *pParam, int sync); + +/** + * Get current framebuffer dimensions + * + * @param[out] width - Framebuffer width + * @param[out] height - Framebuffer height + * + * @return 0 on success, < 0 on error. +*/ +int sceDisplayGetFrameBufDimensions(int *width, int *height); + +#ifdef __cplusplus +} +#endif + +#endif /* _PSP2_KERNEL_DISPLAY_H_ */ + diff --git a/include/kernel/kernel/cpu.h b/include/kernel/kernel/cpu.h index 859424d..96f51fe 100644 --- a/include/kernel/kernel/cpu.h +++ b/include/kernel/kernel/cpu.h @@ -80,56 +80,112 @@ int sceKernelCpuDisableInterrupts(void); int sceKernelCpuEnableInterrupts(int flags); /** - * @brief Flush L1 dcache and L2 + * @brief Writeback a range of L1 dcache (without L2) * - * Note: symbols currently does not work on 3.x, need to find new ones. + * @param ptr The pointer + * @param[in] len The length + * + * @return Zero on success + */ +int sceKernelCpuDcacheWritebackRange(void *ptr, size_t len); + +/** + * @brief Invalidate a range of L1 dcache (without L2) * * @param ptr The pointer * @param[in] len The length * * @return Zero on success */ -int sceKernelCpuDcacheAndL2Flush(void *ptr, size_t len); +int sceKernelCpuDcacheInvalidateRange(void *ptr, size_t len); /** - * @brief Flush L2 dcache without L2 + * @brief Writeback and invalidate a range of L1 dcache (without L2) * * @param ptr The pointer * @param[in] len The length * * @return Zero on success */ -int sceKernelCpuDcacheFlush(void *ptr, size_t len); +int sceKernelCpuDcacheWritebackInvalidateRange(void *ptr, size_t len); + +/** + * @brief Invalidate all the L1 dcache (without L2) + * + * @return Zero on success + */ +int sceKernelCpuDcacheInvalidateAll(void); + +/** + * @brief Writeback all the L1 dcache (without L2) + * + * @return Zero on success + */ +int sceKernelCpuDcacheWritebackAll(void); + +/** + * @brief Writeback and invalidate all the L1 dcache (without L2) + * + * @return Zero on success + */ +int sceKernelCpuDcacheWritebackInvalidateAll(void); /** - * @brief Writeback a range of L1 dcache (not sure if L2 too) + * @brief Writeback a range of L1 dcache and L2 * * @param ptr The pointer * @param[in] len The length * * @return Zero on success */ -int sceKernelCpuDcacheWritebackRange(void *ptr, size_t len); +int sceKernelCpuDcacheAndL2WritebackRange(void *ptr, size_t len); + +/** + * @brief Writeback and invalidate a range of L1 dcache and L2 + * + * @param ptr The pointer + * @param[in] len The length + * + * @return Zero on success + */ +int sceKernelCpuDcacheAndL2InvalidateRange(void *ptr, size_t len); + +/** + * @brief Writeback and invalidate a range of L1 dcache and L2 + * + * @param ptr The pointer + * @param[in] len The length + * + * @return Zero on success + */ +int sceKernelCpuDcacheAndL2WritebackInvalidateRange(void *ptr, size_t len); /** - * @brief Flush L1 icache and L2 + * @brief Invalidate a range of L1 icache (without L2) * * @param ptr The pointer * @param[in] len The length * * @return Zero on success */ -int sceKernelCpuIcacheAndL2Flush(void *ptr, size_t len); +int sceKernelCpuIcacheInvalidateRange(void *ptr, size_t len); + +/** + * @brief Invalidate all the L1 icache (without L2) + * + * @return Zero on success + */ +int sceKernelCpuIcacheInvalidateAll(void); /** - * @brief Flush L1 dcache and L2 for DMA operations + * @brief Writeback and invalidate a range of L1 icache and L2 * * @param ptr The pointer * @param[in] len The length * * @return Zero on success */ -int sceKernelCpuDcacheAndL2AndDMAFlush(void *ptr, size_t len); +int sceKernelCpuIcacheAndL2WritebackInvalidateRange(void *ptr, size_t len); /** * @brief MMU permission bypassing memcpy diff --git a/include/kernel/kernel/intrmgr.h b/include/kernel/kernel/intrmgr.h new file mode 100644 index 0000000..ca11136 --- /dev/null +++ b/include/kernel/kernel/intrmgr.h @@ -0,0 +1,60 @@ +#ifndef _PSP2_KERNEL_INTRMGR_H_ +#define _PSP2_KERNEL_INTRMGR_H_ + +#include <psp2kern/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef int (*SceKernelIntrOptParam2Callback)(int intr_code, int subintr_code); + +typedef struct SceKernelIntrOptParam2 { + uint32_t size; // 0x28 + uint32_t unk_4; + uint32_t unk_8; + uint32_t unk_C; + SceKernelIntrOptParam2Callback *fptr0; // function pointer + SceKernelIntrOptParam2Callback *enable_subinterrupt_cb; + SceKernelIntrOptParam2Callback *fptr2; // function pointer + uint32_t unk_1C; + uint32_t unk_20; + uint32_t unk_24; +} SceKernelIntrOptParam2; + +typedef struct SceKernelIntrOptParam { + uint32_t size; // 0x14 + uint32_t num; + SceKernelIntrOptParam2 *opt2; + uint32_t unk_C; + uint32_t unk_10; +} SceKernelIntrOptParam; + +typedef int (*SceKernelIntrHandler)(int unk, void *userCtx); +typedef int (*SceKernelSubIntrHandler)(void *arg, int unk0, int unk1); + +int sceKernelRegisterIntrHandler(int intr_code, const char *name, int interrupt_type, + SceKernelIntrHandler *handler, void *userCtx, int priority, int targetcpu, SceKernelIntrOptParam *opt); +int sceKernelReleaseIntrHandler(int intr_code); +int sceKernelMaskIntr(int intr_code); +int sceKernelUnmaskIntr(int intr_code); +int sceKernelSetIntrMasked(int intr_code, int masked); +int sceKernelGetIntrMasked(int intr_code, int *masked); +int sceKernelIsIntrPending(int intr_code); +int sceKernelClearIntrPending(int intr_code); +int sceKernelSetIntrPriority(int intr_code, unsigned char priority); +int sceKernelSetIntrTarget(int intr_code, int cpu_target_list); +int sceKernelTriggerSGI(int intr_code, unsigned int target_list_filter, unsigned int cpu_target_list); +int sceKernelIsIntrAllowedInCurrentContext(int intr_code); +int sceKernelRegisterSubIntrHandler(int intr_code, int subintr_code, const char *name, + SceKernelSubIntrHandler handler, void *register_arg); +int sceKernelTriggerSubIntr(int intr_code, int subintr_code, void *subintr_arg); +int sceKernelEnableSubIntr(int intr_code, int subintr_code); +int sceKernelDisableSubIntr(int intr_code, int subintr_code); + +#ifdef __cplusplus +} +#endif + +#endif /* _PSP2_KERNEL_INTRMGR_H_ */ + diff --git a/include/kernel/kernel/threadmgr.h b/include/kernel/kernel/threadmgr.h index 16b3234..21ee730 100644 --- a/include/kernel/kernel/threadmgr.h +++ b/include/kernel/kernel/threadmgr.h @@ -992,7 +992,6 @@ typedef enum SceKernelIdListType { SceKernelIdListType sceKernelGetThreadmgrUIDClass(SceUID uid); - typedef struct SceKernelLwMutexWork { SceInt64 data[4]; } SceKernelLwMutexWork; @@ -1020,7 +1019,6 @@ int sceKernelSignalLwCond(SceKernelLwCondWork *pWork); int sceKernelWaitLwCond(SceKernelLwCondWork *pWork, unsigned int *pTimeout); - /** * Get the system time (wide version) * diff --git a/include/kernel/udcd.h b/include/kernel/udcd.h index c4991c2..3eaabfb 100644 --- a/include/kernel/udcd.h +++ b/include/kernel/udcd.h @@ -514,7 +514,6 @@ int sceUdcdWaitState(unsigned int state, unsigned int waitMode, SceUInt *timeout int sceUdcdWaitCancel(void); - /** * Register a USB driver. * diff --git a/include/kernel/usbd.h b/include/kernel/usbd.h new file mode 100644 index 0000000..8e19375 --- /dev/null +++ b/include/kernel/usbd.h @@ -0,0 +1,63 @@ +#ifndef _PSP2_KERNEL_USBD_H_ +#define _PSP2_KERNEL_USBD_H_ + +#include <psp2kern/kernel/threadmgr.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define SCE_USBD_ERROR_ACCESS 0x80240003 +#define SCE_USBD_ERROR_BUSY 0x80240006 +#define SCE_USBD_ERROR_FATAL 0x802400ff +#define SCE_USBD_ERROR_INTERRUPTED 0x8024000a +#define SCE_USBD_ERROR_INVALID_ARG 0x80240002 +#define SCE_USBD_ERROR_IO 0x80240001 +#define SCE_USBD_ERROR_NO_DEVICE 0x80240004 +#define SCE_USBD_ERROR_NO_MEM 0x8024000b +#define SCE_USBD_ERROR_NOT_FOUND 0x80240005 +#define SCE_USBD_ERROR_NOT_SUPPORTED 0x8024000c +#define SCE_USBD_ERROR_OVERFLOW 0x80240008 +#define SCE_USBD_ERROR_PIPE 0x80240009 +#define SCE_USBD_ERROR_TIMEOUT 0x80240007 + +typedef struct SceUsbdDeviceDescriptor { + unsigned char bLength; + unsigned char bDescriptorType; + unsigned short bcdUSB; + unsigned char bDeviceClass; + unsigned char bDeviceSubClass; + unsigned char bDeviceProtocol; + unsigned char bMaxPacketSize0; + unsigned short idVendor; + unsigned short idProduct; + unsigned short bcdDevice; + unsigned char iManufacturer; + unsigned char iProduct; + unsigned char iSerialNumber; + unsigned char bNumConfigurations; +} SceUsbdDeviceDescriptor; /* size = 20 */ + +typedef struct SceUsbdDeviceAddress { + unsigned int unk0; + unsigned short unk1; +} SceUsbdDeviceAddress; /* size = 0x6 */ + +typedef struct SceUsbdDriver { + const char *name; + int (*probe)(int device_id); + int (*attach)(int device_id); + int (*detach)(int device_id); + struct SceUsbdDriver *next; +} SceUsbdDriver; /* size = 0x14 */ + +int sceUsbdRegisterDriver(const SceUsbdDriver *driver); +int sceUsbdRegisterCompositeLdd(const SceUsbdDriver *driver); +int sceUsbdUnregisterDriver(const SceUsbdDriver *driver); +void *sceUsbdGetDescriptor(int device_id, int index, unsigned char bDescriptorType); + +#ifdef __cplusplus +} +#endif + +#endif /* _PSP2_KERNEL_USBD_H_ */ diff --git a/include/user/appmgr.h b/include/user/appmgr.h index f93e608..8a4a9d7 100644 --- a/include/user/appmgr.h +++ b/include/user/appmgr.h @@ -60,6 +60,9 @@ typedef struct SceAppMgrLaunchAppOptParam SceAppMgrLaunchAppOptParam; // Missing #define SCE_APPMGR_MAX_APP_NAME_LENGTH (31) +//! Destroy all other apps +int sceAppMgrDestroyOtherApp(void); + //! name: The Title ID of the application int sceAppMgrDestroyAppByName(char *name); diff --git a/include/user/kernel/threadmgr.h b/include/user/kernel/threadmgr.h index e8376d0..3681c19 100644 --- a/include/user/kernel/threadmgr.h +++ b/include/user/kernel/threadmgr.h @@ -1099,7 +1099,6 @@ typedef enum SceKernelIdListType { SceKernelIdListType sceKernelGetThreadmgrUIDClass(SceUID uid); - typedef struct SceKernelLwMutexWork { SceInt64 data[4]; } SceKernelLwMutexWork; @@ -1127,7 +1126,6 @@ int sceKernelSignalLwCond(SceKernelLwCondWork *pWork); int sceKernelWaitLwCond(SceKernelLwCondWork *pWork, unsigned int *pTimeout); - /** * Get the system time (wide version) * diff --git a/include/user/power.h b/include/user/power.h index 75f1673..8eadf1a 100644 --- a/include/user/power.h +++ b/include/user/power.h @@ -148,6 +148,13 @@ int scePowerRequestStandby(void); int scePowerRequestSuspend(void); /** + * Request display off + * + * @return always 0 + */ +int scePowerRequestDisplayOff(void); + +/** * Sets CPU clock frequency * * @param freq - Frequency to set in Mhz diff --git a/include/user/usbd.h b/include/user/usbd.h new file mode 100644 index 0000000..2399abe --- /dev/null +++ b/include/user/usbd.h @@ -0,0 +1,87 @@ +#ifndef _PSP2_USBD_H_ +#define _PSP2_USBD_H_ + +#include <psp2/kernel/threadmgr.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define SCE_USBD_ERROR_ACCESS 0x80240003 +#define SCE_USBD_ERROR_BUSY 0x80240006 +#define SCE_USBD_ERROR_FATAL 0x802400ff +#define SCE_USBD_ERROR_INTERRUPTED 0x8024000a +#define SCE_USBD_ERROR_INVALID_ARG 0x80240002 +#define SCE_USBD_ERROR_IO 0x80240001 +#define SCE_USBD_ERROR_NO_DEVICE 0x80240004 +#define SCE_USBD_ERROR_NO_MEM 0x8024000b +#define SCE_USBD_ERROR_NOT_FOUND 0x80240005 +#define SCE_USBD_ERROR_NOT_SUPPORTED 0x8024000c +#define SCE_USBD_ERROR_OVERFLOW 0x80240008 +#define SCE_USBD_ERROR_PIPE 0x80240009 +#define SCE_USBD_ERROR_TIMEOUT 0x80240007 + +typedef struct SceUsbdDeviceInfo { + unsigned int unk0; + unsigned int device_id; + unsigned int unk2; +} SceUsbdDeviceInfo; /* size = 0xC */ + +typedef struct SceUsbdDeviceAddress { + unsigned int unk0; + unsigned short unk1; +} SceUsbdDeviceAddress; /* size = 0x6 */ + +typedef struct SceUsbdTransferData { + unsigned int pipe; + const void *buff1; + unsigned int size1; + void *buff2; + unsigned int size2; +} SceUsbdTransferData; /* size = 0x14 */ + +typedef struct SceUsbdReceiveEvent { + unsigned int unk0; + unsigned int unk1; + unsigned int unk2; + unsigned int unk3; + unsigned int unk4; + unsigned int unk5; + unsigned int transfer_id; +} SceUsbdReceiveEvent; /* size = 0x1C */ + +int sceUsbdInit(SceUID *uid); +int sceUsbdEnd(SceUID uid); + +int sceUsbdRegisterCallback(SceUID cbid, int); +int sceUsbdUnregisterCallback(SceUID cbid); + +int sceUsbdResetDevice(SceUID uid, unsigned int device_id); +int sceUsbdAttach(SceUID uid, int, int, int); + +int sceUsbdGetDeviceList(SceUID uid, unsigned int num, SceUsbdDeviceInfo *info); +int sceUsbdGetDescriptor(SceUID uid, unsigned int device_id, unsigned char *descriptor, unsigned int size); +int sceUsbdGetDescriptorSize(SceUID uid, unsigned int device_id); +int sceUsbdGetDeviceAddress(SceUID uid, unsigned int device_id, SceUsbdDeviceAddress *addr); +int sceUsbdGetDeviceSpeed(SceUID uid, unsigned int device_id, unsigned int *speed); +int sceUsbdGetTransferStatus(SceUID uid, unsigned char buff[0x10]); +int sceUsbdGetIsochTransferStatus(SceUID uid, unsigned char buff[0x10]); + +int sceUsbdOpenDefaultPipe(SceUID uid, unsigned int device_id); +int sceUsbdOpenPipe(SceUID uid, unsigned char unk[0x18]); +int sceUsbdClosePipe(SceUID uid, unsigned int device_id); + +int sceUsbdTransferData(SceUID uid, SceUsbdTransferData *data); +int sceUsbdIsochTransferData(SceUID uid, int unk, unsigned char buff[0x28]); +int sceUsbdReceiveEvent(SceUID uid, SceUsbdReceiveEvent *event); + +int sceUsbdRegisterLdd(SceUID uid, const char str[0x100]); +int sceUsbdUnregisterLdd(SceUID uid, const char str[0x100]); +int sceUsbdRegisterCompositeLdd(SceUID uid, const char str[0x100]); +int sceUsbdAttachCompositeLdd(SceUID, unsigned char unk[0x14]); + +#ifdef __cplusplus +} +#endif + +#endif /* _PSP2_USBD_H_ */ |