diff options
Diffstat (limited to 'embassy-net-enc28j60/src/bank2.rs')
| -rw-r--r-- | embassy-net-enc28j60/src/bank2.rs | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/embassy-net-enc28j60/src/bank2.rs b/embassy-net-enc28j60/src/bank2.rs new file mode 100644 index 000000000..74a1d245f --- /dev/null +++ b/embassy-net-enc28j60/src/bank2.rs | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | #[allow(dead_code)] | ||
| 2 | #[derive(Clone, Copy)] | ||
| 3 | pub enum Register { | ||
| 4 | MACON1 = 0x00, | ||
| 5 | MACON3 = 0x02, | ||
| 6 | MACON4 = 0x03, | ||
| 7 | MABBIPG = 0x04, | ||
| 8 | MAIPGL = 0x06, | ||
| 9 | MAIPGH = 0x07, | ||
| 10 | MACLCON1 = 0x08, | ||
| 11 | MACLCON2 = 0x09, | ||
| 12 | MAMXFLL = 0x0a, | ||
| 13 | MAMXFLH = 0x0b, | ||
| 14 | MICMD = 0x12, | ||
| 15 | MIREGADR = 0x14, | ||
| 16 | MIWRL = 0x16, | ||
| 17 | MIWRH = 0x17, | ||
| 18 | MIRDL = 0x18, | ||
| 19 | MIRDH = 0x19, | ||
| 20 | } | ||
| 21 | |||
| 22 | impl Register { | ||
| 23 | pub(crate) fn addr(&self) -> u8 { | ||
| 24 | *self as u8 | ||
| 25 | } | ||
| 26 | |||
| 27 | pub(crate) fn is_eth_register(&self) -> bool { | ||
| 28 | match *self { | ||
| 29 | Register::MACON1 => false, | ||
| 30 | Register::MACON3 => false, | ||
| 31 | Register::MACON4 => false, | ||
| 32 | Register::MABBIPG => false, | ||
| 33 | Register::MAIPGL => false, | ||
| 34 | Register::MAIPGH => false, | ||
| 35 | Register::MACLCON1 => false, | ||
| 36 | Register::MACLCON2 => false, | ||
| 37 | Register::MAMXFLL => false, | ||
| 38 | Register::MAMXFLH => false, | ||
| 39 | Register::MICMD => false, | ||
| 40 | Register::MIREGADR => false, | ||
| 41 | Register::MIWRL => false, | ||
| 42 | Register::MIWRH => false, | ||
| 43 | Register::MIRDL => false, | ||
| 44 | Register::MIRDH => false, | ||
| 45 | } | ||
| 46 | } | ||
| 47 | } | ||
| 48 | |||
| 49 | impl Into<super::Register> for Register { | ||
| 50 | fn into(self) -> super::Register { | ||
| 51 | super::Register::Bank2(self) | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | register!(MACON1, 0, u8, { | ||
| 56 | #[doc = "Enable packets to be received by the MAC"] | ||
| 57 | marxen @ 0, | ||
| 58 | #[doc = "Control frames will be discarded after being processed by the MAC"] | ||
| 59 | passall @ 1, | ||
| 60 | #[doc = "Inhibit transmissions when pause control frames are received"] | ||
| 61 | rxpaus @ 2, | ||
| 62 | #[doc = "Allow the MAC to transmit pause control frames"] | ||
| 63 | txpaus @ 3, | ||
| 64 | }); | ||
| 65 | |||
| 66 | register!(MACON3, 0, u8, { | ||
| 67 | #[doc = "MAC will operate in Full-Duplex mode"] | ||
| 68 | fuldpx @ 0, | ||
| 69 | #[doc = "The type/length field of transmitted and received frames will be checked"] | ||
| 70 | frmlnen @ 1, | ||
| 71 | #[doc = "Frames bigger than MAMXFL will be aborted when transmitted or received"] | ||
| 72 | hfrmen @ 2, | ||
| 73 | #[doc = "No proprietary header is present"] | ||
| 74 | phdren @ 3, | ||
| 75 | #[doc = "MAC will append a valid CRC to all frames transmitted regardless of PADCFG bit"] | ||
| 76 | txcrcen @ 4, | ||
| 77 | #[doc = "All short frames will be zero-padded to 64 bytes and a valid CRC will then be appended"] | ||
| 78 | padcfg @ 5..7, | ||
| 79 | }); | ||
| 80 | |||
| 81 | register!(MICMD, 0, u8, { | ||
| 82 | #[doc = "MII Read Enable bit"] | ||
| 83 | miird @ 0, | ||
| 84 | #[doc = "MII Scan Enable bit"] | ||
| 85 | miiscan @ 1, | ||
| 86 | }); | ||
