Skip to content

Commit

Permalink
volume
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyjer committed Apr 29, 2024
1 parent 1af4c85 commit 71476a1
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@ ${TEST_RAWS} : %.raw : Makefile the_kernel %.data
@echo "*** failed to run, look in $*.failure for more details" > $*.raw
-(${TIME} --quiet -o $*.time -f "%E" ${QEMU_TIMEOUT_CMD} ${QEMU_TIMEOUT} ${QEMU_CMD} ${QEMU_FLAGS} > $*.failure 2>&1); if [ $$? -eq 124 ]; then echo "timeout" > $*.failure; echo "timeout" > $*.time; fi

BLOCK_SIZE = 1024
BLOCK_SIZE = 4096

${TEST_DATA} : %.data : Makefile
@rm -f $*.data
mkfs.ext2 -q -b ${BLOCK_SIZE} -i ${BLOCK_SIZE} -d ${TESTS_DIR}/$*.dir -I 128 -r 0 -t ext2 $*.data 10m
mkfs.ext2 -q -b ${BLOCK_SIZE} -i ${BLOCK_SIZE} -d ${TESTS_DIR}/$*.dir -I 128 -r 0 -t ext2 $*.data 40m

${TEST_OUTS} : %.out : Makefile %.raw
-egrep '^\*\*\*' $*.raw > $*.out 2> /dev/null || true
Expand Down
2 changes: 2 additions & 0 deletions history
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,5 @@ t0 pass 0:02.70 [QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.28)] [g++ (U
t0 pass timeout [QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.28)] [g++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0] [Wed 24 Apr 2024 06:31:43 PM CDT]
t0 pass timeout [QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.28)] [g++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0] [Wed 24 Apr 2024 08:15:45 PM CDT]
t0 pass timeout [QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.28)] [g++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0] [Sat 27 Apr 2024 06:58:20 PM CDT]
t0 pass 0:00.43 [QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.28)] [g++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0] [Sun 28 Apr 2024 11:30:03 PM CDT]
t0 pass timeout [QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.28)] [g++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0] [Mon 29 Apr 2024 12:50:20 AM CDT]
Binary file modified kernel/build/kernel.bin
Binary file not shown.
Binary file modified kernel/build/kernel.img
Binary file not shown.
Binary file modified kernel/build/kernel.kernel
Binary file not shown.
19 changes: 12 additions & 7 deletions kernel/sys.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ int SYS::exec(const char *path,
sp -= 4;
*((uint32_t *)sp) = 0; // nullptr to indicate end of the argv array


for (int i = argc - 1; i >= 0; i--)
{
sp -= 4;
Expand Down Expand Up @@ -378,7 +377,14 @@ extern "C" int sysHandler(uint32_t eax, uint32_t *frame)
return -1;
}

// int num_buffers = wavhdr->data_size / 131070;
Debug::printf("Sample Rate = %d\n", wavhdr->sample_rate);
Debug::printf("Data_size = %d\n", wavhdr->data_size);
Debug::printf("num channels = %d\n", wavhdr->num_channels);


int num_buffers = wavhdr->data_size / 131070;
Debug::printf("buffers neing read = %d\n", num_buffers);

uint32_t data_size = wavhdr->data_size;
uint32_t buffer_size = 131070;
uint32_t totalSamples = wavhdr->sample_rate * (wavhdr->bitsPerSample / 8);
Expand All @@ -391,7 +397,7 @@ extern "C" int sysHandler(uint32_t eax, uint32_t *frame)
{
current()->process->fillBuffers(file, wavhdr->sample_rate, true, data_size, totalSamples);
duration = data_size / wavhdr->sample_rate_eq;
jiffies = (((data_size )) % wavhdr->sample_rate_eq);
jiffies = (((data_size)) % wavhdr->sample_rate_eq);
jiffies *= 1000;
jiffies /= wavhdr->sample_rate_eq;
data_size = 0;
Expand All @@ -413,11 +419,10 @@ extern "C" int sysHandler(uint32_t eax, uint32_t *frame)
return -1;
}
Debug::printf("duration = %d\n", duration);
// outl(AC97::BAR0 + 0x02, 0x4000); // Master volume to max
// outl(AC97::BAR0 + 0x04, 0x4000); // Master volume to max
// outl(AC97::BAR0 + 0x18, 0x4000); // Master volume to max
outl(AC97::BAR0 + 0x02, 0x0000); // Master volume to max
outl(AC97::BAR0 + 0x04, 0x0000); // Master volume to max
outl(AC97::BAR0 + 0x18, 0x0000); // Master volume to max
AC97::play(duration, jiffies);

}

return 1;
Expand Down
Binary file modified t0.data
Binary file not shown.
2 changes: 2 additions & 0 deletions t0.dir/sbin/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ int main(int argc, char **argv)
shutdown();
return 0;
}


0 comments on commit 71476a1

Please sign in to comment.