lab 3
arch/TARGET_Freescale/hardware_init_MK64F12.c@18:b15a12222890, 2014-09-18 (annotated)
- Committer:
- mbed_official
- Date:
- Thu Sep 18 14:00:53 2014 +0100
- Revision:
- 18:b15a12222890
- Parent:
- 17:eb2c8c3aa1cd
- Child:
- 20:620d381e7f4c
Synchronized with git revision a73f28e6fbca9559fbed2726410eeb4c0534a4a5
Full URL: https://github.com/mbedmicro/mbed/commit/a73f28e6fbca9559fbed2726410eeb4c0534a4a5/
Extended #476, which does not break ethernet for K64F
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 10:ab9330955226 | 1 | /* |
mbed_official | 10:ab9330955226 | 2 | * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc. |
mbed_official | 10:ab9330955226 | 3 | * All rights reserved. |
mbed_official | 10:ab9330955226 | 4 | * |
mbed_official | 10:ab9330955226 | 5 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 10:ab9330955226 | 6 | * are permitted provided that the following conditions are met: |
mbed_official | 10:ab9330955226 | 7 | * |
mbed_official | 10:ab9330955226 | 8 | * o Redistributions of source code must retain the above copyright notice, this list |
mbed_official | 10:ab9330955226 | 9 | * of conditions and the following disclaimer. |
mbed_official | 10:ab9330955226 | 10 | * |
mbed_official | 10:ab9330955226 | 11 | * o Redistributions in binary form must reproduce the above copyright notice, this |
mbed_official | 10:ab9330955226 | 12 | * list of conditions and the following disclaimer in the documentation and/or |
mbed_official | 10:ab9330955226 | 13 | * other materials provided with the distribution. |
mbed_official | 10:ab9330955226 | 14 | * |
mbed_official | 10:ab9330955226 | 15 | * o Neither the name of Freescale Semiconductor, Inc. nor the names of its |
mbed_official | 10:ab9330955226 | 16 | * contributors may be used to endorse or promote products derived from this |
mbed_official | 10:ab9330955226 | 17 | * software without specific prior written permission. |
mbed_official | 10:ab9330955226 | 18 | * |
mbed_official | 10:ab9330955226 | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
mbed_official | 10:ab9330955226 | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
mbed_official | 10:ab9330955226 | 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 10:ab9330955226 | 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
mbed_official | 10:ab9330955226 | 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
mbed_official | 10:ab9330955226 | 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
mbed_official | 10:ab9330955226 | 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
mbed_official | 10:ab9330955226 | 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
mbed_official | 10:ab9330955226 | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
mbed_official | 10:ab9330955226 | 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 10:ab9330955226 | 29 | */ |
mbed_official | 10:ab9330955226 | 30 | |
mbed_official | 10:ab9330955226 | 31 | #include "fsl_port_hal.h" |
mbed_official | 10:ab9330955226 | 32 | #include "fsl_clock_manager.h" |
mbed_official | 10:ab9330955226 | 33 | #include "fsl_device_registers.h" |
mbed_official | 10:ab9330955226 | 34 | #include "fsl_sim_hal.h" |
mbed_official | 10:ab9330955226 | 35 | |
mbed_official | 10:ab9330955226 | 36 | /******************************************************************************* |
mbed_official | 10:ab9330955226 | 37 | * Code |
mbed_official | 10:ab9330955226 | 38 | ******************************************************************************/ |
mbed_official | 10:ab9330955226 | 39 | void k64f_init_eth_hardware(void) |
mbed_official | 10:ab9330955226 | 40 | { |
mbed_official | 10:ab9330955226 | 41 | uint8_t count; |
mbed_official | 10:ab9330955226 | 42 | |
mbed_official | 10:ab9330955226 | 43 | /* Disable the mpu*/ |
mbed_official | 18:b15a12222890 | 44 | BW_MPU_CESR_VLD(MPU_BASE, 0); |
mbed_official | 10:ab9330955226 | 45 | |
mbed_official | 10:ab9330955226 | 46 | /* Open POTR clock gate*/ |
mbed_official | 10:ab9330955226 | 47 | for (count = 0; count < HW_PORT_INSTANCE_COUNT; count++) |
mbed_official | 10:ab9330955226 | 48 | { |
mbed_official | 18:b15a12222890 | 49 | CLOCK_SYS_EnablePortClock(count); |
mbed_official | 10:ab9330955226 | 50 | } |
mbed_official | 10:ab9330955226 | 51 | |
mbed_official | 10:ab9330955226 | 52 | /* Configure gpio*/ |
mbed_official | 18:b15a12222890 | 53 | PORT_HAL_SetMuxMode(HW_PORTA, 12, kPortMuxAlt4); /*!< ENET RMII0_RXD1/MII0_RXD1*/ |
mbed_official | 18:b15a12222890 | 54 | PORT_HAL_SetMuxMode(HW_PORTA, 13, kPortMuxAlt4); /*!< ENET RMII0_RXD0/MII0_RXD0*/ |
mbed_official | 18:b15a12222890 | 55 | PORT_HAL_SetMuxMode(HW_PORTA, 14, kPortMuxAlt4); /*!< ENET RMII0_CRS_DV/MII0_RXDV*/ |
mbed_official | 18:b15a12222890 | 56 | PORT_HAL_SetMuxMode(HW_PORTA, 15, kPortMuxAlt4); /*!< ENET RMII0_TXEN/MII0_TXEN*/ |
mbed_official | 18:b15a12222890 | 57 | PORT_HAL_SetMuxMode(HW_PORTA, 16, kPortMuxAlt4); /*!< ENET RMII0_TXD0/MII0_TXD0*/ |
mbed_official | 18:b15a12222890 | 58 | PORT_HAL_SetMuxMode(HW_PORTA, 17, kPortMuxAlt4); /*!< ENET RMII0_TXD01/MII0_TXD1*/ |
mbed_official | 18:b15a12222890 | 59 | PORT_HAL_SetMuxMode(HW_PORTB, 0, kPortMuxAlt4); /*!< ENET RMII0_MDIO/MII0_MDIO*/ |
mbed_official | 18:b15a12222890 | 60 | PORT_HAL_SetOpenDrainCmd(HW_PORTB,0, true); /*!< ENET RMII0_MDC/MII0_MDC*/ |
mbed_official | 10:ab9330955226 | 61 | |
mbed_official | 10:ab9330955226 | 62 | // Added for FRDM-K64F |
mbed_official | 18:b15a12222890 | 63 | PORT_HAL_SetPullMode(HW_PORTB, 0, kPortPullUp); |
mbed_official | 18:b15a12222890 | 64 | PORT_HAL_SetPullCmd(HW_PORTB, 0, true); |
mbed_official | 10:ab9330955226 | 65 | |
mbed_official | 18:b15a12222890 | 66 | PORT_HAL_SetMuxMode(HW_PORTB, 1, kPortMuxAlt4); |
mbed_official | 10:ab9330955226 | 67 | /* Configure GPIO for MII interface */ |
mbed_official | 18:b15a12222890 | 68 | PORT_HAL_SetMuxMode(HW_PORTA, 9, kPortMuxAlt4); /*!< ENET MII0_RXD3*/ |
mbed_official | 18:b15a12222890 | 69 | PORT_HAL_SetMuxMode(HW_PORTA, 10, kPortMuxAlt4); /*!< ENET MII0_RXD2*/ |
mbed_official | 18:b15a12222890 | 70 | PORT_HAL_SetMuxMode(HW_PORTA, 11, kPortMuxAlt4); /*!< ENET MII0_RXCLK*/ |
mbed_official | 18:b15a12222890 | 71 | PORT_HAL_SetMuxMode(HW_PORTA, 24, kPortMuxAlt4); /*!< ENET MII0_TXD2*/ |
mbed_official | 18:b15a12222890 | 72 | PORT_HAL_SetMuxMode(HW_PORTA, 25, kPortMuxAlt4); /*!< ENET MII0_TXCLK*/ |
mbed_official | 18:b15a12222890 | 73 | PORT_HAL_SetMuxMode(HW_PORTA, 26, kPortMuxAlt4); /*!< ENET MII0_TXD3*/ |
mbed_official | 18:b15a12222890 | 74 | PORT_HAL_SetMuxMode(HW_PORTA, 27, kPortMuxAlt4); /*!< ENET MII0_CRS*/ |
mbed_official | 18:b15a12222890 | 75 | PORT_HAL_SetMuxMode(HW_PORTA, 28, kPortMuxAlt4); /*!< ENET MII0_TXER*/ |
mbed_official | 18:b15a12222890 | 76 | PORT_HAL_SetMuxMode(HW_PORTA, 29, kPortMuxAlt4); /*!< ENET MII0_COL*/ |
mbed_official | 10:ab9330955226 | 77 | #if FSL_FEATURE_ENET_SUPPORT_PTP |
mbed_official | 18:b15a12222890 | 78 | PORT_HAL_SetMuxMode(HW_PORTC, (16 + ENET_TIMER_CHANNEL_NUM), kPortMuxAlt4); /* ENET ENET0_1588_TMR0*/ |
mbed_official | 18:b15a12222890 | 79 | PORT_HAL_SetDriveStrengthMode(HW_PORTC, (16 + ENET_TIMER_CHANNEL_NUM), kPortHighDriveStrength); |
mbed_official | 10:ab9330955226 | 80 | #endif |
mbed_official | 10:ab9330955226 | 81 | |
mbed_official | 10:ab9330955226 | 82 | /* Open ENET clock gate*/ |
mbed_official | 18:b15a12222890 | 83 | CLOCK_SYS_EnableEnetClock( 0U); |
mbed_official | 10:ab9330955226 | 84 | |
mbed_official | 10:ab9330955226 | 85 | /* Select the ptp timer outclk*/ |
mbed_official | 18:b15a12222890 | 86 | CLOCK_HAL_SetSource(g_simBaseAddr[0], kClockTimeSrc, 2); |
mbed_official | 10:ab9330955226 | 87 | } |
mbed_official | 10:ab9330955226 | 88 | |
mbed_official | 10:ab9330955226 | 89 | /******************************************************************************* |
mbed_official | 10:ab9330955226 | 90 | * EOF |
mbed_official | 10:ab9330955226 | 91 | ******************************************************************************/ |
mbed_official | 10:ab9330955226 | 92 | |
mbed_official | 18:b15a12222890 | 93 |