diff options
author | Evan Lojewski <github@meklort.com> | 2019-03-11 20:50:12 -0600 |
---|---|---|
committer | Evan Lojewski <github@meklort.com> | 2019-03-11 20:50:12 -0600 |
commit | 493a19f78ec48c77eb509e2e1b3309e14903484f (patch) | |
tree | 41e78c5551d1a0746edc05f4b39ecd1377f26a07 /libs | |
parent | add347acb959af0971b5e0349413b6531c6c1a96 (diff) | |
download | bcm5719-ortega-493a19f78ec48c77eb509e2e1b3309e14903484f.tar.gz bcm5719-ortega-493a19f78ec48c77eb509e2e1b3309e14903484f.zip |
Add initial stage2 code - mostly just a stub right now.
Diffstat (limited to 'libs')
-rw-r--r-- | libs/MII/include/MII.h | 5 | ||||
-rw-r--r-- | libs/MII/mii.c | 11 |
2 files changed, 16 insertions, 0 deletions
diff --git a/libs/MII/include/MII.h b/libs/MII/include/MII.h index 9588e01..bfca1e2 100644 --- a/libs/MII/include/MII.h +++ b/libs/MII/include/MII.h @@ -82,4 +82,9 @@ void MII_selectBlock(uint8_t phy, uint16_t block); */ uint16_t MII_getBlock(uint8_t phy); +/** + * @fn void MII_reset(uint8_t phy); + */ +void MII_reset(uint8_t phy); + #endif /* MII_H */ diff --git a/libs/MII/mii.c b/libs/MII/mii.c index 69ba6b1..4f33e30 100644 --- a/libs/MII/mii.c +++ b/libs/MII/mii.c @@ -125,3 +125,14 @@ uint16_t MII_getBlock(uint8_t phy) // Write register 0x1f with the block. return MII_readRegister(phy, (mii_reg_t)REG_MII_BLOCK_SELECT); } + +void MII_reset(uint8_t phy) +{ + // Set MII_REG_CONTROL to RESET; wait until RESET bit clears. + MII_writeRegister(phy, (mii_reg_t)REG_MII_CONTROL, MII_CONTROL_RESET_MASK); + + do + { + // Spin + } while((MII_readRegister(phy, (mii_reg_t)REG_MII_CONTROL) & MII_CONTROL_RESET_MASK) == MII_CONTROL_RESET_MASK); +} |