Skip to content

Commit bd7e850

Browse files
committed
refactor: Move SceKernelThreadEntry to psptypes.h
Avoids type definition conflicts.
1 parent c4df373 commit bd7e850

File tree

3 files changed

+34
-37
lines changed

3 files changed

+34
-37
lines changed

src/base/psptypes.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,9 @@ typedef struct ScePspDateTime {
427427
unsigned int microsecond;
428428
} ScePspDateTime;
429429

430+
/* Thread entry function type. */
431+
typedef int (*SceKernelThreadEntry)(SceSize args, void *argp);
432+
430433
#ifdef __cplusplus
431434
}
432435
#endif

src/kernel/psploadcore.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ extern "C" {
2626
/** @addtogroup LoadCore Interface to the LoadCoreForKernel library. */
2727
/**@{*/
2828

29-
#ifndef __THREADMAN_H__
30-
typedef int (*SceKernelThreadEntry)(SceSize args, void *argp);
31-
#endif
32-
3329

3430
/** Reboot preparation functions */
3531
typedef s32 (*SceKernelRebootBeforeForKernel)(void *arg1, s32 arg2, s32 arg3, s32 arg4);

src/user/pspthreadman.h

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ enum PspThreadAttributes
4646
{
4747
/** Enable VFPU access for the thread. */
4848
PSP_THREAD_ATTR_VFPU = 0x00004000,
49-
/** Start the thread in user mode (done automatically
49+
/** Start the thread in user mode (done automatically
5050
if the thread creating it is in user mode). */
5151
PSP_THREAD_ATTR_USER = 0x80000000,
5252
/** Thread is part of the USB/WLAN API. */
@@ -68,8 +68,6 @@ enum PspThreadAttributes
6868

6969
/* Threads. */
7070

71-
typedef int (*SceKernelThreadEntry)(SceSize args, void *argp);
72-
7371
/** Additional options used when creating threads. */
7472
typedef struct SceKernelThreadOptParam {
7573
/** Size of the ::SceKernelThreadOptParam structure. */
@@ -193,7 +191,7 @@ int sceKernelStartThread(SceUID thid, SceSize arglen, void *argp);
193191
*/
194192
int sceKernelExitThread(int status);
195193

196-
/**
194+
/**
197195
* Exit a thread and delete itself.
198196
*
199197
* @param status - Exit status
@@ -228,7 +226,7 @@ int sceKernelSuspendDispatchThread(void);
228226
/**
229227
* Resume the dispatch thread
230228
*
231-
* @param state - The state of the dispatch thread
229+
* @param state - The state of the dispatch thread
232230
* (from ::sceKernelSuspendDispatchThread)
233231
*
234232
* @return 0 on success, < 0 on error
@@ -289,7 +287,7 @@ int sceKernelSuspendThread(SceUID thid);
289287
*/
290288
int sceKernelResumeThread(SceUID thid);
291289

292-
/**
290+
/**
293291
* Wait until a thread has ended.
294292
*
295293
* @param thid - Id of the thread to wait for.
@@ -299,7 +297,7 @@ int sceKernelResumeThread(SceUID thid);
299297
*/
300298
int sceKernelWaitThreadEnd(SceUID thid, SceUInt *timeout);
301299

302-
/**
300+
/**
303301
* Wait until a thread has ended and handle callbacks if necessary.
304302
*
305303
* @param thid - Id of the thread to wait for.
@@ -364,7 +362,7 @@ int sceKernelChangeCurrentThreadAttr(int unknown, SceUInt attr);
364362

365363
/**
366364
* Change the threads current priority.
367-
*
365+
*
368366
* @param thid - The ID of the thread (from sceKernelCreateThread or sceKernelGetThreadId)
369367
* @param priority - The new priority (the lower the number the higher the priority)
370368
*
@@ -383,7 +381,7 @@ int sceKernelChangeThreadPriority(SceUID thid, int priority);
383381
* Rotate thread ready queue at a set priority
384382
*
385383
* @param priority - The priority of the queue
386-
*
384+
*
387385
* @return 0 on success, < 0 on error.
388386
*/
389387
int sceKernelRotateThreadReadyQueue(int priority);
@@ -397,7 +395,7 @@ int sceKernelRotateThreadReadyQueue(int priority);
397395
*/
398396
int sceKernelReleaseWaitThread(SceUID thid);
399397

400-
/**
398+
/**
401399
* Get the current thread Id
402400
*
403401
* @return The thread id of the calling thread.
@@ -437,9 +435,9 @@ int sceKernelCheckThreadStack(void);
437435
*/
438436
int sceKernelGetThreadStackFreeSize(SceUID thid);
439437

440-
/**
438+
/**
441439
* Get the status information for the specified thread.
442-
*
440+
*
443441
* @param thid - Id of the thread to get status
444442
* @param info - Pointer to the info structure to receive the data.
445443
* Note: The structures size field should be set to
@@ -451,7 +449,7 @@ int sceKernelGetThreadStackFreeSize(SceUID thid);
451449
* status.size = sizeof(SceKernelThreadInfo);
452450
* if(sceKernelReferThreadStatus(thid, &status) == 0)
453451
* { Do something... }
454-
* @endcode
452+
* @endcode
455453
* @return 0 if successful, otherwise the error code.
456454
*/
457455
int sceKernelReferThreadStatus(SceUID thid, SceKernelThreadInfo *info);
@@ -506,7 +504,7 @@ typedef struct SceKernelSemaInfo {
506504
*
507505
* @param name - Specifies the name of the sema
508506
* @param attr - Sema attribute flags (normally set to 0)
509-
* @param initVal - Sema initial value
507+
* @param initVal - Sema initial value
510508
* @param maxVal - Sema maximum value
511509
* @param option - Sema options (normally set to 0)
512510
* @return A semaphore id
@@ -707,7 +705,7 @@ enum PspEventFlagWaitTypes
707705
PSP_EVENT_WAITCLEAR = 0x20
708706
};
709707

710-
/**
708+
/**
711709
* Create an event flag.
712710
*
713711
* @param name - The name of the event flag.
@@ -724,7 +722,7 @@ enum PspEventFlagWaitTypes
724722
*/
725723
SceUID sceKernelCreateEventFlag(const char *name, int attr, int bits, SceKernelEventFlagOptParam *opt);
726724

727-
/**
725+
/**
728726
* Set an event flag bit pattern.
729727
*
730728
* @param evid - The event id returned by sceKernelCreateEventFlag.
@@ -744,7 +742,7 @@ int sceKernelSetEventFlag(SceUID evid, u32 bits);
744742
*/
745743
int sceKernelClearEventFlag(SceUID evid, u32 bits);
746744

747-
/**
745+
/**
748746
* Poll an event flag for a given bit pattern.
749747
*
750748
* @param evid - The event id returned by sceKernelCreateEventFlag.
@@ -755,7 +753,7 @@ int sceKernelClearEventFlag(SceUID evid, u32 bits);
755753
*/
756754
int sceKernelPollEventFlag(int evid, u32 bits, u32 wait, u32 *outBits);
757755

758-
/**
756+
/**
759757
* Wait for an event flag for a given bit pattern.
760758
*
761759
* @param evid - The event id returned by sceKernelCreateEventFlag.
@@ -767,7 +765,7 @@ int sceKernelPollEventFlag(int evid, u32 bits, u32 wait, u32 *outBits);
767765
*/
768766
int sceKernelWaitEventFlag(int evid, u32 bits, u32 wait, u32 *outBits, SceUInt *timeout);
769767

770-
/**
768+
/**
771769
* Wait for an event flag for a given bit pattern with callback.
772770
*
773771
* @param evid - The event id returned by sceKernelCreateEventFlag.
@@ -779,7 +777,7 @@ int sceKernelWaitEventFlag(int evid, u32 bits, u32 wait, u32 *outBits, SceUInt *
779777
*/
780778
int sceKernelWaitEventFlagCB(int evid, u32 bits, u32 wait, u32 *outBits, SceUInt *timeout);
781779

782-
/**
780+
/**
783781
* Delete an event flag
784782
*
785783
* @param evid - The event id returned by sceKernelCreateEventFlag.
@@ -788,9 +786,9 @@ int sceKernelWaitEventFlagCB(int evid, u32 bits, u32 wait, u32 *outBits, SceUInt
788786
*/
789787
int sceKernelDeleteEventFlag(int evid);
790788

791-
/**
789+
/**
792790
* Get the status of an event flag.
793-
*
791+
*
794792
* @param event - The UID of the event.
795793
* @param status - A pointer to a ::SceKernelEventFlagInfo structure.
796794
*
@@ -878,7 +876,7 @@ int sceKernelDeleteMbx(SceUID mbxid);
878876
*
879877
* @param mbxid - The mbx id returned from sceKernelCreateMbx
880878
* @param message - A message to be forwarded to the receiver.
881-
* The start of the message should be the
879+
* The start of the message should be the
882880
* ::SceKernelMsgPacket structure, the rest
883881
*
884882
* @return < 0 On error.
@@ -984,7 +982,7 @@ typedef struct SceKernelAlarmInfo {
984982
void * common;
985983
} SceKernelAlarmInfo;
986984

987-
/**
985+
/**
988986
* Set an alarm.
989987
* @param clock - The number of micro seconds till the alarm occurrs.
990988
* @param handler - Pointer to a ::SceKernelAlarmHandler
@@ -996,11 +994,11 @@ SceUID sceKernelSetAlarm(SceUInt clock, SceKernelAlarmHandler handler, void *com
996994

997995
/**
998996
* Set an alarm using a ::SceKernelSysClock structure for the time
999-
*
997+
*
1000998
* @param clock - Pointer to a ::SceKernelSysClock structure
1001999
* @param handler - Pointer to a ::SceKernelAlarmHandler
10021000
* @param common - Common pointer for the alarm handler.
1003-
*
1001+
*
10041002
* @return A UID representing the created alarm, < 0 on error.
10051003
*/
10061004
SceUID sceKernelSetSysClockAlarm(SceKernelSysClock *clock, SceKernelAlarmHandler handler, void *common);
@@ -1142,7 +1140,7 @@ enum SceKernelIdListType
11421140
};
11431141

11441142
/**
1145-
* Get a list of UIDs from threadman. Allows you to enumerate
1143+
* Get a list of UIDs from threadman. Allows you to enumerate
11461144
* resources such as threads or semaphores.
11471145
*
11481146
* @param type - The type of resource to list, one of ::SceKernelIdListType.
@@ -1305,7 +1303,7 @@ typedef struct SceKernelMppInfo {
13051303
int numSendWaitThreads;
13061304
int numReceiveWaitThreads;
13071305
} SceKernelMppInfo;
1308-
1306+
13091307
/**
13101308
* Get the status of a Message Pipe
13111309
*
@@ -1369,7 +1367,7 @@ int sceKernelAllocateVpl(SceUID uid, unsigned int size, void **data, unsigned in
13691367
int sceKernelAllocateVplCB(SceUID uid, unsigned int size, void **data, unsigned int *timeout);
13701368

13711369
/**
1372-
* Try to allocate from the pool
1370+
* Try to allocate from the pool
13731371
*
13741372
* @param uid - The UID of the pool
13751373
* @param size - The size to allocate
@@ -1471,7 +1469,7 @@ int sceKernelAllocateFpl(SceUID uid, void **data, unsigned int *timeout);
14711469
int sceKernelAllocateFplCB(SceUID uid, void **data, unsigned int *timeout);
14721470

14731471
/**
1474-
* Try to allocate from the pool
1472+
* Try to allocate from the pool
14751473
*
14761474
* @param uid - The UID of the pool
14771475
* @param data - Receives the address of the allocated data
@@ -1527,7 +1525,7 @@ int sceKernelReferFplStatus(SceUID uid, SceKernelFplInfo *info);
15271525
void _sceKernelReturnFromTimerHandler(void);
15281526

15291527
/**
1530-
* Return from a callback (used as a syscall for the return
1528+
* Return from a callback (used as a syscall for the return
15311529
* of the callback function)
15321530
*/
15331531
void _sceKernelReturnFromCallback(void);
@@ -1544,7 +1542,7 @@ int sceKernelUSec2SysClock(unsigned int usec, SceKernelSysClock *clock);
15441542

15451543
/**
15461544
* Convert a number of microseconds to a wide time
1547-
*
1545+
*
15481546
* @param usec - Number of microseconds.
15491547
*
15501548
* @return The time
@@ -1762,7 +1760,7 @@ void _sceKernelExitThread(void);
17621760
* Get the type of a threadman uid
17631761
*
17641762
* @param uid - The uid to get the type from
1765-
*
1763+
*
17661764
* @return The type, < 0 on error
17671765
*/
17681766
enum SceKernelIdListType sceKernelGetThreadmanIdType(SceUID uid);

0 commit comments

Comments
 (0)