Statistics
| Branch: | Tag: | Revision:

mongoose / examples / NXP_K64 / pin_mux.c @ eaef5bd1

History | View | Annotate | Download (3.98 KB)

1
/* clang-format off */
2
/*
3
 * Copyright (c) 2015, Freescale Semiconductor, Inc.
4
 * All rights reserved.
5
 *
6
 * Redistribution and use in source and binary forms, with or without modification,
7
 * are permitted provided that the following conditions are met:
8
 *
9
 * o Redistributions of source code must retain the above copyright notice, this list
10
 *   of conditions and the following disclaimer.
11
 *
12
 * o Redistributions in binary form must reproduce the above copyright notice, this
13
 *   list of conditions and the following disclaimer in the documentation and/or
14
 *   other materials provided with the distribution.
15
 *
16
 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
17
 *   contributors may be used to endorse or promote products derived from this
18
 *   software without specific prior written permission.
19
 *
20
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
24
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
 */
31

    
32
#include "fsl_device_registers.h"
33
#include "fsl_common.h"
34
#include "fsl_port.h"
35
#include "pin_mux.h"
36

    
37
/*******************************************************************************
38
 * Code
39
 ******************************************************************************/
40
void BOARD_InitPins(void)
41
{
42
    port_pin_config_t configENET = {0};
43

    
44
    /* Initialize UART0 pins below */
45
    /* Ungate the port clock */
46
    /* Ungate the port clock */
47
    CLOCK_EnableClock(kCLOCK_PortB);
48
    /* Affects PORTB_PCR16 register */
49
    PORT_SetPinMux(PORTB, 16u, kPORT_MuxAlt3);
50
    /* Affects PORTB_PCR17 register */
51
    PORT_SetPinMux(PORTB, 17u, kPORT_MuxAlt3);
52

    
53
    CLOCK_EnableClock(kCLOCK_PortC);
54
    /* Affects PORTC_PCR16 register */
55
    PORT_SetPinMux(PORTC, 16u, kPORT_MuxAlt4);
56
    /* Affects PORTC_PCR17 register */
57
    PORT_SetPinMux(PORTC, 17u, kPORT_MuxAlt4);
58
    /* Affects PORTC_PCR18 register */
59
    PORT_SetPinMux(PORTC, 18u, kPORT_MuxAlt4);
60
    /* Affects PORTC_PCR19 register */
61
    PORT_SetPinMux(PORTC, 19u, kPORT_MuxAlt4);
62
    /* Affects PORTB_PCR1 register */
63
    PORT_SetPinMux(PORTB, 1u, kPORT_MuxAlt4);
64

    
65
    configENET.openDrainEnable = kPORT_OpenDrainEnable;
66
    configENET.mux = kPORT_MuxAlt4;
67
    configENET.pullSelect = kPORT_PullUp;
68
    /* Ungate the port clock */
69
    CLOCK_EnableClock(kCLOCK_PortA);
70
    /* Affects PORTB_PCR0 register */
71
    PORT_SetPinConfig(PORTB, 0u, &configENET);
72

    
73
    /* Affects PORTA_PCR13 register */
74
    PORT_SetPinMux(PORTA, 13u, kPORT_MuxAlt4);
75
    /* Affects PORTA_PCR12 register */
76
    PORT_SetPinMux(PORTA, 12u, kPORT_MuxAlt4);
77
    /* Affects PORTA_PCR14 register */
78
    PORT_SetPinMux(PORTA, 14u, kPORT_MuxAlt4);
79
    /* Affects PORTA_PCR5 register */
80
    PORT_SetPinMux(PORTA, 5u, kPORT_MuxAlt4);
81
    /* Affects PORTA_PCR16 register */
82
    PORT_SetPinMux(PORTA, 16u, kPORT_MuxAlt4);
83
    /* Affects PORTA_PCR17 register */
84
    PORT_SetPinMux(PORTA, 17u, kPORT_MuxAlt4);
85
    /* Affects PORTA_PCR15 register */
86
    PORT_SetPinMux(PORTA, 15u, kPORT_MuxAlt4);
87
    /* Affects PORTA_PCR28 register */
88
    PORT_SetPinMux(PORTA, 28u, kPORT_MuxAlt4);
89

    
90
    /* Enable SW port clock */
91
    CLOCK_EnableClock(kCLOCK_PortA);
92
    /* Affects PORTA_PCR4 register */
93
    port_pin_config_t config = {0};
94
    config.pullSelect = kPORT_PullUp;
95
    config.mux = kPORT_MuxAsGpio;
96
    PORT_SetPinConfig(PORTA, 4U, &config);
97
}