Skip to content

Commit

Permalink
Merge pull request #15 from byu-cpe/2025w
Browse files Browse the repository at this point in the history
pit driver updates
  • Loading branch information
jgoeders authored Dec 19, 2024
2 parents 593d239 + 1c6c5e4 commit fc46dfd
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
23 changes: 15 additions & 8 deletions _labs/audio_driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,24 @@ In this milestone you will add an *ioctl* interface to your driver to allow user
* Extend your kernel driver to add *ioctl* to the list of file operations supported by your character device. You should support two ioctl commands:
- Turn on looping for the current audio clip.
- Turn off looping for the current audio clip.
* Integrate sound into Space Invaders by generating the following sounds during game operation:
* WAVE files are provided [here](https://github.com/byu-cpe/ecen427_student/tree/master/resources/wavFiles).
* the "marching" sound the aliens make as they move back and forth across the screen is comprised of four separate walk1, walk2, walk3, and walk4 sounds. You start with walk1 the first time an alien moves and then play the next sound in the sequence on each successive move, cycling back to wave1.
* the sound that the red flying saucer makes as it flies across the screen (use your looping functionality for this)
* the explosion noise that occurs when your tank is hit by an alien bullet,
* the explosion noise that occurs when an alien is hit by a tank bullet,
* the "ping" sound that the tank makes when you fire a bullet, and
* The "marching" sound the aliens make as they move back and forth across the screen is comprised of four separate walk1, walk2, walk3, and walk4 sounds. You start with walk1 the first time an alien moves and then play the next sound in the sequence on each successive move, cycling back to wave1. You will need to have a pause between each sound.
* The sound that the red flying saucer makes as it flies across the screen (use your looping functionality for this)
* The sound that occurs when your tank is hit by an alien bullet.
* The sound that occurs when an alien is hit by a tank bullet.
* The sound that occurs when you fire a bullet.
* the sound the flying saucer makes if you hit it with a bullet.
* Implement volume control in the following manner:
* To increase volume, slide sw0 up, press btn3. Each press increases the volume a preset amount, such as 10%.
* To decrease volume, slide sw0 down, press btn3. Each press decreases the volume a preset amount, such as 10%.
<!-- * Implement volume control in the following manner: -->
<!-- * To increase volume, slide sw0 up, press btn3. Each press increases the volume a preset amount, such as 10%. -->
<!-- * To decrease volume, slide sw0 down, press btn3. Each press decreases the volume a preset amount, such as 10%. -->
* Sound Priority:
* The UFO sound has the highest priority. When it is present, no other sound should be played.
* The walking sounds have the lowest priority. They should be played only if no other sound is currently playing.
* The other sounds have medium priority. When played, they should interrupt any other sound that is currently playing, except for the UFO sound.
### Passing Off
Your Space Invaders game should be operating with all of the sound effects. As a reminder, the coding standard requires that your code compile without warnings. The TAs will verify this at pass off (both kernel and user code).
Expand Down
17 changes: 13 additions & 4 deletions _labs/pit_driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Like device files that you used for your audio driver, sysfs is another method f

## Specification

The interface to your driver should be located at */sys/devices/soc0/amba/\<your baseaddr\>.ecen427_pit/*. This means the entry you add in the device tree should be called *ecen427_pit*.
The interface to your driver should be located at */sys/devices/soc0/axi/\<your baseaddr\>.ecen427_pit/*. This means the entry you add in the device tree should be called *ecen427_pit*.

Your driver must expose the following functionality through the sysfs interface:
* Get/set timer period
Expand Down Expand Up @@ -59,16 +59,25 @@ Your driver must expose the following functionality through the sysfs interface:
* Extend your driver to support the sysfs interfaces described above.
* To add sysfs attributes, you need a `struct kobject *` type. You can obtain this from your `probe` function. The probe function provide a `struct platform_device *pdev` argument, and you can obtain the `struct kobject *` by doing `&pdev->dev.kobj`.

### Space Invaders
* Modify your space invaders game code to use the interrupt from the PIT.
### Verifying with Int Rate
You can verify that your PIT is working correctly by testing it with the [int_rate](https://github.com/byu-cpe/ecen427_student/tree/main/userspace/apps/int_rate) application. Modify [this line](https://github.com/byu-cpe/ecen427_student/blob/main/userspace/apps/int_rate/int_rate.cpp#L12) in the source code to use the PIT interrupt line instead of the FIT interrupt line.

While this application is running, you can run a command like this to change the period of your PIT on the fly:
```
sudo bash -c "echo 10000 > /sys/devices/soc0/axi/\<your baseaddr\>.ecen427_pit/period"
```

The above command should increase the tick rate from a period of 16.67ms to 10ms.

### Space Invaders
Modify your space invaders game code to use the interrupt from the PIT.


## Pass-Off/Submission
The TAs will check that your PIT works correctly by running your space invaders game, and while the game is executing, doing something like the following to see that your game speed changes on the fly.

```
sudo bash -c "echo 20000 > /sys/devices/soc0/amba/\<your baseaddr\>.ecen427_pit/period"
sudo bash -c "echo 33334 > /sys/devices/soc0/axi/\<your baseaddr\>.ecen427_pit/period"
```

The above command should cause your game to run at half speed.
Expand Down

0 comments on commit fc46dfd

Please sign in to comment.