mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-30 21:30:04 +00:00 
			
		
		
		
	AudioCore: Refactor DSP interrupt handling (#7026)
This commit is contained in:
		
							parent
							
								
									0ce956ba00
								
							
						
					
					
						commit
						72ff0c5337
					
				
					 9 changed files with 61 additions and 97 deletions
				
			
		|  | @ -25,7 +25,7 @@ TEST_CASE("DSP LLE vs HLE", "[audio_core][hle]") { | |||
|     AudioCore::DspHle hle(hle_memory, hle_core_timing); | ||||
|     AudioCore::DspLle lle(lle_memory, lle_core_timing, true); | ||||
| 
 | ||||
|     // Initialiase LLE
 | ||||
|     // Initialise LLE
 | ||||
|     { | ||||
|         FileUtil::SetUserPath(); | ||||
|         // see tests/audio_core/lle/lle.cpp for details on dspaudio.cdc
 | ||||
|  | @ -41,25 +41,15 @@ TEST_CASE("DSP LLE vs HLE", "[audio_core][hle]") { | |||
|         std::vector<u8> firm_file_buf(firm_file.GetSize()); | ||||
|         firm_file.ReadArray(firm_file_buf.data(), firm_file_buf.size()); | ||||
|         lle.LoadComponent(firm_file_buf); | ||||
|         lle.SetSemaphoreHandler([&lle]() { | ||||
|             u16 slot = lle.RecvData(2); | ||||
|             u16 side = slot % 2; | ||||
|             u16 pipe = slot / 2; | ||||
|             fmt::print("SetSemaphoreHandler slot={}\n", slot); | ||||
|             if (pipe > 15) | ||||
|                 return; | ||||
|             if (side != 0) | ||||
|                 return; | ||||
|             if (pipe == 0) { | ||||
|                 // pipe 0 is for debug. 3DS automatically drains this pipe and discards the
 | ||||
|                 // data
 | ||||
|                 lle.PipeRead(static_cast<AudioCore::DspPipe>(pipe), | ||||
|                              lle.GetPipeReadableSize(static_cast<AudioCore::DspPipe>(pipe))); | ||||
|             } | ||||
|         lle.SetInterruptHandler([](Service::DSP::InterruptType type, AudioCore::DspPipe pipe) { | ||||
|             fmt::print("LLE SetInterruptHandler type={} pipe={}\n", type, pipe); | ||||
|         }); | ||||
|     } | ||||
|     // Initialise HLE
 | ||||
|     { | ||||
|         hle.SetInterruptHandler([](Service::DSP::InterruptType type, AudioCore::DspPipe pipe) { | ||||
|             fmt::print("HLE SetInterruptHandler type={} pipe={}\n", type, pipe); | ||||
|         }); | ||||
|         lle.SetRecvDataHandler(0, []() { fmt::print("SetRecvDataHandler 0\n"); }); | ||||
|         lle.SetRecvDataHandler(1, []() { fmt::print("SetRecvDataHandler 1\n"); }); | ||||
|         lle.SetRecvDataHandler(2, []() { fmt::print("SetRecvDataHandler 2\n"); }); | ||||
|     } | ||||
| 
 | ||||
|     SECTION("Initialise Audio Pipe") { | ||||
|  |  | |||
|  | @ -37,26 +37,11 @@ TEST_CASE("DSP LLE Sanity", "[audio_core][lle]") { | |||
|         std::vector<u8> firm_file_buf(firm_file.GetSize()); | ||||
|         firm_file.ReadArray(firm_file_buf.data(), firm_file_buf.size()); | ||||
|         lle.LoadComponent(firm_file_buf); | ||||
| 
 | ||||
|         lle.SetInterruptHandler([](Service::DSP::InterruptType type, AudioCore::DspPipe pipe) { | ||||
|             fmt::print("SetInterruptHandler type={} pipe={}\n", type, pipe); | ||||
|         }); | ||||
|     } | ||||
|     lle.SetSemaphoreHandler([&lle]() { | ||||
|         u16 slot = lle.RecvData(2); | ||||
|         u16 side = slot % 2; | ||||
|         u16 pipe = slot / 2; | ||||
|         fmt::print("SetSemaphoreHandler slot={}\n", slot); | ||||
|         if (pipe > 15) | ||||
|             return; | ||||
|         if (side != 0) | ||||
|             return; | ||||
|         if (pipe == 0) { | ||||
|             // pipe 0 is for debug. 3DS automatically drains this pipe and discards the
 | ||||
|             // data
 | ||||
|             lle.PipeRead(static_cast<AudioCore::DspPipe>(pipe), | ||||
|                          lle.GetPipeReadableSize(static_cast<AudioCore::DspPipe>(pipe))); | ||||
|         } | ||||
|     }); | ||||
|     lle.SetRecvDataHandler(0, []() { fmt::print("SetRecvDataHandler 0\n"); }); | ||||
|     lle.SetRecvDataHandler(1, []() { fmt::print("SetRecvDataHandler 1\n"); }); | ||||
|     lle.SetRecvDataHandler(2, []() { fmt::print("SetRecvDataHandler 2\n"); }); | ||||
|     SECTION("Initialise Audio Pipe") { | ||||
|         std::vector<u8> buffer(4, 0); | ||||
|         buffer[0] = 0; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue