/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/adc/fsl_adc_hal.h substitute line 894 extern } by }
Fork of mbed by
TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/common/phyksz8081/fsl_phy_driver.h@83:8a40adfe8776, 2014-04-28 (annotated)
- Committer:
- bogdanm
- Date:
- Mon Apr 28 17:39:05 2014 +0100
- Revision:
- 83:8a40adfe8776
- Child:
- 90:cb3d968589d8
Release 83 of the mbed library
Main changes:
- updated tests
- K64F TCP/IP support
- lots of fixes in various targets
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 83:8a40adfe8776 | 1 | /* |
bogdanm | 83:8a40adfe8776 | 2 | * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc. |
bogdanm | 83:8a40adfe8776 | 3 | * All rights reserved. |
bogdanm | 83:8a40adfe8776 | 4 | * |
bogdanm | 83:8a40adfe8776 | 5 | * Redistribution and use in source and binary forms, with or without modification, |
bogdanm | 83:8a40adfe8776 | 6 | * are permitted provided that the following conditions are met: |
bogdanm | 83:8a40adfe8776 | 7 | * |
bogdanm | 83:8a40adfe8776 | 8 | * o Redistributions of source code must retain the above copyright notice, this list |
bogdanm | 83:8a40adfe8776 | 9 | * of conditions and the following disclaimer. |
bogdanm | 83:8a40adfe8776 | 10 | * |
bogdanm | 83:8a40adfe8776 | 11 | * o Redistributions in binary form must reproduce the above copyright notice, this |
bogdanm | 83:8a40adfe8776 | 12 | * list of conditions and the following disclaimer in the documentation and/or |
bogdanm | 83:8a40adfe8776 | 13 | * other materials provided with the distribution. |
bogdanm | 83:8a40adfe8776 | 14 | * |
bogdanm | 83:8a40adfe8776 | 15 | * o Neither the name of Freescale Semiconductor, Inc. nor the names of its |
bogdanm | 83:8a40adfe8776 | 16 | * contributors may be used to endorse or promote products derived from this |
bogdanm | 83:8a40adfe8776 | 17 | * software without specific prior written permission. |
bogdanm | 83:8a40adfe8776 | 18 | * |
bogdanm | 83:8a40adfe8776 | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
bogdanm | 83:8a40adfe8776 | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
bogdanm | 83:8a40adfe8776 | 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
bogdanm | 83:8a40adfe8776 | 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
bogdanm | 83:8a40adfe8776 | 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
bogdanm | 83:8a40adfe8776 | 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
bogdanm | 83:8a40adfe8776 | 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
bogdanm | 83:8a40adfe8776 | 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
bogdanm | 83:8a40adfe8776 | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
bogdanm | 83:8a40adfe8776 | 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
bogdanm | 83:8a40adfe8776 | 29 | */ |
bogdanm | 83:8a40adfe8776 | 30 | #ifndef __FSL_PHY_DRIVER_H__ |
bogdanm | 83:8a40adfe8776 | 31 | #define __FSL_PHY_DRIVER_H__ |
bogdanm | 83:8a40adfe8776 | 32 | |
bogdanm | 83:8a40adfe8776 | 33 | #include <stdint.h> |
bogdanm | 83:8a40adfe8776 | 34 | #include <stdbool.h> |
bogdanm | 83:8a40adfe8776 | 35 | #include "fsl_enet_driver.h" |
bogdanm | 83:8a40adfe8776 | 36 | /*! |
bogdanm | 83:8a40adfe8776 | 37 | * @addtogroup phy_driver |
bogdanm | 83:8a40adfe8776 | 38 | * @{ |
bogdanm | 83:8a40adfe8776 | 39 | */ |
bogdanm | 83:8a40adfe8776 | 40 | |
bogdanm | 83:8a40adfe8776 | 41 | /*! @file*/ |
bogdanm | 83:8a40adfe8776 | 42 | |
bogdanm | 83:8a40adfe8776 | 43 | /******************************************************************************* |
bogdanm | 83:8a40adfe8776 | 44 | * Definitions |
bogdanm | 83:8a40adfe8776 | 45 | ******************************************************************************/ |
bogdanm | 83:8a40adfe8776 | 46 | /*! @brief Defines the PHY return status. */ |
bogdanm | 83:8a40adfe8776 | 47 | typedef enum _phy_status |
bogdanm | 83:8a40adfe8776 | 48 | { |
bogdanm | 83:8a40adfe8776 | 49 | kStatus_PHY_Success = 0, /*!< Success*/ |
bogdanm | 83:8a40adfe8776 | 50 | kStatus_PHY_InvaildInput = 1, /*!< Invalid PHY input parameter*/ |
bogdanm | 83:8a40adfe8776 | 51 | kStatus_PHY_TimeOut = 2, /*!< PHY timeout*/ |
bogdanm | 83:8a40adfe8776 | 52 | kStatus_PHY_Fail = 3 /*!< PHY fail*/ |
bogdanm | 83:8a40adfe8776 | 53 | } phy_status_t; |
bogdanm | 83:8a40adfe8776 | 54 | |
bogdanm | 83:8a40adfe8776 | 55 | /*! @brief Defines the ENET timeout.*/ |
bogdanm | 83:8a40adfe8776 | 56 | typedef enum _phy_timeout |
bogdanm | 83:8a40adfe8776 | 57 | { |
bogdanm | 83:8a40adfe8776 | 58 | kPhyTimeout = 0x10000, /*!< ENET resets timeout.*/ |
bogdanm | 83:8a40adfe8776 | 59 | } phy_timeout_t; |
bogdanm | 83:8a40adfe8776 | 60 | |
bogdanm | 83:8a40adfe8776 | 61 | /*! @brief Defines the PHY register.*/ |
bogdanm | 83:8a40adfe8776 | 62 | typedef enum _enet_phy_register |
bogdanm | 83:8a40adfe8776 | 63 | { |
bogdanm | 83:8a40adfe8776 | 64 | kEnetPhyCR = 0, /*!< PHY control register */ |
bogdanm | 83:8a40adfe8776 | 65 | kEnetPhySR = 1, /*!< PHY status register*/ |
bogdanm | 83:8a40adfe8776 | 66 | kEnetPhyId1 = 2, /*!< PHY identification register 1*/ |
bogdanm | 83:8a40adfe8776 | 67 | kEnetPhyId2 = 3, /*!< PHY identification register 2*/ |
bogdanm | 83:8a40adfe8776 | 68 | kEnetPhyCt2 = 0x1e /*!< PHY control2 register*/ |
bogdanm | 83:8a40adfe8776 | 69 | } enet_phy_register_t; |
bogdanm | 83:8a40adfe8776 | 70 | |
bogdanm | 83:8a40adfe8776 | 71 | /*! @brief Defines the control flag.*/ |
bogdanm | 83:8a40adfe8776 | 72 | typedef enum _enet_phy_control |
bogdanm | 83:8a40adfe8776 | 73 | { |
bogdanm | 83:8a40adfe8776 | 74 | kEnetPhyAutoNeg = 0x1000,/*!< ENET PHY auto negotiation control*/ |
bogdanm | 83:8a40adfe8776 | 75 | kEnetPhySpeed = 0x2000, /*! ENET PHY speed control*/ |
bogdanm | 83:8a40adfe8776 | 76 | kEnetPhyLoop = 0x4000, /*!< ENET PHY loop control*/ |
bogdanm | 83:8a40adfe8776 | 77 | kEnetPhyReset = 0x8000, /*!< ENET PHY reset control*/ |
bogdanm | 83:8a40adfe8776 | 78 | kEnetPhy10HalfDuplex = 0x01, /*!< ENET PHY 10 M half duplex*/ |
bogdanm | 83:8a40adfe8776 | 79 | kEnetPhy100HalfDuplex = 0x02,/*!< ENET PHY 100 M half duplex*/ |
bogdanm | 83:8a40adfe8776 | 80 | kEnetPhy10FullDuplex = 0x05,/*!< ENET PHY 10 M full duplex*/ |
bogdanm | 83:8a40adfe8776 | 81 | kEnetPhy100FullDuplex = 0x06/*!< ENET PHY 100 M full duplex*/ |
bogdanm | 83:8a40adfe8776 | 82 | } enet_phy_control_t; |
bogdanm | 83:8a40adfe8776 | 83 | |
bogdanm | 83:8a40adfe8776 | 84 | /*! @brief Defines the PHY link speed. */ |
bogdanm | 83:8a40adfe8776 | 85 | typedef enum _enet_phy_speed |
bogdanm | 83:8a40adfe8776 | 86 | { |
bogdanm | 83:8a40adfe8776 | 87 | kEnetSpeed10M = 0, /*!< ENET PHY 10 M speed*/ |
bogdanm | 83:8a40adfe8776 | 88 | kEnetSpeed100M = 1 /*!< ENET PHY 100 M speed*/ |
bogdanm | 83:8a40adfe8776 | 89 | } enet_phy_speed_t; |
bogdanm | 83:8a40adfe8776 | 90 | |
bogdanm | 83:8a40adfe8776 | 91 | /*! @brief Defines the PHY link duplex.*/ |
bogdanm | 83:8a40adfe8776 | 92 | typedef enum _enet_phy_duplex |
bogdanm | 83:8a40adfe8776 | 93 | { |
bogdanm | 83:8a40adfe8776 | 94 | kEnetHalfDuplex = 0, /*!< ENET PHY half duplex*/ |
bogdanm | 83:8a40adfe8776 | 95 | kEnetFullDuplex = 1 /*!< ENET PHY full duplex*/ |
bogdanm | 83:8a40adfe8776 | 96 | } enet_phy_duplex_t; |
bogdanm | 83:8a40adfe8776 | 97 | |
bogdanm | 83:8a40adfe8776 | 98 | /*! @brief Defines the PHY status.*/ |
bogdanm | 83:8a40adfe8776 | 99 | typedef enum _enet_phy_status |
bogdanm | 83:8a40adfe8776 | 100 | { |
bogdanm | 83:8a40adfe8776 | 101 | kEnetPhyLinkStatus = 0x4, /*!< ENET PHY link status bit*/ |
bogdanm | 83:8a40adfe8776 | 102 | kEnetPhyAutoNegAble = 0x08, /*!< ENET PHY auto negotiation ability*/ |
bogdanm | 83:8a40adfe8776 | 103 | kEnetPhyAutoNegComplete = 0x20, /*!< ENET PHY auto negotiation complete*/ |
bogdanm | 83:8a40adfe8776 | 104 | kEnetPhySpeedDulpexMask = 0x07 /*!< ENET PHY speed mask on status register 2*/ |
bogdanm | 83:8a40adfe8776 | 105 | } enet_phy_status_t; |
bogdanm | 83:8a40adfe8776 | 106 | |
bogdanm | 83:8a40adfe8776 | 107 | /*! @brief Defines the basic PHY application.*/ |
bogdanm | 83:8a40adfe8776 | 108 | typedef struct ENETPhyApi |
bogdanm | 83:8a40adfe8776 | 109 | { |
bogdanm | 83:8a40adfe8776 | 110 | uint32_t (* phy_auto_discover)(enet_dev_if_t * enetIfPtr);/*!< PHY auto discover*/ |
bogdanm | 83:8a40adfe8776 | 111 | uint32_t (* phy_init)(enet_dev_if_t * enetIfPtr);/*!< PHY initialize*/ |
bogdanm | 83:8a40adfe8776 | 112 | uint32_t (* phy_get_link_speed)(enet_dev_if_t * enetIfPtr, enet_phy_speed_t *speed);/*!< Get PHY speed*/ |
bogdanm | 83:8a40adfe8776 | 113 | uint32_t (* phy_get_link_status)(enet_dev_if_t * enetIfPtr, bool *status);/*! Get PHY link status*/ |
bogdanm | 83:8a40adfe8776 | 114 | uint32_t (* phy_get_link_duplex)(enet_dev_if_t * enetIfPtr, enet_phy_duplex_t *duplex);/*!< Get PHY link duplex*/ |
bogdanm | 83:8a40adfe8776 | 115 | } enet_phy_api_t; |
bogdanm | 83:8a40adfe8776 | 116 | |
bogdanm | 83:8a40adfe8776 | 117 | /******************************************************************************* |
bogdanm | 83:8a40adfe8776 | 118 | * Global variables |
bogdanm | 83:8a40adfe8776 | 119 | ******************************************************************************/ |
bogdanm | 83:8a40adfe8776 | 120 | extern const enet_phy_api_t g_enetPhyApi; |
bogdanm | 83:8a40adfe8776 | 121 | |
bogdanm | 83:8a40adfe8776 | 122 | /******************************************************************************* |
bogdanm | 83:8a40adfe8776 | 123 | * API |
bogdanm | 83:8a40adfe8776 | 124 | ******************************************************************************/ |
bogdanm | 83:8a40adfe8776 | 125 | |
bogdanm | 83:8a40adfe8776 | 126 | #if defined(__cplusplus) |
bogdanm | 83:8a40adfe8776 | 127 | extern "C" { |
bogdanm | 83:8a40adfe8776 | 128 | #endif |
bogdanm | 83:8a40adfe8776 | 129 | |
bogdanm | 83:8a40adfe8776 | 130 | /*! |
bogdanm | 83:8a40adfe8776 | 131 | * @name PHY Driver |
bogdanm | 83:8a40adfe8776 | 132 | * @{ |
bogdanm | 83:8a40adfe8776 | 133 | */ |
bogdanm | 83:8a40adfe8776 | 134 | |
bogdanm | 83:8a40adfe8776 | 135 | /*! |
bogdanm | 83:8a40adfe8776 | 136 | * @brief Initializes PHY. |
bogdanm | 83:8a40adfe8776 | 137 | * |
bogdanm | 83:8a40adfe8776 | 138 | * @param enetIfPtr The ENET context structure. |
bogdanm | 83:8a40adfe8776 | 139 | * @return The execution status. |
bogdanm | 83:8a40adfe8776 | 140 | */ |
bogdanm | 83:8a40adfe8776 | 141 | uint32_t phy_init(enet_dev_if_t * enetIfPtr); |
bogdanm | 83:8a40adfe8776 | 142 | |
bogdanm | 83:8a40adfe8776 | 143 | /*! |
bogdanm | 83:8a40adfe8776 | 144 | * @brief PHY address auto discover. |
bogdanm | 83:8a40adfe8776 | 145 | * |
bogdanm | 83:8a40adfe8776 | 146 | * @param enetIfPtr The ENET context structure. |
bogdanm | 83:8a40adfe8776 | 147 | * @return The execution status. |
bogdanm | 83:8a40adfe8776 | 148 | */ |
bogdanm | 83:8a40adfe8776 | 149 | uint32_t phy_auto_discover(enet_dev_if_t * enetIfPtr); |
bogdanm | 83:8a40adfe8776 | 150 | |
bogdanm | 83:8a40adfe8776 | 151 | /*! |
bogdanm | 83:8a40adfe8776 | 152 | * @brief Gets the PHY link speed. |
bogdanm | 83:8a40adfe8776 | 153 | * |
bogdanm | 83:8a40adfe8776 | 154 | * @param enetIfPtr The ENET context structure. |
bogdanm | 83:8a40adfe8776 | 155 | * @param status The link speed of PHY. |
bogdanm | 83:8a40adfe8776 | 156 | * @return The execution status. |
bogdanm | 83:8a40adfe8776 | 157 | */ |
bogdanm | 83:8a40adfe8776 | 158 | uint32_t phy_get_link_speed(enet_dev_if_t * enetIfPtr, enet_phy_speed_t *status); |
bogdanm | 83:8a40adfe8776 | 159 | |
bogdanm | 83:8a40adfe8776 | 160 | /*! |
bogdanm | 83:8a40adfe8776 | 161 | * @brief Gets the PHY link status. |
bogdanm | 83:8a40adfe8776 | 162 | * |
bogdanm | 83:8a40adfe8776 | 163 | * @param enetIfPtr The ENET context structure. |
bogdanm | 83:8a40adfe8776 | 164 | * @param status The link on or down status of the PHY. |
bogdanm | 83:8a40adfe8776 | 165 | * @return The execution status. |
bogdanm | 83:8a40adfe8776 | 166 | */ |
bogdanm | 83:8a40adfe8776 | 167 | uint32_t phy_get_link_status(enet_dev_if_t * enetIfPtr, bool *status); |
bogdanm | 83:8a40adfe8776 | 168 | |
bogdanm | 83:8a40adfe8776 | 169 | /*! |
bogdanm | 83:8a40adfe8776 | 170 | * @brief Gets the PHY link duplex. |
bogdanm | 83:8a40adfe8776 | 171 | * |
bogdanm | 83:8a40adfe8776 | 172 | * @param enetIfPtr The ENET context structure. |
bogdanm | 83:8a40adfe8776 | 173 | * @param status The link duplex status of PHY. |
bogdanm | 83:8a40adfe8776 | 174 | * @return The execution status. |
bogdanm | 83:8a40adfe8776 | 175 | */ |
bogdanm | 83:8a40adfe8776 | 176 | uint32_t phy_get_link_duplex(enet_dev_if_t * enetIfPtr, enet_phy_duplex_t *status); |
bogdanm | 83:8a40adfe8776 | 177 | |
bogdanm | 83:8a40adfe8776 | 178 | /* @} */ |
bogdanm | 83:8a40adfe8776 | 179 | |
bogdanm | 83:8a40adfe8776 | 180 | #if defined(__cplusplus) |
bogdanm | 83:8a40adfe8776 | 181 | extern } |
bogdanm | 83:8a40adfe8776 | 182 | #endif |
bogdanm | 83:8a40adfe8776 | 183 | |
bogdanm | 83:8a40adfe8776 | 184 | /*! @}*/ |
bogdanm | 83:8a40adfe8776 | 185 | |
bogdanm | 83:8a40adfe8776 | 186 | #endif /* __FSL_PHY_DRIVER_H__ */ |
bogdanm | 83:8a40adfe8776 | 187 | /******************************************************************************* |
bogdanm | 83:8a40adfe8776 | 188 | * EOF |
bogdanm | 83:8a40adfe8776 | 189 | ******************************************************************************/ |
bogdanm | 83:8a40adfe8776 | 190 |