lab practicals

Committer:
mbed_official
Date:
Mon Sep 22 17:30:30 2014 +0100
Revision:
20:620d381e7f4c
Parent:
18:b15a12222890
Child:
26:32c3ccc5a8ef
Synchronized with git revision cb3999ca5e34d491101071a32bfc0916f5a77fe7

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

[NET, HAL] K64F - update files to use address of enet peripheral (not instance as required by KSDK v1.0)

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 10:ab9330955226 67 /* Configure GPIO for MII interface */
mbed_official 20:620d381e7f4c 68 PORT_HAL_SetMuxMode(PORTA_BASE, 9, kPortMuxAlt4); /*!< ENET MII0_RXD3*/
mbed_official 20:620d381e7f4c 69 PORT_HAL_SetMuxMode(PORTA_BASE, 10, kPortMuxAlt4); /*!< ENET MII0_RXD2*/
mbed_official 20:620d381e7f4c 70 PORT_HAL_SetMuxMode(PORTA_BASE, 11, kPortMuxAlt4); /*!< ENET MII0_RXCLK*/
mbed_official 20:620d381e7f4c 71 PORT_HAL_SetMuxMode(PORTA_BASE, 24, kPortMuxAlt4); /*!< ENET MII0_TXD2*/
mbed_official 20:620d381e7f4c 72 PORT_HAL_SetMuxMode(PORTA_BASE, 25, kPortMuxAlt4); /*!< ENET MII0_TXCLK*/
mbed_official 20:620d381e7f4c 73 PORT_HAL_SetMuxMode(PORTA_BASE, 26, kPortMuxAlt4); /*!< ENET MII0_TXD3*/
mbed_official 20:620d381e7f4c 74 PORT_HAL_SetMuxMode(PORTA_BASE, 27, kPortMuxAlt4); /*!< ENET MII0_CRS*/
mbed_official 20:620d381e7f4c 75 PORT_HAL_SetMuxMode(PORTA_BASE, 28, kPortMuxAlt4); /*!< ENET MII0_TXER*/
mbed_official 20:620d381e7f4c 76 PORT_HAL_SetMuxMode(PORTA_BASE, 29, kPortMuxAlt4); /*!< ENET MII0_COL*/
mbed_official 10:ab9330955226 77 #if FSL_FEATURE_ENET_SUPPORT_PTP
mbed_official 20:620d381e7f4c 78 PORT_HAL_SetMuxMode(PORTC_BASE, (16 + ENET_TIMER_CHANNEL_NUM), kPortMuxAlt4); /* ENET ENET0_1588_TMR0*/
mbed_official 20:620d381e7f4c 79 PORT_HAL_SetDriveStrengthMode(PORTC_BASE, (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