mdio.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /**
  2. * \file mdio.h
  3. *
  4. * \brief MDIO APIs and macros.
  5. *
  6. * This file contains the driver API prototypes and macro definitions.
  7. */
  8. /*
  9. * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
  10. */
  11. /*
  12. * Redistribution and use in source and binary forms, with or without
  13. * modification, are permitted provided that the following conditions
  14. * are met:
  15. *
  16. * Redistributions of source code must retain the above copyright
  17. * notice, this list of conditions and the following disclaimer.
  18. *
  19. * Redistributions in binary form must reproduce the above copyright
  20. * notice, this list of conditions and the following disclaimer in the
  21. * documentation and/or other materials provided with the
  22. * distribution.
  23. *
  24. * Neither the name of Texas Instruments Incorporated nor the names of
  25. * its contributors may be used to endorse or promote products derived
  26. * from this software without specific prior written permission.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  29. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  30. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  31. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  32. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  33. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  34. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  35. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  36. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  37. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  38. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  39. *
  40. */
  41. #ifndef __MDIO_H__
  42. #define __MDIO_H__
  43. #include "hw_mdio.h"
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47. /*****************************************************************************/
  48. /*
  49. ** Structure to save CPSW context
  50. */
  51. typedef struct mdioContext {
  52. unsigned int mdioCtrl;
  53. }MDIOCONTEXT;
  54. /*
  55. ** Prototypes for the APIs
  56. */
  57. extern unsigned int MDIOPhyAliveStatusGet(unsigned int baseAddr);
  58. extern unsigned int MDIOPhyLinkStatusGet(unsigned int baseAddr);
  59. extern void MDIOInit(unsigned int baseAddr, unsigned int mdioInputFreq,
  60. unsigned int mdioOutputFreq);
  61. extern unsigned int MDIOPhyRegRead(unsigned int baseAddr, unsigned int phyAddr,
  62. unsigned int regNum, volatile unsigned short *dataPtr);
  63. extern void MDIOPhyRegWrite(unsigned int baseAddr, unsigned int phyAddr,
  64. unsigned int regNum, unsigned short RegVal);
  65. extern void MDIOContextSave(unsigned int baseAddr, MDIOCONTEXT *contextPtr);
  66. extern void MDIOContextRestore(unsigned int baseAddr, MDIOCONTEXT *contextPtr);
  67. #ifdef __cplusplus
  68. }
  69. #endif
  70. #endif /* __MDIO_H__ */