Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add two extra GPIO banks to the peripherals #178

Open
10 tasks
rrbutani opened this issue Jul 28, 2022 · 0 comments
Open
10 tasks

Add two extra GPIO banks to the peripherals #178

rrbutani opened this issue Jul 28, 2022 · 0 comments
Assignees
Labels
✨ feature New things! P-high High priority T-os Topic: The LC-3 OS (TRAPs too) T-peripheral traits Topic: Peripheral Traits

Comments

@rrbutani
Copy link
Member

what

We want to support use cases that require more than 8 GPIO pins. At the same time we don't want to limit device implementations of the platform to devices that have 24+ pins available.

So, it's time to introduce optional peripherals, something we've discussed before re: other peripherals like the Disk peripheral (#54).

steps

  • groundwork for optional peripherals
  • add extra mem-mapped I/O entries for the two extra banks (CR and DR, bank wide, and interrupt vectors)
  • extend the Control trait to support querying for the presence of optional peripherals
  • extend the Control trait to have methods for the extra gpio banks (get_states, get_readings)
    • asking about extra banks is fallible since they may not exist
    • the "right way" to model this is to grow get_extra_gpio_states/get_extra_gpio_readings functions that take a GpioBank arg but... I think it's okay to just modify the existing get_gpio_states/get_gpio_readings functions and for users to Know that the first bank will always be present
  • update the GPIO TRAPs to support taking pin numbers from 0 through 23
  • update the GPIO TRAP docs to reflect the change above; add traps::gpio module level docs that explain how to translate from pin names to numbers (i.e. GB5 = 1 * 8 + 5 = 13, etc., show a full table too (and then link to that section of the module level docs from all the GPIO TRAP docs)
  • update the GPIO TRAP tests to test these extra pins
  • update the TUI to:
    • support querying for the presence of extra GPIO banks
    • support displaying the state of the pins in the extra banks, if present

where

branch: feat/extra-gpio-banks

open questions

Pin numbering? I see two options:

  • bank prefixed; i.e. GA0, GA1, ..., GA7, GB0, ..., GB7, GC0, ...
    • internally we're going to just have three GPIO peripherals, each of which will take a GpioPin that's G0 through G7 so the upside to this option is that the internals match the names we're using externally
    • distinguishing the banks externally is valuable if we expose TRAPs that operate on the full banks (Add bank wide GPIO TRAPs for read/write #177)
  • flat: i.e. G0, ..., G23
    • the upside to this approach is the numbers match what users will feed the GPIO TRAPs

I've picked the 1st option for now (it doesn't seem too onerous to have students figure out that GC3 -> #19, etc.) but I'm not totally sold on it.

@rrbutani rrbutani added ✨ feature New things! P-high High priority T-peripheral traits Topic: Peripheral Traits labels Jul 28, 2022
@rrbutani rrbutani self-assigned this Jul 28, 2022
@rrbutani rrbutani added the T-os Topic: The LC-3 OS (TRAPs too) label Jul 28, 2022
@rrbutani rrbutani mentioned this issue Aug 31, 2022
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feature New things! P-high High priority T-os Topic: The LC-3 OS (TRAPs too) T-peripheral traits Topic: Peripheral Traits
Projects
None yet
Development

No branches or pull requests

1 participant