From 7e588eee7e612e3726997f3df36f13b36e24bb35 Mon Sep 17 00:00:00 2001 From: Arthur Blot Date: Sun, 22 Jan 2012 18:49:48 +0100 Subject: [PATCH] Fixed/clarified/completed sceGe_user --- src/ge/Makefile.am | 2 +- src/ge/pspge.h | 91 ++++++++++++++++++++++++++++++--------------- src/ge/sceGe_user.S | 25 +++++++------ 3 files changed, 75 insertions(+), 43 deletions(-) diff --git a/src/ge/Makefile.am b/src/ge/Makefile.am index 3910965d..0c5ca5b5 100644 --- a/src/ge/Makefile.am +++ b/src/ge/Makefile.am @@ -10,7 +10,7 @@ INCLUDES = -I$(top_srcdir)/src/base -I$(top_srcdir)/src/kernel CFLAGS = @PSPSDK_CFLAGS@ CCASFLAGS = $(CFLAGS) -I$(top_srcdir)/src/base -I$(top_srcdir)/src/kernel -GE_OBJS = sceGe_user_0000.o sceGe_user_0001.o sceGe_user_0002.o sceGe_user_0003.o sceGe_user_0004.o sceGe_user_0005.o sceGe_user_0006.o sceGe_user_0007.o sceGe_user_0008.o sceGe_user_0009.o sceGe_user_0010.o sceGe_user_0011.o sceGe_user_0012.o sceGe_user_0013.o sceGe_user_0014.o sceGe_user_0015.o sceGe_user_0016.o sceGe_user_0017.o +GE_OBJS = sceGe_user_0000.o sceGe_user_0001.o sceGe_user_0002.o sceGe_user_0003.o sceGe_user_0004.o sceGe_user_0005.o sceGe_user_0006.o sceGe_user_0007.o sceGe_user_0008.o sceGe_user_0009.o sceGe_user_0010.o sceGe_user_0011.o sceGe_user_0012.o sceGe_user_0013.o sceGe_user_0014.o sceGe_user_0015.o sceGe_user_0016.o sceGe_user_0017.o sceGe_user_0018.o GEDRIVER_OBJS = sceGe_driver_0000.o sceGe_driver_0001.o sceGe_driver_0002.o sceGe_driver_0003.o sceGe_driver_0004.o sceGe_driver_0005.o sceGe_driver_0006.o sceGe_driver_0007.o sceGe_driver_0008.o sceGe_driver_0009.o sceGe_driver_0010.o sceGe_driver_0011.o sceGe_driver_0012.o sceGe_driver_0013.o sceGe_driver_0014.o sceGe_driver_0015.o sceGe_driver_0016.o sceGe_driver_0017.o sceGe_driver_0018.o sceGe_driver_0019.o sceGe_driver_0020.o sceGe_driver_0021.o sceGe_driver_0022.o sceGe_driver_0023.o diff --git a/src/ge/pspge.h b/src/ge/pspge.h index a9cb69be..50b3db01 100644 --- a/src/ge/pspge.h +++ b/src/ge/pspge.h @@ -60,18 +60,18 @@ typedef struct PspGeBreakParam { unsigned int sceGeEdramGetSize(void); /** - * Get the address of VRAM. + * Get the eDRAM address. * - * @return A pointer to the base of VRAM. + * @return A pointer to the base of the eDRAM. */ void * sceGeEdramGetAddr(void); /** - * Retrive the current value of a GE command. + * Retrieve the current value of a GE command. * - * @param cmd - The GE command register to retrieve. + * @param cmd - The GE command register to retrieve (0 to 0xFF, both included). * - * @return The value of the GE command. + * @return The value of the GE command, < 0 on error. */ unsigned int sceGeGetCmd(int cmd); @@ -101,16 +101,33 @@ typedef enum PspGeMatrixTypes { * @param type - One of ::PspGeMatrixTypes. * @param matrix - Pointer to a variable to store the matrix. * - * @return ??? + * @return < 0 on error. */ int sceGeGetMtx(int type, void *matrix); +/** Structure storing a stack (for CALL/RET). */ +typedef struct +{ + /** The stack buffer. */ + unsigned int stack[8]; +} PspGeStack; + +/** + * Retrieve the stack of the display list currently being executed. + * + * @param stackId - The ID of the stack to retrieve. + * @param stack - Pointer to a structure to store the stack, or NULL to not store it. + * + * @return The number of stacks of the current display list, < 0 on error. + */ +int sceGeGetStack(int stackId, PspGeStack *stack); + /** * Save the GE's current state. * * @param context - Pointer to a ::PspGeContext. * - * @return ??? + * @return < 0 on error. */ int sceGeSaveContext(PspGeContext *context); @@ -119,7 +136,7 @@ int sceGeSaveContext(PspGeContext *context); * * @param context - Pointer to a ::PspGeContext. * - * @return ??? + * @return < 0 on error. */ int sceGeRestoreContext(const PspGeContext *context); @@ -128,11 +145,11 @@ int sceGeRestoreContext(const PspGeContext *context); * * @param list - The head of the list to queue. * @param stall - The stall address. - * If NULL then no stall address set and the list is transferred immediately. + * If NULL then no stall address is set and the list is transferred immediately. * @param cbid - ID of the callback set by calling sceGeSetCallback * @param arg - Structure containing GE context buffer address * - * @return The ID of the queue. + * @return The ID of the queue, < 0 on error. */ int sceGeListEnQueue(const void *list, void *stall, int cbid, PspGeListArgs *arg); @@ -141,11 +158,11 @@ int sceGeListEnQueue(const void *list, void *stall, int cbid, PspGeListArgs *arg * * @param list - The head of the list to queue. * @param stall - The stall address. - * If NULL then no stall address set and the list is transferred immediately. + * If NULL then no stall address is set and the list is transferred immediately. * @param cbid - ID of the callback set by calling sceGeSetCallback * @param arg - Structure containing GE context buffer address * - * @return The ID of the queue. + * @return The ID of the queue, < 0 on error. */ int sceGeListEnQueueHead(const void *list, void *stall, int cbid, PspGeListArgs *arg); @@ -154,7 +171,7 @@ int sceGeListEnQueueHead(const void *list, void *stall, int cbid, PspGeListArgs * * @param qid - The ID of the queue. * - * @return ??? + * @return < 0 on error. */ int sceGeListDeQueue(int qid); @@ -162,73 +179,85 @@ int sceGeListDeQueue(int qid); * Update the stall address for the specified queue. * * @param qid - The ID of the queue. - * @param stall - The stall address to update + * @param stall - The new stall address. * - * @return Unknown. Probably 0 if successful. + * @return < 0 on error */ int sceGeListUpdateStallAddr(int qid, void *stall); -/** Wait condition for ::sceGeListSync() and ::sceGeDrawSync(). */ -typedef enum PspGeSyncType { +/** List status for ::sceGeListSync() and ::sceGeDrawSync(). */ +typedef enum PspGeListState { PSP_GE_LIST_DONE = 0, PSP_GE_LIST_QUEUED, PSP_GE_LIST_DRAWING_DONE, PSP_GE_LIST_STALL_REACHED, PSP_GE_LIST_CANCEL_DONE -} PspGeSyncType; +} PspGeListState; /** * Wait for syncronisation of a list. * * @param qid - The queue ID of the list to sync. - * @param syncType - Specifies the condition to wait on. One of ::PspGeSyncType. + * @param syncType - 0 if you want to wait for the list to be completed, or 1 if you just want to peek the actual state. * - * @return ??? + * @return The specified queue status, one of ::PspGeListState. */ int sceGeListSync(int qid, int syncType); /** * Wait for drawing to complete. * - * @param syncType - Specifies the condition to wait on. One of ::PspGeSyncType. + * @param syncType - 0 if you want to wait for the drawing to be completed, or 1 if you just want to peek the state of the display list currently being executed. * - * @return ??? + * @return The current queue status, one of ::PspGeListState. */ int sceGeDrawSync(int syncType); /** - * Register callback handlers for the the Ge + * Register callback handlers for the the GE. * - * @param cb - Configured callback data structure - * @return The callback ID, < 0 on error + * @param cb - Configured callback data structure. + * + * @return The callback ID, < 0 on error. */ int sceGeSetCallback(PspGeCallbackData *cb); /** - * Unregister the callback handlers + * Unregister the callback handlers. + * + * @param cbid - The ID of the callbacks, returned by sceGeSetCallback(). * - * @param cbid - The ID of the callbacks from sceGeSetCallback * @return < 0 on error */ int sceGeUnsetCallback(int cbid); /** - * Interrupt drawing queue + * Interrupt drawing queue. + * + * @param mode - If set to 1, reset all the queues. + * @param pParam - Unused (just K1-checked). + * + * @return The stopped queue ID if mode isn't set to 0, otherwise 0, and < 0 on error. */ int sceGeBreak(int mode, PspGeBreakParam *pParam); /** - * Restart drawing queue + * Restart drawing queue. + * + * @return < 0 on error. */ int sceGeContinue(void); /** - * Set Graphics Engine eDRAM address translation mode + * Set the eDRAM address translation mode. + * + * @param width - 0 to not set the translation width, otherwise 512, 1024, 2048 or 4096. + * + * @return The previous width if it was set, otherwise 0, < 0 on error. */ int sceGeEdramSetAddrTranslation(int width); - #ifdef __cplusplus } #endif diff --git a/src/ge/sceGe_user.S b/src/ge/sceGe_user.S index 8487a460..94e11459 100644 --- a/src/ge/sceGe_user.S +++ b/src/ge/sceGe_user.S @@ -21,38 +21,41 @@ IMPORT_FUNC "sceGe_user",0x57C8945B,sceGeGetMtx #endif #ifdef F_sceGe_user_0006 - IMPORT_FUNC "sceGe_user",0x438A385A,sceGeSaveContext + IMPORT_FUNC "sceGe_user",0xE66CB92E,sceGeGetStack #endif #ifdef F_sceGe_user_0007 - IMPORT_FUNC "sceGe_user",0x0BF608FB,sceGeRestoreContext + IMPORT_FUNC "sceGe_user",0x438A385A,sceGeSaveContext #endif #ifdef F_sceGe_user_0008 - IMPORT_FUNC "sceGe_user",0xAB49E76A,sceGeListEnQueue + IMPORT_FUNC "sceGe_user",0x0BF608FB,sceGeRestoreContext #endif #ifdef F_sceGe_user_0009 - IMPORT_FUNC "sceGe_user",0x1C0D95A6,sceGeListEnQueueHead + IMPORT_FUNC "sceGe_user",0xAB49E76A,sceGeListEnQueue #endif #ifdef F_sceGe_user_0010 - IMPORT_FUNC "sceGe_user",0x5FB86AB0,sceGeListDeQueue + IMPORT_FUNC "sceGe_user",0x1C0D95A6,sceGeListEnQueueHead #endif #ifdef F_sceGe_user_0011 - IMPORT_FUNC "sceGe_user",0xE0D68148,sceGeListUpdateStallAddr + IMPORT_FUNC "sceGe_user",0x5FB86AB0,sceGeListDeQueue #endif #ifdef F_sceGe_user_0012 - IMPORT_FUNC "sceGe_user",0x03444EB4,sceGeListSync + IMPORT_FUNC "sceGe_user",0xE0D68148,sceGeListUpdateStallAddr #endif #ifdef F_sceGe_user_0013 - IMPORT_FUNC "sceGe_user",0xB287BD61,sceGeDrawSync + IMPORT_FUNC "sceGe_user",0x03444EB4,sceGeListSync #endif #ifdef F_sceGe_user_0014 - IMPORT_FUNC "sceGe_user",0xB448EC0D,sceGeBreak + IMPORT_FUNC "sceGe_user",0xB287BD61,sceGeDrawSync #endif #ifdef F_sceGe_user_0015 - IMPORT_FUNC "sceGe_user",0x4C06E472,sceGeContinue + IMPORT_FUNC "sceGe_user",0xB448EC0D,sceGeBreak #endif #ifdef F_sceGe_user_0016 - IMPORT_FUNC "sceGe_user",0xA4FC06A4,sceGeSetCallback + IMPORT_FUNC "sceGe_user",0x4C06E472,sceGeContinue #endif #ifdef F_sceGe_user_0017 + IMPORT_FUNC "sceGe_user",0xA4FC06A4,sceGeSetCallback +#endif +#ifdef F_sceGe_user_0018 IMPORT_FUNC "sceGe_user",0x05DB22CE,sceGeUnsetCallback #endif