mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 09:01:57 -05:00
PS1: Implement more accurate thread sleeping
This commit is contained in:
parent
591e31bea6
commit
df49656b25
2 changed files with 7 additions and 3 deletions
|
@ -24,7 +24,7 @@ enum gp1_cmd_type {
|
|||
GP1_CMD_DMA_MODE = 0x04000000,
|
||||
};
|
||||
|
||||
enum gp1_dma_mode {
|
||||
enum gp1_cmd_dma_mode {
|
||||
GP1_DMA_NONE = 0,
|
||||
GP1_DMA_CPU_TO_GP0 = 2,
|
||||
};
|
||||
|
|
|
@ -160,8 +160,12 @@ cc_result File_Length(cc_file file, cc_uint32* len) {
|
|||
*--------------------------------------------------------Threading--------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
void Thread_Sleep(cc_uint32 milliseconds) {
|
||||
// TODO sleep a bit
|
||||
VSync(0);
|
||||
// Simulate sleep with a busy loop
|
||||
cc_uint64 delay = (cc_uint64)milliseconds * F_CPU / (8 * 1000);
|
||||
cc_uint32 delay_ = (cc_uint32)delay;
|
||||
|
||||
for (cc_uint32 i = 0; i < delay_; i++) { __asm__ volatile(""); }
|
||||
ChangeClearPAD(0);
|
||||
}
|
||||
|
||||
void Thread_Run(void** handle, Thread_StartFunc func, int stackSize, const char* name) {
|
||||
|
|
Loading…
Reference in a new issue