-
Notifications
You must be signed in to change notification settings - Fork 651
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1981: LowRISC: Initial commit of Pad Controller r=hudson-ayers a=alistair23 ### Pull Request Overview This PR adds support for the Pad Controller to the GPIO device. ### Testing Strategy Booting Tock on the OT FPGA. ### TODO or Help Wanted ### Documentation Updated - [X] Updated the relevant files in `/docs`, or no updates are required. ### Formatting - [X] Ran `make prepush`. Co-authored-by: Alistair Francis <alistair.francis@wdc.com>
- Loading branch information
Showing
4 changed files
with
168 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
pub mod gpio; | ||
pub mod hmac; | ||
pub mod i2c; | ||
pub mod padctrl; | ||
pub mod pwrmgr; | ||
pub mod uart; | ||
pub mod usbdev; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
//! General Purpose Input/Output driver. | ||
|
||
use kernel::common::registers::{register_bitfields, register_structs, ReadWrite}; | ||
|
||
register_structs! { | ||
pub PadCtrlRegisters { | ||
(0x00 => pub regen: ReadWrite<u32, REGEN::Register>), | ||
(0x04 => pub dio_pads: ReadWrite<u32, DIO_PADS::Register>), | ||
(0x08 => pub mio_pads0: ReadWrite<u32, DIO_PADS::Register>), | ||
(0x0c => pub mio_pads1: ReadWrite<u32, DIO_PADS::Register>), | ||
(0x10 => pub mio_pads2: ReadWrite<u32, DIO_PADS::Register>), | ||
(0x14 => pub mio_pads3: ReadWrite<u32, DIO_PADS::Register>), | ||
(0x18 => @END), | ||
} | ||
} | ||
|
||
register_bitfields![u32, | ||
pub REGEN [ | ||
WEN OFFSET(0) NUMBITS(1) [] | ||
], | ||
pub DIO_PADS [ | ||
ATTR0_IO_INV OFFSET(0) NUMBITS(1) [], | ||
ATTR0_OPEN_DRAIN OFFSET(1) NUMBITS(1) [], | ||
ATTR0_PULL_DOWN OFFSET(2) NUMBITS(1) [], | ||
ATTR0_PULL_UP OFFSET(3) NUMBITS(1) [], | ||
ATTR0_KEEPER OFFSET(4) NUMBITS(1) [], | ||
ATTR0_STRENGTH OFFSET(5) NUMBITS(1) [], | ||
ATTR1_IO_INV OFFSET(8) NUMBITS(1) [], | ||
ATTR1_OPEN_DRAIN OFFSET(9) NUMBITS(1) [], | ||
ATTR1_PULL_DOWN OFFSET(10) NUMBITS(1) [], | ||
ATTR1_PULL_UP OFFSET(11) NUMBITS(1) [], | ||
ATTR1_KEEPER OFFSET(12) NUMBITS(1) [], | ||
ATTR1_STRENGTH OFFSET(13) NUMBITS(1) [], | ||
ATTR2_IO_INV OFFSET(16) NUMBITS(1) [], | ||
ATTR2_OPEN_DRAIN OFFSET(17) NUMBITS(1) [], | ||
ATTR2_PULL_DOWN OFFSET(18) NUMBITS(1) [], | ||
ATTR2_PULL_UP OFFSET(19) NUMBITS(1) [], | ||
ATTR2_KEEPER OFFSET(20) NUMBITS(1) [], | ||
ATTR2_STRENGTH OFFSET(21) NUMBITS(1) [], | ||
ATTR3_IO_INV OFFSET(24) NUMBITS(1) [], | ||
ATTR3_OPEN_DRAIN OFFSET(25) NUMBITS(1) [], | ||
ATTR3_PULL_DOWN OFFSET(26) NUMBITS(1) [], | ||
ATTR3_PULL_UP OFFSET(27) NUMBITS(1) [], | ||
ATTR3_KEEPER OFFSET(28) NUMBITS(1) [], | ||
ATTR3_STRENGTH OFFSET(29) NUMBITS(1) [] | ||
] | ||
]; |