Improve CircularBuffer again

This commit is contained in:
2023-03-03 17:30:45 +01:00
parent 45371bc2f0
commit d8e7772ee5
3 changed files with 58 additions and 57 deletions

View File

@@ -21,18 +21,25 @@ namespace JabyEngine {
void CDFileProcessor :: setup(const volatile AutoLBAEntry* lba, JobArray jobs, uint8_t* work_area) {
this->lba = const_cast<const AutoLBAEntry*>(lba);
this->work_area = (work_area + this->circular_buffer.setup(reinterpret_cast<CD_IO::DataSector*>(work_area)));
this->work_area = reinterpret_cast<uint8_t*>(this->circular_buffer.setup(reinterpret_cast<CD_IO::DataSector*>(work_area), 5));
this->jobs = jobs;
CDFileProcessor::start_cur_job();
}
Progress CDFileProcessor :: process() {
const auto test_print = [this](){
if(this->circular_buffer.has_data()) {
printf("Got-Data: %s\n", this->circular_buffer.get_next());
this->circular_buffer.pop();
}
};
switch(CD::internal::read_current_state()) {
case CD::internal::State::Done:
// Need to start next job?
// Does the user trigger this?
printf("Done: %i\n", this->circular_buffer.has_data());
test_print();
return Progress::Done;
case CD::internal::State::BufferFull:
@@ -42,6 +49,7 @@ namespace JabyEngine {
case CD::internal::State::Reading:
// Do we have data? Use it!
test_print();
return Progress::InProgress;
case CD::internal::State::Error: