]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/i2c-lld.git/commitdiff
[I2C Utility]Added initial draft for I2C Utility
authorVivek Dhande <a0132295@ti.com>
Thu, 9 May 2019 11:52:55 +0000 (17:22 +0530)
committerVivek Dhande <a0132295@ti.com>
Thu, 9 May 2019 15:24:53 +0000 (20:54 +0530)
- Development in progress
- currently only compilable but not tested/verified on the board

Signed-off-by: Vivek Dhande <a0132295@ti.com>
example/i2c_utility/i2c_utility_main.c [new file with mode: 0755]
example/i2c_utility/makefile [new file with mode: 0755]
i2c_component.mk

diff --git a/example/i2c_utility/i2c_utility_main.c b/example/i2c_utility/i2c_utility_main.c
new file mode 100755 (executable)
index 0000000..c3dc140
--- /dev/null
@@ -0,0 +1,670 @@
+/*
+ *   Copyright (c) Texas Instruments Incorporated 2019
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/**
+ *  \file     i2c_utility_main.c.c
+ *
+ *  \brief    This file contains I2C Utility code.
+ *
+ *  \details  Provides basic utility APIs to read/write over I2C bus.
+ *
+ */
+
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ti/csl/csl_types.h>
+#include <ti/csl/soc.h>
+#include <ti/csl/hw_types.h>
+#include <ti/csl/csl_timer.h>
+#include <ti/csl/example/utils/uart_console/inc/uartConfig.h>
+#include <ti/csl/cslr_synctimer.h>
+#include <ti/drv/i2c/I2C.h>
+#include <ti/drv/i2c/soc/I2C_soc.h>
+#include <ti/board/src/devices/common/common.h>
+#include <ti/board/board.h>
+/* ========================================================================== */
+/*                                Macros                                      */
+/* ========================================================================== */
+/**< Number of channels */
+#define APP_I2C_INST_MAX                                    ((uint32_t)2U)
+/**< Number of addressing and data modes */
+#define APP_I2C_MODES_MAX                                   ((uint32_t)4U)
+/**< Maximum number of register read/write support in one go */
+#define APP_I2C_MAX_REG_RD_WR                               ((uint32_t)0x100)
+/* ========================================================================== */
+/*                            Global Variables                                */
+/* ========================================================================== */
+static const char gAppMainMenu[] =
+{
+    " \r\n Commands"
+    " \r\n ================================================================="
+    " \r\n menu                      - shows this screen"
+    " \r\n show setting              - display current setting"
+    " \r\n setting                   - change setting"
+    " \r\n quit                      - exits utility"
+    " \r\n probe                     - probes the I2C instance (0 or 1) for all possibly connected slaves"
+    " \r\n file <filename>           - execute I2C utility commands by reading from file <filename>"
+    " \r\n wait <time in msecs>      - introduce a delay of <time in msecs> msecs"
+    " \r\n"
+    " \r\n rd <dev addr in hex> <reg offset in hex> <num regs to read in hex> "
+    " \r\n wr <dev addr in hex> <reg offset in hex> <value to write in hex> "
+    " \r\n"
+    " \r\n rd_raw <dev addr in hex> <num regs to read in hex>"
+    " \r\n       - Reads the specified no. of registers from a desired IO expander kind "
+    " \r\n         of slave, which doesn't have the register offset"
+    " \r\n"
+    " \r\n wr_raw <dev addr in hex> <reg value 1 in hex> <reg value 2 in hex> etc..."
+    " \r\n       - Writes n bytes (max 100 bytes) at the desired slave."
+    " \r\n         All bytes are transferred one after the other in the same I2C transfer"
+    " \r\n"
+    " \r\n rd      <reg offset in hex> can be 8 or 16 bits wide"
+    " \r\n         <reg offset in hex> 8 bits for all other commands"
+    " \r\n"
+    " \r\n"
+};
+
+static const char gAppSettingSubMenu[] =
+{
+    " \r\n Setting Menu:"
+    " \r\n ================================================================="
+    " \r\n 0: Change I2C Instance"
+    " \r\n 1: Change Addressing/Data mode"
+    " \r\n quit"
+    " \r\n"
+    " \r\n Enter option:"
+};
+
+static const char gAppI2cInstNames[APP_I2C_INST_MAX][50U] =
+{
+    {" \r\n 0: Inst0"},
+    {" \r\n 1: Inst1"},
+};
+
+static const char gAppI2cSetting[APP_I2C_MODES_MAX][50U] =
+{
+    {" \r\n 0: 8 bits addresses and 8 bits data."},
+    {" \r\n 1: 8 bits addresses and 16 bits data."},
+    {" \r\n 2: 16 bits addresses and 8 bits data."},
+    {" \r\n 3: 16 bits addresses and 16 bits data."},
+};
+
+/* Default mode is 8 bit addressing and 8 bit data */
+uint32_t gAddrDataMode = 0U;
+uint32_t gCurrInst = 0U;
+char gInputStr[1024];
+char *gInputArgs[128];
+uint32_t gNumArgs;
+Bool gInitDone = FALSE;
+I2C_Handle gI2cHandle = NULL;
+/* ========================================================================== */
+/*                 Internal Function Declarations                             */
+/* ========================================================================== */
+static int32_t App_showMenu(void);
+static int32_t App_showSetting(void);
+static int32_t App_changeSetting(void);
+static Bool App_exeCmd(Bool echoCmd);
+static uint32_t App_tokenizeInput(char *inStr, char *argv[]);
+static int32_t App_readRegs(void);
+static int32_t App_writeReg(void);
+static int32_t App_delay(void);
+static int32_t App_file(void);
+static int32_t App_writeRegN(void);
+static int32_t App_readRegRaw(void);
+static int32_t App_deviceI2cProbeAll(uint32_t inst);
+static int xstrtoi(char *hex);
+static int32_t HextoDec(char *hex, int32_t l);
+static char xtod(char c);
+static int32_t App_i2cSetup(void);
+/* ========================================================================== */
+/*                          Function Definitions                              */
+/* ========================================================================== */
+int32_t main(void)
+{
+    Bool done = FALSE;
+    Board_STATUS status;
+    Board_initCfg boardCfg;
+
+
+    boardCfg = BOARD_INIT_MODULE_CLOCK |
+               BOARD_INIT_PINMUX_CONFIG |
+               BOARD_INIT_UART_STDIO;
+
+    status = Board_init(boardCfg);
+    if(status != BOARD_SOK)
+    {
+        UART_printf(" Board Init FAILED!!!\r\n");
+    }
+
+    App_i2cSetup();
+    App_showSetting();
+    App_showMenu();
+
+    while (!done)
+    {
+        UART_printf(" I2C-%d> ", gCurrInst);
+        done = App_exeCmd(FALSE);
+    }
+
+    if (gInitDone == TRUE)
+    {
+        I2C_close(gI2cHandle);
+    }
+    UART_printf(" I2C: Bye Bye !!!\r\n");
+
+    return 0;
+}
+
+/* ========================================================================== */
+/*                 Internal Function Definitions                              */
+/* ========================================================================== */
+static int32_t App_showMenu(void)
+{
+    int32_t retVal = CSL_SOK;
+    Board_initCfg boardCfg;
+    Board_STATUS  boardStatus;
+
+    /* UART Init */
+    boardCfg = BOARD_INIT_MODULE_CLOCK |
+               BOARD_INIT_PINMUX_CONFIG |
+               BOARD_INIT_UART_STDIO;
+
+    boardStatus = Board_init(boardCfg);
+    if (boardStatus != BOARD_SOK)
+    {
+        UART_printf("[Error] Board init failed!!\n");
+    }
+
+    UART_printf("%s", gAppMainMenu);
+
+    return (retVal);
+}
+
+static int32_t App_showSetting(void)
+{
+    int32_t retVal = CSL_SOK;
+
+    UART_printf(" \r\n Current Setting");
+    UART_printf
+    (" \r\n =================================================================");
+    UART_printf(" \r\n Current I2C Instance: %s",
+                gAppI2cInstNames[gCurrInst]);
+    UART_printf(" \r\n Addressing and Address mode: %s",
+                gAppI2cSetting[gAddrDataMode]);
+
+
+    return (retVal);
+}
+
+static int32_t App_changeSetting(void)
+{
+    int32_t retVal = CSL_SOK;
+    uint32_t mode = 0U, loopCnt = 0U;
+
+    UART_printf("%s", &gAppSettingSubMenu[0U]);
+    if (S_PASS !=  UART_scanFmt("%d", &mode))
+    {
+        UART_printf("Read from UART Console failed\n");
+        retVal = CSL_EFAIL;
+    }
+
+    switch (mode)
+    {
+        case 0:
+        /* Change instance */
+        UART_printf(" \r\n Available Instances:");
+        UART_printf
+        (" \r\n =================================================================");
+        for (loopCnt = 0U ; loopCnt < APP_I2C_INST_MAX ; loopCnt++)
+        {
+            UART_printf("%s:", &gAppI2cInstNames[loopCnt]);
+        }
+        UART_printf(" \r\n Enter I2C Instance ID:");
+        if (S_PASS !=  UART_scanFmt("%d", &mode))
+        {
+            UART_printf("Read from UART Console failed\n");
+            retVal = CSL_EFAIL;
+        }
+        else
+        {
+            gCurrInst = mode;
+        }
+        break;
+        case 1:
+        /* Change addressing and data mode */
+        UART_printf(" \r\n Available Modes:");
+        UART_printf
+        (" \r\n =================================================================");
+        for (loopCnt = 0U ; loopCnt < APP_I2C_MODES_MAX ; loopCnt++)
+        {
+            UART_printf("%s:", &gAppI2cSetting[loopCnt]);
+        }
+        UART_printf(" \r\n Enter I2C Mode ID:");
+        if (S_PASS !=  UART_scanFmt("%d", &mode))
+        {
+            UART_printf("Read from UART Console failed\n");
+            retVal = CSL_EFAIL;
+        }
+        else
+        {
+            gAddrDataMode = mode;
+        }
+        break;
+        default:
+            retVal = CSL_EFAIL;
+        break;
+    }
+
+    return (retVal);
+}
+
+static Bool App_exeCmd(Bool echoCmd)
+{
+    Bool  done = FALSE;
+
+    if (S_PASS !=  UART_scanFmt("%s", &gInputStr))
+    {
+        UART_printf("Read from UART Console failed\n");
+        done = TRUE;
+    }
+
+    if (echoCmd)
+    {
+        UART_printf(" \r\n");
+        UART_printf(" I2C: CMD: %s", gInputStr);
+    }
+
+    gNumArgs = App_tokenizeInput(gInputStr, gInputArgs);
+    if (gNumArgs)
+    {
+        if (strcmp(gInputArgs[0U], "quit") == 0)
+        {
+            done = TRUE;
+        }
+        else if ((strcmp(gInputArgs[0U], "show") == 0) &&
+                 (strcmp(gInputArgs[1U], "setting") == 0))
+        {
+            App_showSetting();
+        }
+        else if (strcmp(gInputArgs[0U], "setting") == 0)
+        {
+            App_changeSetting();
+        }
+        else if (strcmp(gInputArgs[0U], "help") == 0)
+        {
+            App_showMenu();
+        }
+        else if (strcmp(gInputArgs[0U], "rd") == 0)
+        {
+            App_readRegs();
+        }
+        else if (strcmp(gInputArgs[0U], "wr") == 0)
+        {
+            App_writeReg();
+        }
+        else if (strcmp(gInputArgs[0U], "wait") == 0)
+        {
+            App_delay();
+        }
+        else if (strcmp(gInputArgs[0U], "file") == 0)
+        {
+            App_file();
+        }
+        else if (strcmp(gInputArgs[0U], "wr_raw") == 0)
+        {
+            App_writeRegN();
+        }
+        else if (strcmp(gInputArgs[0U], "rd_raw") == 0)
+        {
+            App_readRegRaw();
+        }
+        else if (strcmp(gInputArgs[0U], "probe") == 0)
+        {
+            App_deviceI2cProbeAll(gCurrInst);
+        }
+    }
+
+    return (done);
+}
+
+static uint32_t App_tokenizeInput(char *inStr, char *argv[])
+{
+    char   delimiters[] = " \r\n";
+    char  *token;
+    uint32_t argc = 0;
+
+    token = strtok(inStr, delimiters);
+    while (token != NULL)
+    {
+        argv[argc] = token;
+        argc++;
+        token = strtok(NULL, delimiters);
+    }
+
+    return (argc);
+}
+
+static int32_t App_readRegs(void)
+{
+    int8_t ret = 0;
+    uint32_t devAddr;
+    uint32_t regAddr, regVal = 0U;
+    uint32_t numRegs, loopCnt = 0U;
+    int32_t  status   = CSL_SOK;
+    //uint32_t currTime = 0, timeElapsed = 0;
+
+    if (gNumArgs == 4)
+    {
+        devAddr = xstrtoi(gInputArgs[1]);
+        regAddr = xstrtoi(gInputArgs[2]);
+        numRegs = xstrtoi(gInputArgs[3]);
+
+        if (numRegs < APP_I2C_MAX_REG_RD_WR)
+        {
+            UART_printf(
+            " I2C: Reading 0x%02x registers starting from REG 0x%02x of device 0x%02x ... !!!\r\n",
+            numRegs,
+            regAddr,
+            devAddr);
+            for (loopCnt = 0U ; loopCnt < numRegs ; loopCnt++)
+            {
+                regVal = 0U;
+                switch (gAddrDataMode)
+                {
+                    case 0U:
+                        ret = Board_i2c8BitRegRd(&gI2cHandle,
+                                                 (uint8_t)devAddr,
+                                                 (uint8_t)(regAddr + loopCnt),
+                                                 (uint8_t *)&regVal,
+                                                 1U);
+                    break;
+                    case 1U:
+                        ret = Board_i2c8BitRegRd(&gI2cHandle,
+                                                 (uint8_t)devAddr,
+                                                 (uint8_t)(regAddr + loopCnt),
+                                                 (uint8_t *)&regVal,
+                                                 2U);
+                    break;
+                    case 2U:
+                        ret = Board_i2c16BitRegRd(&gI2cHandle,
+                                                  (uint8_t)devAddr,
+                                                  (uint16_t)(regAddr + loopCnt),
+                                                  (uint8_t *)&regVal,
+                                                  1U);
+                    break;
+                    case 3U:
+                        ret = Board_i2c16BitRegRd(&gI2cHandle,
+                                                  (uint8_t)devAddr,
+                                                  (uint16_t)(regAddr + loopCnt),
+                                                  (uint8_t *)&regVal,
+                                                  2U);
+                    break;
+                    default:
+                    break;
+                }
+                if(ret == 0)
+                {
+                    UART_printf(" I2C: 0x%x = 0x%x\r\n",
+                                (regAddr + loopCnt),
+                                regVal);
+                }
+                else
+                {
+                    UART_printf(" I2C: Read ERROR !!!\r\n");
+                    status = CSL_EFAIL;
+                    break;
+                }
+            }
+        }
+    }
+    else
+    {
+        UART_printf(" I2C: Insufficient arguments specified !!!\r\n");
+    }
+
+    return (status);
+}
+
+static int32_t App_writeReg(void)
+{
+    int8_t ret = 0;
+    uint32_t devAddr;
+    uint32_t regAddr;
+    uint32_t regVal;
+    int32_t  status = CSL_SOK;
+
+    if (gNumArgs == 4)
+    {
+        devAddr = xstrtoi(gInputArgs[1]);
+        regAddr = xstrtoi(gInputArgs[2]);
+        regVal = xstrtoi(gInputArgs[3]);
+        switch (gAddrDataMode)
+        {
+            case 0U:
+                ret = Board_i2c8BitRegWr(&gI2cHandle,
+                                         (uint8_t)devAddr,
+                                         (uint8_t)(regAddr),
+                                         (uint8_t *)&regVal,
+                                         1U);
+                regVal = 0U;
+                ret += Board_i2c8BitRegRd(&gI2cHandle,
+                                          (uint8_t)devAddr,
+                                          (uint8_t)(regAddr),
+                                          (uint8_t *)&regVal,
+                                          1U);
+            break;
+            case 1U:
+                ret = Board_i2c8BitRegWr(&gI2cHandle,
+                                         (uint8_t)devAddr,
+                                         (uint8_t)(regAddr),
+                                         (uint8_t *)&regVal,
+                                         2U);
+                regVal = 0U;
+                ret += Board_i2c8BitRegRd(&gI2cHandle,
+                                          (uint8_t)devAddr,
+                                          (uint8_t)(regAddr),
+                                          (uint8_t *)&regVal,
+                                          2U);
+            break;
+            case 2U:
+                ret = Board_i2c16BitRegWr(&gI2cHandle,
+                                          (uint8_t)devAddr,
+                                          (uint16_t)(regAddr),
+                                          (uint8_t *)&regVal,
+                                          1U);
+                regVal = 0U;
+                ret += Board_i2c16BitRegRd(&gI2cHandle,
+                                           (uint8_t)devAddr,
+                                           (uint16_t)(regAddr),
+                                           (uint8_t *)&regVal,
+                                           1U);
+            break;
+            case 3U:
+                ret = Board_i2c16BitRegWr(&gI2cHandle,
+                                          (uint8_t)devAddr,
+                                          (uint16_t)(regAddr),
+                                          (uint8_t *)&regVal,
+                                          2U);
+                regVal = 0U;
+                ret += Board_i2c16BitRegRd(&gI2cHandle,
+                                           (uint8_t)devAddr,
+                                           (uint16_t)(regAddr),
+                                           (uint8_t *)&regVal,
+                                           2U);
+            break;
+            default:
+            break;
+        }
+        if(ret == 0)
+        {
+            UART_printf(" I2C Read back value: 0x%x = 0x%x\r\n",
+                        (regAddr),
+                        regVal);
+        }
+        else
+        {
+            UART_printf(" I2C: Write/Read ERROR !!!\r\n");
+            status = CSL_EFAIL;
+        }
+    }
+    else
+    {
+        UART_printf(" I2C: Insufficient arguments specified !!!\r\n");
+    }
+
+    return (status);
+}
+
+static int32_t App_delay(void)
+{
+    int32_t retVal = CSL_SOK;
+    uint32_t timeInMsecs;
+
+    if (gNumArgs > 1)
+    {
+        timeInMsecs = atoi(gInputArgs[1]);
+
+        UART_printf(" I2C: Waiting for %d msecs ... \r\n", timeInMsecs);
+        UART_printf(" I2C: Wait Done !!!\r\n");
+    }
+    else
+    {
+        retVal = CSL_EFAIL;
+        UART_printf(" I2C: Insufficient arguments specified !!!\r\n");
+    }
+
+    return (retVal);
+}
+
+static int32_t App_file(void)
+{
+    UART_printf("\r\n This feature is not supported currently. Checkout other exciting features!!!\r\n");
+
+    return (CSL_SOK);
+}
+
+static int32_t App_writeRegN(void)
+{
+    UART_printf("\r\n This feature is not supported currently. Checkout other exciting features!!!\r\n");
+
+    return(CSL_SOK);
+}
+
+static int32_t App_readRegRaw(void)
+{
+    UART_printf("\r\n This feature is not supported currently. Checkout other exciting features!!!\r\n");
+
+    return (CSL_SOK);
+}
+
+static int32_t App_deviceI2cProbeAll(uint32_t inst)
+{
+    UART_printf("\r\n This feature is not supported currently. Checkout other exciting features!!!\r\n");
+
+    return (CSL_SOK);
+}
+
+static int32_t xstrtoi(char *hex)      // hex string to integer
+{
+    return HextoDec(hex, 0);
+}
+
+static int32_t HextoDec(char *hex, int32_t l)
+{
+    if (*hex == 0)
+    {
+        return (l);
+    }
+
+    return HextoDec(hex + 1, l * 16 + xtod(*hex)); // hex+1?
+}
+
+static char xtod(char c)
+{
+    if ((c >= '0') && (c <= '9'))
+    {
+        return (c - '0');
+    }
+    if ((c >= 'A') && (c <= 'F'))
+    {
+        return (c - 'A' + 10);
+    }
+    if ((c >= 'a') && (c <= 'f'))
+    {
+        return (c - 'a' + 10);
+    }
+
+    return (c = 0);        // not Hex digit
+}
+
+static int32_t App_i2cSetup(void)
+{
+    int32_t retVal = CSL_SOK;
+    uint8_t index;
+    uint8_t i2cInst = 0U;
+    /*uint8_t slaveAddr;*/
+    I2C_Params i2cParams;
+    I2C_HwAttrs i2cConfig;
+
+    for(index = 0; index < I2C_HWIP_MAX_CNT; index++)
+    {
+        I2C_socGetInitCfg(index, &i2cConfig);
+        i2cConfig.enableIntr = false;
+        I2C_socSetInitCfg(index, &i2cConfig);
+    }
+
+    /* Initializes the I2C */
+    I2C_init();
+
+    /* Initializes the I2C Parameters */
+    I2C_Params_init(&i2cParams);
+    i2cParams.bitRate = I2C_400kHz; /* 400KHz */
+
+    /* Configures the I2C instance with the passed parameters*/
+    gI2cHandle = I2C_open(i2cInst, &i2cParams);
+    if(gI2cHandle == NULL)
+       {
+               UART_printf("\nI2C Open failed!\n");
+        retVal = CSL_EFAIL;
+       }
+    else
+    {
+        gInitDone = TRUE;
+    }
+
+    return retVal;
+}
diff --git a/example/i2c_utility/makefile b/example/i2c_utility/makefile
new file mode 100755 (executable)
index 0000000..f196e5a
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# This file is the makefile for building I2C Utility App.
+#
+#   Copyright (c) Texas Instruments Incorporated 2016
+#
+include $(PDK_INSTALL_PATH)/ti/build/Rules.make
+
+APP_NAME = csl_i2c_utility
+BUILD_OS_TYPE=baremetal
+
+SRCDIR = .
+INCDIR =
+
+# List all the external components/interfaces, whose interface header files
+#  need to be included for this component
+INCLUDE_EXTERNAL_INTERFACES = pdk csl_arch
+
+# List all the components required by the application
+COMP_LIST_COMMON = csl csl_utils_common csl_uart_console csl_arch
+COMP_LIST_COMMON += csl_init osal_nonos gpio sciclient i2c board uart
+
+# Common source files and CFLAGS across all platforms and cores
+PACKAGE_SRCS_COMMON = .
+SRCS_COMMON = i2c_utility_main.c
+
+CFLAGS_LOCAL_COMMON = $(PDK_CFLAGS)
+
+# Core/SoC/platform specific source files and CFLAGS
+# Example:
+#   SRCS_<core/SoC/platform-name> =
+#   CFLAGS_LOCAL_<core/SoC/platform-name> =
+
+# Include common make files
+ifeq ($(MAKERULEDIR), )
+#Makerule path not defined, define this and assume relative path from ROOTDIR
+  MAKERULEDIR := $(ROOTDIR)/ti/build/makerules
+  export MAKERULEDIR
+endif
+include $(MAKERULEDIR)/common.mk
+
+# OBJs and libraries are built by using rule defined in rules_<target>.mk
+#     and need not be explicitly specified here
+
+# Nothing beyond this point
index b98492fee1d50835f8783d2811033422ae6cb4d8..31fdfd9d16568c325bd3866cc93de8c6cfc509fd 100644 (file)
@@ -114,7 +114,7 @@ drvi2c_FIRM_LIST = $(i2c_FIRM_LIST)
 # All the tests mentioned in list are built when test target is called
 # List below all examples for allowed values
 ############################
-i2c_EXAMPLE_LIST = drv_i2c_led_blink_test I2C_Baremetal_Eeprom_TestApp I2C_Eeprom_TestApp
+i2c_EXAMPLE_LIST = drv_i2c_led_blink_test I2C_Baremetal_Eeprom_TestApp I2C_Eeprom_TestApp csl_i2c_utility
 drvi2c_EXAMPLE_LIST = $(i2c_EXAMPLE_LIST)
 
 #
@@ -376,6 +376,26 @@ export I2C_Eeprom_TestApp_BOARDLIST
 I2C_Eeprom_TestApp_$(SOC)_CORELIST = $(i2c_$(SOC)_CORELIST)
 export I2C_Eeprom_TestApp_$(SOC)_CORELIST
 
+# I2C Utility
+csl_i2c_utility_COMP_LIST = csl_i2c_utility
+csl_i2c_utility_RELPATH = ti/drv/i2c/example/i2c_utility
+csl_i2c_utility_PATH = $(PDK_I2C_COMP_PATH)/example/i2c_utility
+csl_i2c_utility_BOARD_DEPENDENCY = yes
+csl_i2c_utility_CORE_DEPENDENCY = no
+csl_i2c_utility_MAKEFILE = -f makefile
+csl_i2c_utility_XDC_CONFIGURO = yes
+export csl_i2c_utility_COMP_LIST
+export csl_i2c_utility_BOARD_DEPENDENCY
+export csl_i2c_utility_CORE_DEPENDENCY
+export csl_i2c_utility_XDC_CONFIGURO
+export csl_i2c_utility_MAKEFILE
+csl_i2c_utility_PKG_LIST = csl_i2c_utility
+csl_i2c_utility_INCLUDE = $(csl_i2c_utility_PATH)
+csl_i2c_utility_BOARDLIST = j721e_evm
+export csl_i2c_utility_BOARDLIST
+csl_i2c_utility_$(SOC)_CORELIST = mcu1_0
+export csl_i2c_utility_$(SOC)_CORELIST
+
 export drvi2c_LIB_LIST
 export drvi2c_EXAMPLE_LIST
 export drvi2c_FIRM_LIST