]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/pdk.git/blob - packages/ti/drv/spi/test/src/am572x/SPI_idkAM572x_board.c
[TI Clang Migration][Phase 2]
[processor-sdk/pdk.git] / packages / ti / drv / spi / test / src / am572x / SPI_idkAM572x_board.c
1 /**
2  *  \file   SPI_idkAM572x_board.c
3  *
4  *  \brief  AM572x IDK Board specific GPIO parameters.
5  *
6  *   This file contains the GPIO hardware parameters specific to board.
7  */
9 /*
10  * Copyright (C) 2014 - 2017 Texas Instruments Incorporated - http://www.ti.com/
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  *
16  * Redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer.
18  *
19  * Redistributions in binary form must reproduce the above copyright
20  * notice, this list of conditions and the following disclaimer in the
21  * documentation and/or other materials provided with the
22  * distribution.
23  *
24  * Neither the name of Texas Instruments Incorporated nor the names of
25  * its contributors may be used to endorse or promote products derived
26  * from this software without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39  *
40  */
42 #include <ti/drv/gpio/GPIO.h>
43 #include <ti/drv/gpio/soc/GPIO_v1.h>
44 #include <stdio.h>
45 #include <ti/csl/soc.h>
47 /* control module register definitions */
48 #define CTRL_CORE_PAD_VIN1A_D15                     (0x130U)      //GPIO3_19
49 #define CTRL_CORE_PAD_VIN1A_D15_PILLUP              (0x20000 | 0x0E)
51 #define HW_WR_REG32(addr, data)   *(unsigned int*)(addr) =(unsigned int)(data)
54 /* Port and pin number mask for GPIO Load pin.
55    Bits 7-0: Pin number  and Bits 15-8: Port number */
56 #define AM57X_IDK_GPIO_LD_PIN    (0x0313)
59 /* GPIO Driver board specific pin configuration structure */
60 GPIO_PinConfig gpioPinConfigs[] = {
61     /* Output pin : AM57X_IDK_YEL_GRN */
62     AM57X_IDK_GPIO_LD_PIN | GPIO_CFG_OUTPUT
63 };
65 /* GPIO Driver call back functions */
66 GPIO_CallbackFxn gpioCallbackFunctions[] = {
67     NULL
68 };
70 /* GPIO Driver configuration structure */
71 GPIO_v1_Config GPIO_v1_config = {
72     gpioPinConfigs,
73     gpioCallbackFunctions,
74     sizeof(gpioPinConfigs) / sizeof(GPIO_PinConfig),
75     sizeof(gpioCallbackFunctions) / sizeof(GPIO_CallbackFxn),
76     0,
77     };
79 /* Serializer data */
80 char serializerData[1] = {0x01};
82 void MCSPI_Board_crossbarInit(void)
83 {
84     /* SPI3 Clock Enable */
85     HW_WR_REG32(0x4A009800, 0x00000002);
87     /* GPIO3 Clock Enable */
88     HW_WR_REG32(0x4A009768, 0x00000102);
90     /* GPIO3_19 */
91     HW_WR_REG32((SOC_CORE_PAD_IO_REGISTERS_BASE + CTRL_CORE_PAD_VIN1A_D15),
92         (CTRL_CORE_PAD_VIN1A_D15_PILLUP));
94 #ifdef C66X
95     /* Configure xbar connect for MCSPI3: DSP_IRQ_43 (reserved) mapped to MCSPI3 intr */
96     CSL_xbarIrqConfigure (CSL_XBAR_IRQ_CPU_ID_DSP1,
97                           CSL_XBAR_INST_DSP1_IRQ_43, /* should match with C66 intc eventId in hwAttr */
98                           CSL_XBAR_MCSPI3_IRQ);
99 #endif
101 #if ((__ARM_ARCH == 7) && (__ARM_ARCH_PROFILE == 'M'))
102     /* Configure xbar connect for MCSPI3: IPU1_IRQ_60 (reserved) mapped to MCSPI3 intr */
103     CSL_xbarIrqConfigure (CSL_XBAR_IRQ_CPU_ID_IPU1,
104                           CSL_XBAR_INST_IPU1_IRQ_60, /* should match with M4 intNum in hwAttr */
105                           CSL_XBAR_MCSPI3_IRQ);
106 #endif