lab practicals

Committer:
dewantkatare
Date:
Mon Sep 23 22:20:13 2019 +0000
Revision:
34:bdc93b5c3c52
Parent:
31:da93f0f73711
TCP ECHO, Ethernet onterface

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 31:da93f0f73711 31 #include "fsl_port.h"
mbed_official 10:ab9330955226 32
mbed_official 10:ab9330955226 33 /*******************************************************************************
mbed_official 10:ab9330955226 34 * Code
mbed_official 10:ab9330955226 35 ******************************************************************************/
mbed_official 10:ab9330955226 36 void k64f_init_eth_hardware(void)
mbed_official 10:ab9330955226 37 {
mbed_official 31:da93f0f73711 38 port_pin_config_t configENET = {0};
mbed_official 31:da93f0f73711 39
mbed_official 31:da93f0f73711 40 /* Disable MPU. */
mbed_official 31:da93f0f73711 41 MPU->CESR &= ~MPU_CESR_VLD_MASK;
mbed_official 10:ab9330955226 42
mbed_official 31:da93f0f73711 43 CLOCK_EnableClock(kCLOCK_PortC);
mbed_official 31:da93f0f73711 44 /* Affects PORTC_PCR16 register */
mbed_official 31:da93f0f73711 45 PORT_SetPinMux(PORTC, 16u, kPORT_MuxAlt4);
mbed_official 31:da93f0f73711 46 /* Affects PORTC_PCR17 register */
mbed_official 31:da93f0f73711 47 PORT_SetPinMux(PORTC, 17u, kPORT_MuxAlt4);
mbed_official 31:da93f0f73711 48 /* Affects PORTC_PCR18 register */
mbed_official 31:da93f0f73711 49 PORT_SetPinMux(PORTC, 18u, kPORT_MuxAlt4);
mbed_official 31:da93f0f73711 50 /* Affects PORTC_PCR19 register */
mbed_official 31:da93f0f73711 51 PORT_SetPinMux(PORTC, 19u, kPORT_MuxAlt4);
mbed_official 31:da93f0f73711 52 /* Affects PORTB_PCR1 register */
mbed_official 31:da93f0f73711 53 PORT_SetPinMux(PORTB, 1u, kPORT_MuxAlt4);
mbed_official 10:ab9330955226 54
mbed_official 31:da93f0f73711 55 configENET.openDrainEnable = kPORT_OpenDrainEnable;
mbed_official 31:da93f0f73711 56 configENET.mux = kPORT_MuxAlt4;
mbed_official 31:da93f0f73711 57 configENET.pullSelect = kPORT_PullUp;
mbed_official 31:da93f0f73711 58 /* Ungate the port clock */
mbed_official 31:da93f0f73711 59 CLOCK_EnableClock(kCLOCK_PortA);
mbed_official 31:da93f0f73711 60 /* Affects PORTB_PCR0 register */
mbed_official 31:da93f0f73711 61 PORT_SetPinConfig(PORTB, 0u, &configENET);
mbed_official 10:ab9330955226 62
mbed_official 31:da93f0f73711 63 /* Affects PORTA_PCR13 register */
mbed_official 31:da93f0f73711 64 PORT_SetPinMux(PORTA, 13u, kPORT_MuxAlt4);
mbed_official 31:da93f0f73711 65 /* Affects PORTA_PCR12 register */
mbed_official 31:da93f0f73711 66 PORT_SetPinMux(PORTA, 12u, kPORT_MuxAlt4);
mbed_official 31:da93f0f73711 67 /* Affects PORTA_PCR14 register */
mbed_official 31:da93f0f73711 68 PORT_SetPinMux(PORTA, 14u, kPORT_MuxAlt4);
mbed_official 31:da93f0f73711 69 /* Affects PORTA_PCR5 register */
mbed_official 31:da93f0f73711 70 PORT_SetPinMux(PORTA, 5u, kPORT_MuxAlt4);
mbed_official 31:da93f0f73711 71 /* Affects PORTA_PCR16 register */
mbed_official 31:da93f0f73711 72 PORT_SetPinMux(PORTA, 16u, kPORT_MuxAlt4);
mbed_official 31:da93f0f73711 73 /* Affects PORTA_PCR17 register */
mbed_official 31:da93f0f73711 74 PORT_SetPinMux(PORTA, 17u, kPORT_MuxAlt4);
mbed_official 31:da93f0f73711 75 /* Affects PORTA_PCR15 register */
mbed_official 31:da93f0f73711 76 PORT_SetPinMux(PORTA, 15u, kPORT_MuxAlt4);
mbed_official 31:da93f0f73711 77 /* Affects PORTA_PCR28 register */
mbed_official 31:da93f0f73711 78 PORT_SetPinMux(PORTA, 28u, kPORT_MuxAlt4);
mbed_official 10:ab9330955226 79
mbed_official 31:da93f0f73711 80 /* Select the Ethernet timestamp clock source */
mbed_official 31:da93f0f73711 81 CLOCK_SetEnetTime0Clock(0x2);
mbed_official 10:ab9330955226 82 }
mbed_official 10:ab9330955226 83
mbed_official 10:ab9330955226 84 /*******************************************************************************
mbed_official 10:ab9330955226 85 * EOF
mbed_official 10:ab9330955226 86 ******************************************************************************/
mbed_official 10:ab9330955226 87
mbed_official 18:b15a12222890 88