PDK-5152: Board: Enabled push button diagnostic test support for am64x evm
authorM V Pratap Reddy <x0257344@ti.com>
Mon, 19 Oct 2020 11:22:53 +0000 (16:52 +0530)
committerSivaraj R <sivaraj@ti.com>
Mon, 19 Oct 2020 13:28:50 +0000 (08:28 -0500)
packages/ti/board/diag/board_diag_component.mk
packages/ti/board/diag/button/build/am64x_evm/GPIO_Button_config.c [new file with mode: 0755]
packages/ti/board/diag/button/build/makefile
packages/ti/board/diag/button/src/button_test.c
packages/ti/board/diag/button/src/button_test.h

index 67d8d426985b1b7c7aabcb861951f9f2162dfe4c..5a90c42c8e0aa5c109edbd184b78b96f0178a479 100755 (executable)
@@ -211,7 +211,7 @@ export board_diag_button_BOARD_DEPENDENCY = yes
 export board_diag_button_CORE_DEPENDENCY = yes
 board_diag_button_PKG_LIST = board_diag_button
 board_diag_button_INCLUDE = $(board_diag_button_PATH)
-board_diag_button_BOARDLIST = am65xx_evm am65xx_idk tpr12_evm
+board_diag_button_BOARDLIST = am65xx_evm am65xx_idk tpr12_evm am64x_evm
 export board_diag_button_$(SOC)_CORELIST = $(board_diag_$(SOC)_CORELIST)
 export board_diag_button_SBL_APPIMAGEGEN = $(board_diag_APPIMAGEGEN_CTRL)
 board_diag_EXAMPLE_LIST += board_diag_button
diff --git a/packages/ti/board/diag/button/build/am64x_evm/GPIO_Button_config.c b/packages/ti/board/diag/button/build/am64x_evm/GPIO_Button_config.c
new file mode 100755 (executable)
index 0000000..15e02e6
--- /dev/null
@@ -0,0 +1,63 @@
+/*\r
+ * Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ *\r
+ * Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the\r
+ * distribution.\r
+ *\r
+ * Neither the name of Texas Instruments Incorporated nor the names of\r
+ * its contributors may be used to endorse or promote products derived\r
+ * from this software without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ *\r
+ */\r
+\r
+#include <stdio.h>\r
+#include <ti/drv/gpio/GPIO.h>\r
+#include <ti/csl/soc.h>\r
+#include <ti/drv/gpio/soc/GPIO_soc.h>\r
+\r
+#include <ti/board/board.h>\r
+\r
+#define BOARD_DIAG_PUSH_BUTTON0                       (0x012B) /* Port1 & Pin43 */\r
+#define BOARD_DIAG_PUSH_BUTTON1                       (0x0006) /* Port0 & pin6 */\r
+\r
+/* GPIO Driver board specific pin configuration structure */\r
+GPIO_PinConfig gpioPinConfigs[] = {\r
+    BOARD_DIAG_PUSH_BUTTON0 | GPIO_CFG_INPUT | GPIO_CFG_IN_INT_RISING,\r
+    BOARD_DIAG_PUSH_BUTTON1 | GPIO_CFG_INPUT | GPIO_CFG_IN_INT_RISING\r
+};\r
+\r
+/* GPIO Driver call back functions */\r
+GPIO_CallbackFxn gpioCallbackFunctions[] = {\r
+    NULL,\r
+    NULL\r
+};\r
+\r
+/* GPIO Driver configuration structure */\r
+GPIO_v0_Config GPIO_v0_config = {\r
+    gpioPinConfigs,\r
+    gpioCallbackFunctions,\r
+    sizeof(gpioPinConfigs) / sizeof(GPIO_PinConfig),\r
+    sizeof(gpioCallbackFunctions) / sizeof(GPIO_CallbackFxn),\r
+    0,\r
+};\r
index 2c23f9dc7056a26d0a6a27accd1afb1bd15e0bca..6694f822d02e6cdf63784d00e55877b7decd13fb 100755 (executable)
@@ -78,7 +78,7 @@ PACKAGE_SRCS_COMMON += ../../create_sd.bat ../../create_sd.sh
 
 SRCS_COMMON += button_test.c diag_common_cfg.c
 
-ifeq ($(BOARD), $(filter $(BOARD), am65xx_evm am65xx_idk tpr12_evm))
+ifeq ($(BOARD), $(filter $(BOARD), am65xx_evm am65xx_idk tpr12_evm am64x_evm))
 SRCS_COMMON += GPIO_Button_config.c
 endif
 
index ead891c65fd1935be8bad85515c247aaf442858c..66d9e235e73607e3d64430aba25253b83e33a7b7 100755 (executable)
  *             On a key press the diagnostic test sequentially moves to the
  *             other buttons in the keypad.
  *
- *  Supported SoCs: AM335x, AM437x, AM65xx & TPR12.
+ *  Supported SoCs: AM335x, AM437x, AM65xx, TPR12,AM64x.
  *
  *  Supported Platforms: skAM335x, skAM437x, evmAM437x am65xx_evm, am65xx_idk,
- *                       tpr12_evm.
+ *                       tpr12_evm,am64x_evm.
  *
  */
 
@@ -75,7 +75,7 @@ gpioInfo_t KeyScn[4];
 int main(void)
 {
     int status = S_PASS;
-#if (defined(SOC_AM65XX) || defined(SOC_TPR12))
+#if (defined(SOC_AM65XX) || defined(SOC_TPR12) || defined(SOC_AM64X))
     Board_IDInfo_v2 info;
 #else
     Board_IDInfo boardInfo;
@@ -100,14 +100,14 @@ int main(void)
     UART_printf  ("*                 Button Test               *\n");
     UART_printf  ("*********************************************\n");
 
-#if (defined(SOC_AM65XX) || defined(SOC_TPR12))
+#if (defined(SOC_AM65XX) || defined(SOC_TPR12) || defined(SOC_AM64X))
     Board_getIDInfo_v2(&info, BOARD_I2C_EEPROM_ADDR);
 #else
     Board_getIDInfo(&boardInfo);
 #endif
 
     /* Update the KeyPad information. */
-#if (defined(SOC_AM65XX) || defined(SOC_TPR12))
+#if (defined(SOC_AM65XX) || defined(SOC_TPR12) || defined(SOC_AM64X))
     status = BoardDiag_GetKeyPadInfo(info.boardInfo.boardName, &boardKeyPad);
 #else
     status = BoardDiag_GetKeyPadInfo(boardInfo.boardName, &boardKeyPad);
@@ -181,6 +181,14 @@ int32_t BoardDiag_ButtonTest(keyPadInfo_t *pBoardKeyPad)
     gpioCfg.baseAddr = CSL_WKUP_GPIO0_BASE;
     GPIO_socSetInitCfg(0, &gpioCfg);
     GPIO_init();
+#elif defined(SOC_AM64X)
+    GPIO_init();
+
+    GPIO_v0_HwAttrs gpioCfg;
+    GPIO_socGetInitCfg(1, &gpioCfg);
+    gpioCfg.baseAddr = CSL_MCU_GPIO0_BASE;
+    GPIO_socSetInitCfg(1, &gpioCfg);
+    GPIO_init();
 #else
 #if defined(SOC_TPR12)
     GPIO_v2_updateConfig(&GPIO_v2_config);
@@ -238,7 +246,7 @@ int32_t BoardDiag_KeyPressCheck(keyPadInfo_t *pBoardKeyPad,
     UART_printf(  "Button SW %2d            ", button);
     UART_printf("WAIT      Waiting for button press");
 
-#if (defined(SOC_AM65XX) || defined(SOC_TPR12))
+#if (defined(SOC_AM65XX) || defined(SOC_TPR12) || defined(SOC_AM64X))
     do
     {
 #if defined(SOC_TPR12)
@@ -278,7 +286,7 @@ int32_t BoardDiag_KeyPressCheck(keyPadInfo_t *pBoardKeyPad,
 
     UART_printf("Button SW %2d            ", button);
 
-#if (!(defined(SOC_AM65XX) || defined(SOC_TPR12)))
+#if (!(defined(SOC_AM65XX) || defined(SOC_TPR12) || defined(SOC_AM64X)))
     if(level != 1)
     {
         UART_printf("FAIL                                            \n");
@@ -425,6 +433,26 @@ int32_t BoardDiag_GetKeyPadInfo(char *pBoardName, keyPadInfo_t *pBoardKeyPad)
 
     }
 #endif
+    /* Check if the board is EVM AM64X by comparing the string read from
+       EEPROM. */
+    else if (strncmp("AM64-COMP", pBoardName, BOARD_NAME_LENGTH) == 0U)
+    {
+
+        pBoardKeyPad->buttonSet = 1;
+        pBoardKeyPad->scnKeyNum = 2;
+        pBoardKeyPad->pwrKeyNum = 1;
+        pBoardKeyPad->pwrKeyIdx = 0;
+        buttonStart[0]=5;
+        buttonOffset[0]=1;
+        powerOffset[0]=1;
+
+        /* Update the GPIO data for keypad inputs. */
+        KeyScn[0].instance=1;
+        KeyScn[0].pin=43;
+
+        KeyScn[1].instance=0;
+        KeyScn[1].pin=6;
+    }
     else
     {
         status = E_FAIL;
index da4f4396bdeb9a1483aa0ab782907f16e10b219a..393567e3637337c3eaca01cb4c83f8266d2bd6c8 100755 (executable)
@@ -47,7 +47,7 @@
 #include <string.h>
 
 #include <ti/drv/gpio/GPIO.h>
-#if (!(defined(SOC_AM65XX)))
+#if (!(defined(SOC_AM65XX) || defined(SOC_AM64X)))
 #include <ti/drv/gpio/soc/GPIO_soc.h>
 #else
 #include <ti/drv/gpio/soc/GPIO_soc.h>
 
 #include <ti/drv/uart/UART_stdio.h>
 #include <ti/csl/soc.h>
-#if (!(defined(SOC_AM65XX) || defined(SOC_TPR12)))
+#if (!(defined(SOC_AM65XX) || defined(SOC_TPR12) || defined(SOC_AM64X)))
 #include <ti/starterware/include/interrupt.h>
 #endif
 
-#if (defined(SOC_AM65XX) || defined(SOC_TPR12))
+#if (defined(SOC_AM65XX) || defined(SOC_TPR12) || defined(SOC_AM64X))
 #include "diag_common_cfg.h"
 #endif