lab practicals

Committer:
mbed_official
Date:
Mon May 04 08:30:44 2015 +0100
Revision:
26:32c3ccc5a8ef
Parent:
20:620d381e7f4c
Child:
31:da93f0f73711
Synchronized with git revision ffaae4bf4b40d730019091feaba2966aedce31fa

Full URL: https://github.com/mbedmicro/mbed/commit/ffaae4bf4b40d730019091feaba2966aedce31fa/

K64F - Removed configuration of MII pins

Who changed what in which revision?

UserRevisionLine numberNew 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 20:620d381e7f4c 53 PORT_HAL_SetMuxMode(PORTA_BASE, 12, kPortMuxAlt4); /*!< ENET RMII0_RXD1/MII0_RXD1*/
mbed_official 20:620d381e7f4c 54 PORT_HAL_SetMuxMode(PORTA_BASE, 13, kPortMuxAlt4); /*!< ENET RMII0_RXD0/MII0_RXD0*/
mbed_official 20:620d381e7f4c 55 PORT_HAL_SetMuxMode(PORTA_BASE, 14, kPortMuxAlt4); /*!< ENET RMII0_CRS_DV/MII0_RXDV*/
mbed_official 20:620d381e7f4c 56 PORT_HAL_SetMuxMode(PORTA_BASE, 15, kPortMuxAlt4); /*!< ENET RMII0_TXEN/MII0_TXEN*/
mbed_official 20:620d381e7f4c 57 PORT_HAL_SetMuxMode(PORTA_BASE, 16, kPortMuxAlt4); /*!< ENET RMII0_TXD0/MII0_TXD0*/
mbed_official 20:620d381e7f4c 58 PORT_HAL_SetMuxMode(PORTA_BASE, 17, kPortMuxAlt4); /*!< ENET RMII0_TXD01/MII0_TXD1*/
mbed_official 20:620d381e7f4c 59 PORT_HAL_SetMuxMode(PORTB_BASE, 0, kPortMuxAlt4); /*!< ENET RMII0_MDIO/MII0_MDIO*/
mbed_official 20:620d381e7f4c 60 PORT_HAL_SetOpenDrainCmd(PORTB_BASE,0, true); /*!< ENET RMII0_MDC/MII0_MDC*/
mbed_official 10:ab9330955226 61
mbed_official 10:ab9330955226 62 // Added for FRDM-K64F
mbed_official 20:620d381e7f4c 63 PORT_HAL_SetPullMode(PORTB_BASE, 0, kPortPullUp);
mbed_official 20:620d381e7f4c 64 PORT_HAL_SetPullCmd(PORTB_BASE, 0, true);
mbed_official 10:ab9330955226 65
mbed_official 20:620d381e7f4c 66 PORT_HAL_SetMuxMode(PORTB_BASE, 1, kPortMuxAlt4);
mbed_official 26:32c3ccc5a8ef 67
mbed_official 10:ab9330955226 68 #if FSL_FEATURE_ENET_SUPPORT_PTP
mbed_official 20:620d381e7f4c 69 PORT_HAL_SetMuxMode(PORTC_BASE, (16 + ENET_TIMER_CHANNEL_NUM), kPortMuxAlt4); /* ENET ENET0_1588_TMR0*/
mbed_official 20:620d381e7f4c 70 PORT_HAL_SetDriveStrengthMode(PORTC_BASE, (16 + ENET_TIMER_CHANNEL_NUM), kPortHighDriveStrength);
mbed_official 10:ab9330955226 71 #endif
mbed_official 10:ab9330955226 72
mbed_official 10:ab9330955226 73 /* Open ENET clock gate*/
mbed_official 18:b15a12222890 74 CLOCK_SYS_EnableEnetClock( 0U);
mbed_official 10:ab9330955226 75
mbed_official 10:ab9330955226 76 /* Select the ptp timer outclk*/
mbed_official 18:b15a12222890 77 CLOCK_HAL_SetSource(g_simBaseAddr[0], kClockTimeSrc, 2);
mbed_official 10:ab9330955226 78 }
mbed_official 10:ab9330955226 79
mbed_official 10:ab9330955226 80 /*******************************************************************************
mbed_official 10:ab9330955226 81 * EOF
mbed_official 10:ab9330955226 82 ******************************************************************************/
mbed_official 10:ab9330955226 83
mbed_official 18:b15a12222890 84