pin_mux.c 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * The Clear BSD License
  3. * Copyright (c) 2016, Freescale Semiconductor, Inc.
  4. * Copyright 2016-2017 NXP
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without modification,
  8. * are permitted (subject to the limitations in the disclaimer below) provided
  9. * that the following conditions are met:
  10. *
  11. * o Redistributions of source code must retain the above copyright notice, this list
  12. * of conditions and the following disclaimer.
  13. *
  14. * o Redistributions in binary form must reproduce the above copyright notice, this
  15. * list of conditions and the following disclaimer in the documentation and/or
  16. * other materials provided with the distribution.
  17. *
  18. * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
  19. * contributors may be used to endorse or promote products derived from this
  20. * software without specific prior written permission.
  21. *
  22. * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  24. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  25. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  26. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  27. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  28. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  29. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  30. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  31. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  32. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. */
  34. /* clang-format off */
  35. /*
  36. * TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
  37. !!GlobalInfo
  38. product: Pins v3.0
  39. processor: LPC54114J256
  40. mcu_data: ksdk2_0
  41. processor_version: 0.0.13
  42. * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
  43. */
  44. /* clang-format on */
  45. #include "fsl_common.h"
  46. #include "fsl_iocon.h"
  47. #include "pin_mux.h"
  48. /* FUNCTION ************************************************************************************************************
  49. *
  50. * Function Name : BOARD_InitBootPins
  51. * Description : Calls initialization functions.
  52. *
  53. * END ****************************************************************************************************************/
  54. void BOARD_InitBootPins(void)
  55. {
  56. BOARD_InitPins();
  57. }
  58. /* clang-format off */
  59. /*
  60. * TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
  61. BOARD_InitPins:
  62. - options: {callFromInitBoot: 'true', coreID: cm4, enableClock: 'true'}
  63. - pin_list:
  64. - {pin_num: '31', peripheral: FLEXCOMM0, signal: RXD_SDA_MOSI, pin_signal: PIO0_0/FC0_RXD_SDA_MOSI/FC3_CTS_SDA_SSEL0/CTIMER0_CAP0/SCT0_OUT3, mode: inactive, invert: disabled,
  65. glitch_filter: disabled, slew_rate: standard, open_drain: disabled}
  66. - {pin_num: '32', peripheral: FLEXCOMM0, signal: TXD_SCL_MISO, pin_signal: PIO0_1/FC0_TXD_SCL_MISO/FC3_RTS_SCL_SSEL1/CTIMER0_CAP1/SCT0_OUT1, mode: inactive, invert: disabled,
  67. glitch_filter: disabled, slew_rate: standard, open_drain: disabled}
  68. * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
  69. */
  70. /* clang-format on */
  71. /* FUNCTION ************************************************************************************************************
  72. *
  73. * Function Name : BOARD_InitPins
  74. * Description : Configures pin routing and optionally pin electrical features.
  75. *
  76. * END ****************************************************************************************************************/
  77. /* Function assigned for the undefined */
  78. void BOARD_InitPins(void)
  79. {
  80. /* Enables the clock for the IOCON block. 0 = Disable; 1 = Enable.: 0x01u */
  81. CLOCK_EnableClock(kCLOCK_Iocon);
  82. const uint32_t port0_pin0_config = (/* Pin is configured as FC0_RXD_SDA_MOSI */
  83. IOCON_PIO_FUNC1 |
  84. /* No addition pin function */
  85. IOCON_PIO_MODE_INACT |
  86. /* Input function is not inverted */
  87. IOCON_PIO_INV_DI |
  88. /* Enables digital function */
  89. IOCON_PIO_DIGITAL_EN |
  90. /* Input filter disabled */
  91. IOCON_PIO_INPFILT_OFF |
  92. /* Standard mode, output slew rate control is enabled */
  93. IOCON_PIO_SLEW_STANDARD |
  94. /* Open drain is disabled */
  95. IOCON_PIO_OPENDRAIN_DI);
  96. /* PORT0 PIN0 (coords: 31) is configured as FC0_RXD_SDA_MOSI */
  97. IOCON_PinMuxSet(IOCON, 0U, 0U, port0_pin0_config);
  98. const uint32_t port0_pin1_config = (/* Pin is configured as FC0_TXD_SCL_MISO */
  99. IOCON_PIO_FUNC1 |
  100. /* No addition pin function */
  101. IOCON_PIO_MODE_INACT |
  102. /* Input function is not inverted */
  103. IOCON_PIO_INV_DI |
  104. /* Enables digital function */
  105. IOCON_PIO_DIGITAL_EN |
  106. /* Input filter disabled */
  107. IOCON_PIO_INPFILT_OFF |
  108. /* Standard mode, output slew rate control is enabled */
  109. IOCON_PIO_SLEW_STANDARD |
  110. /* Open drain is disabled */
  111. IOCON_PIO_OPENDRAIN_DI);
  112. /* PORT0 PIN1 (coords: 32) is configured as FC0_TXD_SCL_MISO */
  113. IOCON_PinMuxSet(IOCON, 0U, 1U, port0_pin1_config);
  114. }
  115. /***********************************************************************************************************************
  116. * EOF
  117. **********************************************************************************************************************/