PDK-6952: Board: Updated led diagnostic test for am64x evm
authorM V Pratap Reddy <x0257344@ti.com>
Fri, 27 Nov 2020 03:18:50 +0000 (08:48 +0530)
committerSivaraj R <sivaraj@ti.com>
Fri, 27 Nov 2020 06:28:09 +0000 (00:28 -0600)
 - User LED and industrial LED diag tests are validated on EVM HW

packages/ti/board/diag/led/src/led_test.c
packages/ti/board/diag/led_industrial/src/led_industrial_test.c
packages/ti/board/src/am64x_evm/include/board_cfg.h

index 6a850143d4ebc148682597c91054b5395cfc53e1..dc07e81898673f3344230c24b79dbbcc0d4c2d6a 100755 (executable)
@@ -295,13 +295,18 @@ static int8_t led_run_test(void)
                                                   gUserLeds[k],
                                                   GPIO_SIGNAL_LEVEL_LOW);
 #elif defined(SOC_AM64X)
-                        Board_i2cIoExpPinLevelSet(BOARD_I2C_IOEXP_DEVICE1_ADDR,
-                                                  THREE_PORT_IOEXP,
-                                                  PORTNUM_2,
-                                                  PIN_NUM_0,
-                                                  GPIO_SIGNAL_LEVEL_HIGH);
-
-                        GPIO_write(k, GPIO_PIN_VAL_HIGH);
+                        if(k == 0)
+                        {
+                            GPIO_write(k, GPIO_PIN_VAL_HIGH);
+                        }
+                        else
+                        {
+                            Board_i2cIoExpPinLevelSet(BOARD_I2C_IOEXP_DEVICE1_ADDR,
+                                                      THREE_PORT_IOEXP,
+                                                      PORTNUM_2,
+                                                      PIN_NUM_0,
+                                                      GPIO_SIGNAL_LEVEL_HIGH);
+                        }
 #else
                         GPIO_write(k, GPIO_PIN_VAL_HIGH);
 
@@ -315,13 +320,18 @@ static int8_t led_run_test(void)
                                                   gUserLeds[k],
                                                   GPIO_SIGNAL_LEVEL_HIGH);
 #elif defined(SOC_AM64X)
-                        Board_i2cIoExpPinLevelSet(BOARD_I2C_IOEXP_DEVICE1_ADDR,
-                                                  THREE_PORT_IOEXP,
-                                                  PORTNUM_2,
-                                                  PIN_NUM_0,
-                                                  GPIO_SIGNAL_LEVEL_LOW);
-
-                        GPIO_write(k, GPIO_PIN_VAL_LOW);
+                        if(k == 0)
+                        {
+                            GPIO_write(k, GPIO_PIN_VAL_LOW);
+                        }
+                        else
+                        {
+                            Board_i2cIoExpPinLevelSet(BOARD_I2C_IOEXP_DEVICE1_ADDR,
+                                                      THREE_PORT_IOEXP,
+                                                      PORTNUM_2,
+                                                      PIN_NUM_0,
+                                                      GPIO_SIGNAL_LEVEL_LOW);
+                        }
 #else
                         GPIO_write(k, GPIO_PIN_VAL_LOW);
 #endif
index 5a4e3c4e511ec7e85510ef94f0c1712ddeaca8db..b9fe723879386b7a896fa1accb683fbefdd75590 100755 (executable)
@@ -63,7 +63,7 @@ extern I2C_config_list I2C_config;
  *              -1 - in case of failure.
  *
  */
-#if (!(defined(SOC_AM65XX) || defined(SOC_AM64X)))
+#if !(defined(SOC_AM65XX))
 void led_write(I2C_Handle handle, uint8_t signalLevelData)
 {
     uint8_t tx[2];
@@ -89,7 +89,7 @@ void led_write(I2C_Handle handle, uint8_t signalLevelData)
  *  \param    delayValue          [IN]   Delay count.
  *
  */
-#if ((!(defined(SOC_AM65XX) || defined(SOC_AM64X))) || (!(defined(SOC_K2G))))
+#if ((!(defined(SOC_AM65XX))) || (!(defined(SOC_K2G))))
 void BoardDiag_AppDelay(uint32_t delayVal)
 {
     volatile uint32_t delay = 0;
@@ -116,7 +116,7 @@ static int8_t BoardDiag_i2c_slave_device_led_test(void)
     uint8_t writeRegData = 0;
     int8_t index;
 
-#if (!(defined(SOC_AM65XX) || defined(SOC_AM64X)))
+#if (!(defined(SOC_AM65XX)))
     I2C_Params i2cParams;
     I2C_HwAttrs i2cConfig;
     I2C_Handle handle = NULL;
@@ -152,18 +152,11 @@ static int8_t BoardDiag_i2c_slave_device_led_test(void)
         {
             if((writeRegData & 0xff) == 0)
                  writeRegData = 0x80;
-#if (!(defined(SOC_AM65XX) || defined(SOC_AM64X)))
+#if !defined(SOC_AM65XX)
             led_write(handle, writeRegData);
-#else
-#if defined(SOC_AM64X)
-            ret = Board_i2cIoExpWritePort(BOARD_I2C_IOEXP_DEVICE2_ADDR,
-                                          THREE_PORT_IOEXP,
-                                          PORTNUM_0,
-                                          writeRegData);
 #else
             ret = Board_i2cIoExpWritePort(BOARD_I2C_IOEXP_DEVICE1_ADDR,
                                           PORTNUM_NONE, writeRegData);
-#endif
             if(ret != 0)
             {
                 UART_printf("Writing on to the IO expander port "
@@ -248,7 +241,7 @@ static int8_t BoardDiag_i2c_slave_device_led_test(void)
 
 #endif
 
-#if defined(SOC_AM65XX) || defined(SOC_AM64X)
+#if defined(SOC_AM65XX)
     Board_i2cIoExpDeInit();
 #endif
 
@@ -374,10 +367,6 @@ int main(void)
     enableMAINI2C(0, CSL_I2C0_CFG_BASE);
 #endif
 
-#if defined(SOC_AM64X)
-    enableMAINI2C(BOARD_I2C_IOEXP_DEVICE1_INSTANCE, CSL_I2C1_CFG_BASE);
-#endif
-
 #ifdef SOC_K2G
     DIAG_IntrInit();
 #endif
index 20b9c27108474216f4961ed0ee9d1810de3c995e..6448f6ca14cc69c7360cbf1472ebad826aea6099 100644 (file)
@@ -130,11 +130,13 @@ extern "C" {
 #define BOARD_I2C_IOEXP_DEVICE5_INSTANCE                (1U)\r
 #define BOARD_I2C_AUDIO_IOEXP_DEVICE_INSTANCE           (3U)\r
 #define BOARD_I2C_VIDEO_IOEXP_DEVICE_INSTANCE           (0U)\r
+#define BOARD_I2C_LED_INSTANCE                          (1U)\r
 \r
 /* I2C IO Expander Slave devices */\r
 #define BOARD_I2C_IOEXP_DEVICE1_ADDR                    (0x22U)\r
 /* Used to configure Ethernet PHY LED's */\r
 #define BOARD_I2C_IOEXP_DEVICE2_ADDR                    (0x60U)\r
+#define BOARD_I2C_LED_ADDR                              (0x60U)\r
 \r
 /* OSPI instance number */\r
 #define BOARD_OSPI_INSTANCE                             (0)\r
@@ -271,7 +273,7 @@ extern "C" {
 #define BOARD_GPMC_INSTANCE                             (0U)\r
 \r
 /* Number of LEDS connected to GPIO */\r
-#define BOARD_GPIO_LED_NUM                              (1U)\r
+#define BOARD_GPIO_LED_NUM                              (2U)\r
 \r
 /* SPI instance connected to EEPROM */\r
 #define BOARD_EEPROM_SPI0_PORT                          (0U)\r