cal-lld: add to PDK
authorJacob Stiffler <j-stiffler@ti.com>
Fri, 1 Nov 2019 18:57:41 +0000 (14:57 -0400)
committerJacob Stiffler <j-stiffler@ti.com>
Fri, 1 Nov 2019 18:57:41 +0000 (14:57 -0400)
Development of cal-lld has been relocated here from:
* Repo: https://git.ti.com/keystone-rtos/cal-lld
* Branch: master
* Commit ID: 1de94b8fcd53b7a0af5b7c259b512696b54133e5

Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
67 files changed:
packages/ti/drv/cal/.gitignore [new file with mode: 0644]
packages/ti/drv/cal/Settings.xdc.xdt [new file with mode: 0644]
packages/ti/drv/cal/cal.h [new file with mode: 0644]
packages/ti/drv/cal/cal_component.mk [new file with mode: 0755]
packages/ti/drv/cal/calver.h [new file with mode: 0644]
packages/ti/drv/cal/calver.h.xdt [new file with mode: 0644]
packages/ti/drv/cal/config_mk.bld [new file with mode: 0644]
packages/ti/drv/cal/docs/Doxyfile [new file with mode: 0644]
packages/ti/drv/cal/docs/doxygen/ti_disclaim.htm [new file with mode: 0644]
packages/ti/drv/cal/docs/doxygen/tifooter.htm [new file with mode: 0644]
packages/ti/drv/cal/docs/doxygen/tiheader.htm [new file with mode: 0644]
packages/ti/drv/cal/docs/doxygen/tilogo.gif [new file with mode: 0644]
packages/ti/drv/cal/docs/doxygen/titagline.gif [new file with mode: 0644]
packages/ti/drv/cal/examples/cal_capture_test/makefile [new file with mode: 0644]
packages/ti/drv/cal/examples/cal_capture_test/makefile.mk [new file with mode: 0644]
packages/ti/drv/cal/examples/cal_capture_test/makefile_baremetal [new file with mode: 0644]
packages/ti/drv/cal/examples/cal_capture_test/src/CaptureCal_main.c [new file with mode: 0755]
packages/ti/drv/cal/examples/cal_capture_test/src/CaptureCal_main.h [new file with mode: 0644]
packages/ti/drv/cal/examples/cal_capture_test/src/main_baremetal.c [new file with mode: 0644]
packages/ti/drv/cal/examples/cal_capture_test/src/main_tirtos.c [new file with mode: 0644]
packages/ti/drv/cal/examples/cal_loopback_test/makefile [new file with mode: 0644]
packages/ti/drv/cal/examples/cal_loopback_test/makefile.mk [new file with mode: 0644]
packages/ti/drv/cal/examples/cal_loopback_test/makefile_baremetal [new file with mode: 0644]
packages/ti/drv/cal/examples/cal_loopback_test/src/cal_loopback_test.c [new file with mode: 0755]
packages/ti/drv/cal/examples/cal_loopback_test/src/cal_loopback_test.h [new file with mode: 0755]
packages/ti/drv/cal/examples/cal_loopback_test/src/main_baremetal.c [new file with mode: 0755]
packages/ti/drv/cal/examples/cal_loopback_test/src/main_tirtos.c [new file with mode: 0644]
packages/ti/drv/cal/examples/utils/calutils.h [new file with mode: 0644]
packages/ti/drv/cal/examples/utils/makefile [new file with mode: 0644]
packages/ti/drv/cal/examples/utils/makefile_baremetal [new file with mode: 0644]
packages/ti/drv/cal/examples/utils/src/V0/calapp_sensor.c [new file with mode: 0644]
packages/ti/drv/cal/examples/utils/src/V0/calutils_ub95x.c [new file with mode: 0755]
packages/ti/drv/cal/examples/utils/src/V0/calutils_ub95x.h [new file with mode: 0644]
packages/ti/drv/cal/examples/utils/src/V0/calutils_ub964_sat88_ov1063x.c [new file with mode: 0644]
packages/ti/drv/cal/examples/utils/src/V0/calutils_ub964_sat88_ov1063x.h [new file with mode: 0644]
packages/ti/drv/cal/examples/utils/src/V0/calutils_ub964_sat88_ov1063x_reg.c [new file with mode: 0644]
packages/ti/drv/cal/examples/utils/src/V0/linker_cal_a53.lds [new file with mode: 0644]
packages/ti/drv/cal/examples/utils/src/calutils_mem.c [new file with mode: 0755]
packages/ti/drv/cal/include/cal_cfg.h [new file with mode: 0755]
packages/ti/drv/cal/include/cal_drv.h [new file with mode: 0755]
packages/ti/drv/cal/makefile [new file with mode: 0755]
packages/ti/drv/cal/package.bld [new file with mode: 0644]
packages/ti/drv/cal/package.xdc [new file with mode: 0644]
packages/ti/drv/cal/package.xs [new file with mode: 0644]
packages/ti/drv/cal/src/core/cal_common.h [new file with mode: 0644]
packages/ti/drv/cal/src/core/cal_core.h [new file with mode: 0755]
packages/ti/drv/cal/src/core/cal_coreapi.c [new file with mode: 0755]
packages/ti/drv/cal/src/core/cal_corecapture.h [new file with mode: 0755]
packages/ti/drv/cal/src/core/cal_evtmgr.c [new file with mode: 0755]
packages/ti/drv/cal/src/core/cal_evtmgr.h [new file with mode: 0755]
packages/ti/drv/cal/src/core/cal_resrcMgr.c [new file with mode: 0755]
packages/ti/drv/cal/src/core/cal_resrcMgr.h [new file with mode: 0644]
packages/ti/drv/cal/src/core/src_files_core.mk [new file with mode: 0644]
packages/ti/drv/cal/src/drv/cal_drvApi.c [new file with mode: 0644]
packages/ti/drv/cal/src/drv/cal_drvCore.c [new file with mode: 0644]
packages/ti/drv/cal/src/drv/cal_drvInit.c [new file with mode: 0755]
packages/ti/drv/cal/src/drv/cal_drvInternal.h [new file with mode: 0644]
packages/ti/drv/cal/src/drv/cal_drvPriv.c [new file with mode: 0755]
packages/ti/drv/cal/src/drv/cal_drvPriv.h [new file with mode: 0755]
packages/ti/drv/cal/src/drv/cal_drvProc.c [new file with mode: 0755]
packages/ti/drv/cal/src/drv/src_files_drv.mk [new file with mode: 0755]
packages/ti/drv/cal/src/hal/cal_hal.c [new file with mode: 0755]
packages/ti/drv/cal/src/hal/cal_hal.h [new file with mode: 0755]
packages/ti/drv/cal/src/hal/cal_halCommon.h [new file with mode: 0644]
packages/ti/drv/cal/src/hal/cal_halCsi2Am65xx.c [new file with mode: 0755]
packages/ti/drv/cal/src/hal/src_files_hal.mk [new file with mode: 0755]
packages/ti/drv/cal/src/makefile [new file with mode: 0644]

diff --git a/packages/ti/drv/cal/.gitignore b/packages/ti/drv/cal/.gitignore
new file mode 100644 (file)
index 0000000..fa05c1c
--- /dev/null
@@ -0,0 +1,11 @@
+lib/*
+docs/doxygen/html/
+.dlls
+.executables
+.xdcenv.mak
+*.mak
+.interfaces
+.libraries
+package/*
+Settings.h
+Settings.xdc
diff --git a/packages/ti/drv/cal/Settings.xdc.xdt b/packages/ti/drv/cal/Settings.xdc.xdt
new file mode 100644 (file)
index 0000000..77545c2
--- /dev/null
@@ -0,0 +1,48 @@
+\r
+%%{\r
+/*!\r
+ *  This template implements the Settings.xdc\r
+ */\r
+  /* Versioning */\r
+  var ver = this;\r
+  for each(i=0;i<ver.length;i++)\r
+  {\r
+      if(String(ver[i]).length < 2)\r
+      {\r
+        ver[i]="0"+ver[i];\r
+      }\r
+  }\r
+\r
+  var packageVersion = "\""+ver[0]+"."+ver[1]+"."+ver[2]+"."+ver[3]+"\"";\r
+\r
+%%}\r
+\r
+module Settings\r
+{\r
+    config string calVersionString = `packageVersion`;\r
+\r
+    /*! This variable is to control the SoC type selection.\r
+     * By default this variable is set to NULL.\r
+     *\r
+     * To use CAL for the selected device, add the following lines to config\r
+     * file and set the deviceType correctly:\r
+     *\r
+     *      var calSettings = xdc.useModule ('ti.drv.cal.Settings');\r
+     *      calSettings.socType = "am65xx";\r
+     *\r
+     */\r
+    metaonly config string socType = "";\r
+\r
+    /*! This variable is to control the device library type selection.\r
+     * By default this variable is set to release.\r
+     *\r
+     * To use the debug/release library, add the following lines to config\r
+     * file and set the library profile accordingly:\r
+     *\r
+     *      var cal Settings = xdc.useModule ('ti.drv.cal.Settings');\r
+     *      calSettings.libProfile = "debug";\r
+     *\r
+     */\r
+    metaonly config string libProfile = "release";\r
+}\r
+\r
diff --git a/packages/ti/drv/cal/cal.h b/packages/ti/drv/cal/cal.h
new file mode 100644 (file)
index 0000000..6e4e419
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2018
+ *
+ *  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.
+ */
+
+/**
+ *  \defgroup CAL CAL Low-Level Driver
+ *
+ *  @{
+ */
+
+/**
+ *  \file cal.h
+ *
+ *  \brief CAL Low Level Driver API/interface file.
+ */
+
+#ifndef CAL_H_
+#define CAL_H_
+
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+
+#include <stdint.h>
+#include <ti/csl/tistdtypes.h>
+#include <ti/drv/fvid2/fvid2.h>
+#include <ti/drv/cal/include/cal_cfg.h>
+#include <ti/drv/cal/include/cal_drv.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ========================================================================== */
+/*                           Macros & Typedefs                                */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                         Structure Declarations                             */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                          Function Declarations                             */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                       Static Function Definitions                          */
+/* ========================================================================== */
+/* None */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* #ifndef CAL_H_ */
+
+/* @} */
diff --git a/packages/ti/drv/cal/cal_component.mk b/packages/ti/drv/cal/cal_component.mk
new file mode 100755 (executable)
index 0000000..6ee3b6f
--- /dev/null
@@ -0,0 +1,217 @@
+# File: cal_component.mk
+#       This file is component include make file of CAL driver library.
+# List of variables set in this file and their purpose:
+# <mod>_RELPATH        - This is the relative path of the module, typically from
+#                        top-level directory of the package
+# <mod>_PATH           - This is the absolute path of the module. It derives from
+#                        absolute path of the top-level directory (set in env.mk)
+#                        and relative path set above
+# <mod>_INCLUDE        - This is the path that has interface header files of the
+#                        module. This can be multiple directories (space separated)
+# <mod>_PKG_LIST       - Names of the modules (and sub-modules) that are a part
+#                        part of this module, including itself.
+# <mod>_BOARD_DEPENDENCY - "yes": means the code for this module depends on
+#                             platform and the compiled obj/lib has to be kept
+#                             under <platform> directory
+#                             "no" or "" or if this variable is not defined: means
+#                             this module has no platform dependent code and hence
+#                             the obj/libs are not kept under <platform> dir.
+# <mod>_CORE_DEPENDENCY     - "yes": means the code for this module depends on
+#                             core and the compiled obj/lib has to be kept
+#                             under <core> directory
+#                             "no" or "" or if this variable is not defined: means
+#                             this module has no core dependent code and hence
+#                             the obj/libs are not kept under <core> dir.
+# <mod>_APP_STAGE_FILES     - List of source files that belongs to the module
+#                             <mod>, but that needs to be compiled at application
+#                             build stage (in the context of the app). This is
+#                             primarily for link time configurations or if the
+#                             source file is dependent on options/defines that are
+#                             application dependent. This can be left blank or
+#                             not defined at all, in which case, it means there
+#                             no source files in the module <mod> that are required
+#                             to be compiled in the application build stage.
+#
+ifeq ($(cal_component_make_include), )
+
+drvcal_SOCLIST          = am65xx
+drvcal_BOARDLIST        = am65xx_evm
+drvcal_am65xx_CORELIST  = mpu1_0
+
+############################
+# cal package
+# List of components included under cal lib
+# The components included here are built and will be part of cal lib
+############################
+cal_LIB_LIST = cal
+
+############################
+# cal examples
+# List of examples under cal (+= is used at each example definition)
+# All the tests mentioned in list are built when test target is called
+# List below all examples for allowed values
+############################
+cal_EXAMPLE_LIST =
+
+#
+# CAL Modules
+#
+
+# CAL library
+cal_COMP_LIST = cal
+cal_RELPATH = ti/drv/cal
+cal_PATH = $(PDK_CAL_COMP_PATH)
+cal_LIBNAME = cal
+cal_LIBPATH = $(PDK_CAL_COMP_PATH)/lib
+cal_MAKEFILE = -fsrc/makefile
+export cal_MAKEFILE
+export cal_LIBNAME
+export cal_LIBPATH
+cal_BOARD_DEPENDENCY = no
+cal_CORE_DEPENDENCY = yes
+export cal_COMP_LIST
+export cal_BOARD_DEPENDENCY
+export cal_CORE_DEPENDENCY
+cal_PKG_LIST = cal
+cal_INCLUDE = $(cal_PATH)
+cal_SOCLIST = $(drvcal_SOCLIST)
+export cal_SOCLIST
+cal_$(SOC)_CORELIST = $(drvcal_$(SOC)_CORELIST)
+export cal_$(SOC)_CORELIST
+
+cal_app_utils_COMP_LIST = cal_app_utils
+cal_app_utils_RELPATH = ti/drv/cal/examples/utils
+cal_app_utils_PATH = $(PDK_CAL_COMP_PATH)/examples/utils
+cal_app_utils_LIBNAME = cal_app_utils
+cal_app_utils_LIBPATH = $(PDK_CAL_COMP_PATH)/lib
+cal_app_utils_MAKEFILE = -fmakefile
+export cal_app_utils_LIBNAME
+export cal_app_utils_LIBPATH
+export cal_app_utils_MAKEFILE
+cal_app_utils_OBJPATH = $(cal_app_utils_RELPATH)
+export cal_app_utils_OBJPATH
+cal_app_utils_BOARD_DEPENDENCY = yes
+cal_app_utils_CORE_DEPENDENCY = yes
+export cal_app_utils_COMP_LIST
+export cal_app_utils_BOARD_DEPENDENCY
+export cal_app_utils_CORE_DEPENDENCY
+cal_app_utils_PKG_LIST = cal_app_utils
+cal_app_utils_INCLUDE = $(cal_app_utils_PATH)
+cal_app_utils_SOCLIST = $(drvcal_SOCLIST)
+export cal_app_utils_SOCLIST
+cal_app_utils_$(SOC)_CORELIST = $(drvcal_$(SOC)_CORELIST)
+export cal_app_utils_$(SOC)_CORELIST
+cal_LIB_LIST += cal_app_utils
+
+cal_app_utils_baremetal_COMP_LIST = cal_app_utils_baremetal
+cal_app_utils_baremetal_RELPATH = ti/drv/cal/examples/utils
+cal_app_utils_baremetal_PATH = $(PDK_CAL_COMP_PATH)/examples/utils
+cal_app_utils_baremetal_LIBNAME = cal_app_utils_baremetal
+cal_app_utils_baremetal_LIBPATH = $(PDK_CAL_COMP_PATH)/lib
+cal_app_utils_baremetal_MAKEFILE = -fmakefile_baremetal
+export cal_app_utils_baremetal_LIBNAME
+export cal_app_utils_baremetal_LIBPATH
+export cal_app_utils_baremetal_MAKEFILE
+cal_app_utils_baremetal_OBJPATH = $(cal_app_utils_baremetal_RELPATH)_baremetal
+export cal_app_utils_baremetal_OBJPATH
+cal_app_utils_baremetal_BOARD_DEPENDENCY = yes
+cal_app_utils_baremetal_CORE_DEPENDENCY = yes
+export cal_app_utils_baremetal_COMP_LIST
+export cal_app_utils_baremetal_BOARD_DEPENDENCY
+export cal_app_utils_baremetal_CORE_DEPENDENCY
+cal_app_utils_baremetal_PKG_LIST = cal_app_utils_baremetal
+cal_app_utils_baremetal_INCLUDE = $(cal_app_utils_baremetal_PATH)
+cal_app_utils_baremetal_SOCLIST = $(drvcal_SOCLIST)
+export cal_app_utils_baremetal_SOCLIST
+cal_app_utils_baremetal_$(SOC)_CORELIST = $(drvcal_$(SOC)_CORELIST)
+export cal_app_utils_baremetal_$(SOC)_CORELIST
+cal_LIB_LIST += cal_app_utils_baremetal
+
+#
+# CAL Examples
+#
+
+cal_capture_testapp_COMP_LIST = cal_capture_testapp
+cal_capture_testapp_RELPATH = ti/drv/cal/examples/cal_capture_test
+cal_capture_testapp_PATH = $(PDK_CAL_COMP_PATH)/examples/cal_capture_test
+cal_capture_testapp_MAKEFILE = -fmakefile
+cal_capture_testapp_BOARD_DEPENDENCY = yes
+cal_capture_testapp_CORE_DEPENDENCY = yes
+cal_capture_testapp_XDC_CONFIGURO = yes
+export cal_capture_testapp_COMP_LIST
+export cal_capture_testapp_BOARD_DEPENDENCY
+export cal_capture_testapp_CORE_DEPENDENCY
+export cal_capture_testapp_XDC_CONFIGURO
+cal_capture_testapp_PKG_LIST = cal_capture_testapp
+cal_capture_testapp_INCLUDE = $(cal_capture_testapp_PATH)
+cal_capture_testapp_BOARDLIST = am65xx_evm
+export cal_capture_testapp_BOARDLIST
+cal_capture_testapp_$(SOC)_CORELIST = $(drvcal_$(SOC)_CORELIST)
+export cal_capture_testapp_$(SOC)_CORELIST
+cal_EXAMPLE_LIST += cal_capture_testapp
+
+cal_baremetal_capture_testapp_COMP_LIST = cal_baremetal_capture_testapp
+cal_baremetal_capture_testapp_RELPATH = ti/drv/cal/examples/cal_capture_test
+cal_baremetal_capture_testapp_PATH = $(PDK_CAL_COMP_PATH)/examples/cal_capture_test
+cal_baremetal_capture_testapp_MAKEFILE = -fmakefile_baremetal
+cal_baremetal_capture_testapp_BOARD_DEPENDENCY = yes
+cal_baremetal_capture_testapp_CORE_DEPENDENCY = yes
+export cal_baremetal_capture_testapp_COMP_LIST
+export cal_baremetal_capture_testapp_BOARD_DEPENDENCY
+export cal_baremetal_capture_testapp_CORE_DEPENDENCY
+cal_baremetal_capture_testapp_PKG_LIST = cal_baremetal_capture_testapp
+cal_baremetal_capture_testapp_INCLUDE = $(cal_baremetal_capture_testapp_PATH)
+cal_baremetal_capture_testapp_BOARDLIST = am65xx_evm
+export cal_baremetal_capture_testapp_BOARDLIST
+cal_baremetal_capture_testapp_$(SOC)_CORELIST = $(drvcal_$(SOC)_CORELIST)
+export cal_baremetal_capture_testapp_$(SOC)_CORELIST
+cal_EXAMPLE_LIST += cal_baremetal_capture_testapp
+
+cal_loopback_testapp_COMP_LIST = cal_loopback_testapp
+cal_loopback_testapp_RELPATH = ti/drv/cal/examples/cal_loopback_test
+cal_loopback_testapp_PATH = $(PDK_CAL_COMP_PATH)/examples/cal_loopback_test
+cal_loopback_testapp_MAKEFILE = -fmakefile
+cal_loopback_testapp_BOARD_DEPENDENCY = yes
+cal_loopback_testapp_CORE_DEPENDENCY = yes
+cal_loopback_testapp_XDC_CONFIGURO = yes
+export cal_loopback_testapp_COMP_LIST
+export cal_loopback_testapp_BOARD_DEPENDENCY
+export cal_loopback_testapp_CORE_DEPENDENCY
+export cal_loopback_testapp_XDC_CONFIGURO
+cal_loopback_testapp_PKG_LIST = cal_loopback_testapp
+cal_loopback_testapp_INCLUDE = $(cal_loopback_testapp_PATH)
+cal_loopback_testapp_BOARDLIST = $(drvcal_BOARDLIST)
+export cal_loopback_testapp_BOARDLIST
+cal_loopback_testapp_$(SOC)_CORELIST = $(drvcal_$(SOC)_CORELIST)
+export cal_loopback_testapp_$(SOC)_CORELIST
+cal_EXAMPLE_LIST += cal_loopback_testapp
+
+cal_baremetal_loopback_testapp_COMP_LIST = cal_baremetal_loopback_testapp
+cal_baremetal_loopback_testapp_RELPATH = ti/drv/cal/examples/cal_loopback_test
+cal_baremetal_loopback_testapp_PATH = $(PDK_CAL_COMP_PATH)/examples/cal_loopback_test
+cal_baremetal_loopback_testapp_MAKEFILE = -fmakefile_baremetal
+cal_baremetal_loopback_testapp_BOARD_DEPENDENCY = yes
+cal_baremetal_loopback_testapp_CORE_DEPENDENCY = yes
+export cal_baremetal_loopback_testapp_COMP_LIST
+export cal_baremetal_loopback_testapp_BOARD_DEPENDENCY
+export cal_baremetal_loopback_testapp_CORE_DEPENDENCY
+cal_baremetal_loopback_testapp_PKG_LIST = cal_baremetal_loopback_testapp
+cal_baremetal_loopback_testapp_INCLUDE = $(cal_baremetal_loopback_testapp_PATH)
+cal_baremetal_loopback_testapp_BOARDLIST = $(drvcal_BOARDLIST)
+export cal_baremetal_loopback_testapp_BOARDLIST
+cal_baremetal_loopback_testapp_$(SOC)_CORELIST = $(drvcal_$(SOC)_CORELIST)
+export cal_baremetal_loopback_testapp_$(SOC)_CORELIST
+cal_EXAMPLE_LIST += cal_baremetal_loopback_testapp
+
+export cal_LIB_LIST
+export cal_EXAMPLE_LIST
+export drvcal_LIB_LIST = $(cal_LIB_LIST)
+export drvcal_EXAMPLE_LIST = $(cal_EXAMPLE_LIST)
+
+CAL_CFLAGS =
+CAL_CFLAGS += $(FVID2_CFLAGS)
+
+export CAL_CFLAGS
+
+cal_component_make_include := 1
+endif
diff --git a/packages/ti/drv/cal/calver.h b/packages/ti/drv/cal/calver.h
new file mode 100644 (file)
index 0000000..348e472
--- /dev/null
@@ -0,0 +1,68 @@
+#ifndef CALVER_H
+#define CALVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================= */
+/**
+ *   @file  calver.h
+ *
+ *   path  ti/drv/cal/calver.h
+ *
+ *   @brief  CAL Driver Version Definitions
+ *
+ *  ============================================================
+ *  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.
+ *
+*/
+
+/**
+ * @brief   This is the CAL Driver Version. Versions numbers are encoded in the following
+ * format:
+ *  0xAABBCCDD -> Arch (AA); API Changes (BB); Major (CC); Minor (DD)
+ */
+#define CAL_DRV_VERSION_ID                     (0x01000004)
+
+/**
+ * @brief   This is the version string which describes the CAL driver along with the
+ * date and build information.
+ */
+#define CAL_DRV_VERSION_STR                    "CAL Driver Revision: 01.00.00.03"
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* CALVER_H */
diff --git a/packages/ti/drv/cal/calver.h.xdt b/packages/ti/drv/cal/calver.h.xdt
new file mode 100644 (file)
index 0000000..540446c
--- /dev/null
@@ -0,0 +1,100 @@
+%%{
+/*!
+ *  This template implements the calver.h
+ */
+  /* Versioning */
+  var ver = this;
+  var ver1 = [00,00,00,00];
+  var ver2 = [00,00,00,00];
+
+  for each(i=0;i<ver.length;i++)
+  {
+      if(String(ver[i]).length < 2)
+      {
+        ver1[i]="0"+ver[i];
+      }
+      else
+      {
+        ver1[i] = ver[i];
+      }
+
+      ver2[i] = Number(ver[i]).toString(16).toUpperCase();
+
+      if(String(ver2[i]).length < 2)
+      {
+        ver2[i]="0"+ver2[i];
+      }
+  }
+
+  var versionStr = "\""+"CAL Driver Revision: "+ver1[0]+"."+ver1[1]+"."+ver1[2]+"."+ver1[3]+"\"";
+  var versionID = "(0x"+ver2[0]+ver2[1]+ver2[2]+ver2[3]+")";
+
+%%}
+#ifndef CALVER_H
+#define CALVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================= */
+/**
+ *   @file  calver.h
+ *
+ *   path  ti/drv/cal/calver.h
+ *
+ *   @brief  CAL Driver Version Definitions
+ *
+ *  ============================================================
+ *  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.
+ *
+*/
+
+/**
+ * @brief   This is the CAL Driver Version. Versions numbers are encoded in the following
+ * format:
+ *  0xAABBCCDD -> Arch (AA); API Changes (BB); Major (CC); Minor (DD)
+ */
+#define CAL_DRV_VERSION_ID                     `versionID`
+
+/**
+ * @brief   This is the version string which describes the CAL driver along with the
+ * date and build information.
+ */
+#define CAL_DRV_VERSION_STR                    `versionStr`
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* CALVER_H */
diff --git a/packages/ti/drv/cal/config_mk.bld b/packages/ti/drv/cal/config_mk.bld
new file mode 100644 (file)
index 0000000..1df71b1
--- /dev/null
@@ -0,0 +1,18 @@
+/******************************************************************************\r
+ * FILE PURPOSE: Build configuration Script for the CAL Driver\r
+ ******************************************************************************\r
+ * FILE NAME: config.bld\r
+ *\r
+ * DESCRIPTION: \r
+ *  This file contains the build configuration script for the CAL driver\r
+ *  and is responsible for configuration of the paths for the various \r
+ *  tools required to build the driver.\r
+ *\r
+ * Copyright (C) 2018, Texas Instruments, Inc.\r
+ *****************************************************************************/\r
+\r
+/* Configure the CAL Release Version Information */\r
+var calDriverReleaseVersion = (""+Pkg.version.replace(/\s/g, "")).split(',');\r
+\r
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');\r
+Build.useTargets=null;\r
diff --git a/packages/ti/drv/cal/docs/Doxyfile b/packages/ti/drv/cal/docs/Doxyfile
new file mode 100644 (file)
index 0000000..93cfc95
--- /dev/null
@@ -0,0 +1,232 @@
+# Doxyfile 1.5.1-p1
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = "CAL Driver"
+PROJECT_NUMBER         = 3.03.00
+OUTPUT_DIRECTORY       = ./docs/doxygen
+CREATE_SUBDIRS         = NO
+OUTPUT_LANGUAGE        = English
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        =
+STRIP_FROM_INC_PATH    =
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+INHERIT_DOCS           = YES
+SEPARATE_MEMBER_PAGES  = NO
+TAB_SIZE               = 8
+ALIASES                =
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = NO
+BUILTIN_STL_SUPPORT    = NO
+DISTRIBUTE_GROUP_DOC   = YES
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = NO
+EXTRACT_PRIVATE        = NO
+EXTRACT_STATIC         = YES
+EXTRACT_LOCAL_CLASSES  = YES
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = YES
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = NO
+CASE_SENSE_NAMES       = NO
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = YES
+GENERATE_TESTLIST      = YES
+GENERATE_BUGLIST       = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       =
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+FILE_VERSION_FILTER    =
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           =
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = ./ \
+                         ./include \
+                         ../../csl/csl_fvid2_dataTypes.h \
+                         ../fvid2/include/fvid2_api.h
+
+FILE_PATTERNS          = *.h
+
+RECURSIVE              = NO
+EXCLUDE                = NO
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       =
+EXAMPLE_PATH           = ./docs/doxygen
+EXAMPLE_PATTERNS       = *
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             =
+INPUT_FILTER           =
+FILTER_PATTERNS        =
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = NO
+REFERENCES_RELATION    = NO
+REFERENCES_LINK_SOURCE = YES
+USE_HTAGS              = NO
+VERBATIM_HEADERS       = NO
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          =
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = YES
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = ./docs/doxygen/tiheader.htm
+HTML_FOOTER            = ./docs/doxygen/tifooter.htm
+HTML_STYLESHEET        =
+GENERATE_HTMLHELP      = NO
+CHM_FILE               = ..\..\cal.chm
+HHC_LOCATION           = hhc.exe
+GENERATE_CHI           = NO
+BINARY_TOC             = NO
+TOC_EXPAND             = NO
+DISABLE_INDEX          = NO
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = NO
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         =
+LATEX_HEADER           =
+PDF_HYPERLINKS         = YES
+USE_PDFLATEX           = YES
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = NO
+RTF_OUTPUT             = rtf
+COMPACT_RTF            = NO
+RTF_HYPERLINKS         = NO
+RTF_STYLESHEET_FILE    =
+RTF_EXTENSIONS_FILE    =
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = NO
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           =
+INCLUDE_FILE_PATTERNS  =
+PREDEFINED             =
+EXPAND_AS_DEFINED      =
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+TAGFILES               =
+GENERATE_TAGFILE       =
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = NO
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = NO
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = NO
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+CALLER_GRAPH           = NO
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               =
+DOTFILE_DIRS           =
+MAX_DOT_GRAPH_DEPTH    = 1000
+DOT_TRANSPARENT        = YES
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
diff --git a/packages/ti/drv/cal/docs/doxygen/ti_disclaim.htm b/packages/ti/drv/cal/docs/doxygen/ti_disclaim.htm
new file mode 100644 (file)
index 0000000..085a637
--- /dev/null
@@ -0,0 +1,1093 @@
+<html xmlns:v="urn:schemas-microsoft-com:vml"
+xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List href="./ti_disclaimer_files/filelist.xml">
+<title>TI Disclaimer</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+  <o:Author>a0875225</o:Author>
+  <o:LastAuthor>NC</o:LastAuthor>
+  <o:Revision>6</o:Revision>
+  <o:TotalTime>3</o:TotalTime>
+  <o:LastPrinted>2003-03-14T13:23:00Z</o:LastPrinted>
+  <o:Created>2003-03-27T17:45:00Z</o:Created>
+  <o:LastSaved>2003-03-27T17:50:00Z</o:LastSaved>
+  <o:Pages>1</o:Pages>
+  <o:Words>397</o:Words>
+  <o:Characters>2263</o:Characters>
+  <o:Company>Texas Instruments Inc</o:Company>
+  <o:Lines>18</o:Lines>
+  <o:Paragraphs>4</o:Paragraphs>
+  <o:CharactersWithSpaces>2779</o:CharactersWithSpaces>
+  <o:Version>9.2720</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+@font-face
+       {font-family:Helvetica;
+       panose-1:2 11 6 4 2 2 2 2 2 4;
+       mso-font-charset:0;
+       mso-generic-font-family:swiss;
+       mso-font-pitch:variable;
+       mso-font-signature:536902279 -2147483648 8 0 511 0;}
+@font-face
+       {font-family:Courier;
+       panose-1:0 0 0 0 0 0 0 0 0 0;
+       mso-font-charset:0;
+       mso-generic-font-family:modern;
+       mso-font-format:other;
+       mso-font-pitch:fixed;
+       mso-font-signature:3 0 0 0 1 0;}
+@font-face
+       {font-family:Wingdings;
+       panose-1:5 0 0 0 0 0 0 0 0 0;
+       mso-font-charset:2;
+       mso-generic-font-family:auto;
+       mso-font-pitch:variable;
+       mso-font-signature:0 268435456 0 0 -2147483648 0;}
+@font-face
+       {font-family:Tahoma;
+       panose-1:2 11 6 4 3 5 4 4 2 4;
+       mso-font-charset:0;
+       mso-generic-font-family:swiss;
+       mso-font-pitch:variable;
+       mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+@font-face
+       {font-family:"\FF2D\FF33 \FF30\30B4\30B7\30C3\30AF";
+       mso-font-alt:"Times New Roman";
+       mso-font-charset:128;
+       mso-generic-font-family:modern;
+       mso-font-pitch:variable;
+       mso-font-signature:-1610612033 1757936891 16 0 131231 0;}
+@font-face
+       {font-family:"Monotype Sorts";
+       panose-1:1 1 6 1 1 1 1 1 1 1;
+       mso-font-charset:2;
+       mso-generic-font-family:auto;
+       mso-font-pitch:variable;
+       mso-font-signature:0 268435456 0 0 -2147483648 0;}
+@font-face
+       {font-family:"\@\FF2D\FF33 \FF30\30B4\30B7\30C3\30AF";
+       mso-font-charset:128;
+       mso-generic-font-family:modern;
+       mso-font-pitch:variable;
+       mso-font-signature:-1610612033 1757936891 16 0 131231 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+       {mso-style-parent:"";
+       margin:0in;
+       margin-bottom:.0001pt;
+       mso-pagination:widow-orphan;
+       font-size:12.0pt;
+       font-family:"Times New Roman";
+       mso-fareast-font-family:"Times New Roman";}
+h1
+       {mso-style-next:Normal;
+       margin-top:0in;
+       margin-right:0in;
+       margin-bottom:0in;
+       margin-left:.25in;
+       margin-bottom:.0001pt;
+       text-indent:-.25in;
+       mso-pagination:widow-orphan;
+       page-break-after:avoid;
+       mso-outline-level:1;
+       mso-list:l6 level1 lfo2;
+       tab-stops:list .25in;
+       font-size:14.0pt;
+       mso-bidi-font-size:12.0pt;
+       font-family:"Times New Roman";
+       mso-font-kerning:0pt;}
+h2
+       {mso-style-update:auto;
+       mso-style-next:Normal;
+       margin-top:0in;
+       margin-right:0in;
+       margin-bottom:0in;
+       margin-left:.4in;
+       margin-bottom:.0001pt;
+       text-indent:-.4in;
+       mso-pagination:widow-orphan;
+       page-break-after:avoid;
+       mso-outline-level:2;
+       mso-list:l1 level2 lfo4;
+       tab-stops:list .4in;
+       font-size:14.0pt;
+       mso-bidi-font-size:12.0pt;
+       font-family:"Times New Roman";
+       mso-bidi-font-weight:normal;}
+h3
+       {mso-style-update:auto;
+       mso-style-next:Normal;
+       margin-top:.25in;
+       margin-right:0in;
+       margin-bottom:0in;
+       margin-left:.5in;
+       margin-bottom:.0001pt;
+       text-indent:-.5in;
+       mso-pagination:widow-orphan;
+       page-break-after:avoid;
+       mso-outline-level:3;
+       mso-list:l1 level3 lfo4;
+       tab-stops:list .5in;
+       font-size:11.0pt;
+       mso-bidi-font-size:12.0pt;
+       font-family:"Times New Roman";
+       mso-bidi-font-style:italic;}
+h4
+       {mso-style-next:Normal;
+       margin-top:12.0pt;
+       margin-right:0in;
+       margin-bottom:3.0pt;
+       margin-left:.6in;
+       text-indent:-.6in;
+       mso-pagination:widow-orphan;
+       page-break-after:avoid;
+       mso-outline-level:4;
+       mso-list:l1 level4 lfo4;
+       tab-stops:list .6in;
+       font-size:10.0pt;
+       mso-bidi-font-size:14.0pt;
+       font-family:"Times New Roman";}
+h5
+       {mso-style-next:Normal;
+       margin-top:0in;
+       margin-right:0in;
+       margin-bottom:0in;
+       margin-left:.7in;
+       margin-bottom:.0001pt;
+       text-indent:-.7in;
+       mso-pagination:widow-orphan;
+       page-break-after:avoid;
+       mso-outline-level:5;
+       mso-list:l1 level5 lfo4;
+       tab-stops:list .7in;
+       font-size:10.0pt;
+       mso-bidi-font-size:12.0pt;
+       font-family:"Times New Roman";}
+h6
+       {mso-style-next:Normal;
+       margin:0in;
+       margin-bottom:.0001pt;
+       mso-pagination:widow-orphan;
+       page-break-after:avoid;
+       mso-outline-level:6;
+       font-size:12.0pt;
+       font-family:"Times New Roman";}
+p.MsoHeading7, li.MsoHeading7, div.MsoHeading7
+       {mso-style-next:Normal;
+       margin-top:12.0pt;
+       margin-right:0in;
+       margin-bottom:3.0pt;
+       margin-left:.9in;
+       text-indent:-.9in;
+       mso-pagination:widow-orphan;
+       mso-outline-level:7;
+       tab-stops:list .9in;
+       font-size:10.0pt;
+       mso-bidi-font-size:12.0pt;
+       font-family:"Times New Roman";
+       mso-fareast-font-family:"Times New Roman";}
+p.MsoHeading8, li.MsoHeading8, div.MsoHeading8
+       {mso-style-next:Normal;
+       margin-top:12.0pt;
+       margin-right:0in;
+       margin-bottom:3.0pt;
+       margin-left:1.0in;
+       text-indent:-1.0in;
+       mso-pagination:widow-orphan;
+       mso-outline-level:8;
+       tab-stops:list 1.0in;
+       font-size:10.0pt;
+       mso-bidi-font-size:12.0pt;
+       font-family:"Times New Roman";
+       mso-fareast-font-family:"Times New Roman";
+       font-style:italic;}
+p.MsoHeading9, li.MsoHeading9, div.MsoHeading9
+       {mso-style-next:Normal;
+       margin-top:12.0pt;
+       margin-right:0in;
+       margin-bottom:3.0pt;
+       margin-left:1.1in;
+       text-indent:-1.1in;
+       mso-pagination:widow-orphan;
+       mso-outline-level:9;
+       tab-stops:list 1.1in;
+       font-size:11.0pt;
+       font-family:Arial;
+       mso-fareast-font-family:"Times New Roman";
+       mso-bidi-font-family:"Times New Roman";}
+p.MsoToc1, li.MsoToc1, div.MsoToc1
+       {mso-style-update:auto;
+       mso-style-next:Normal;
+       margin:0in;
+       margin-bottom:.0001pt;
+       mso-pagination:widow-orphan;
+       font-size:12.0pt;
+       font-family:"Courier New";
+       mso-fareast-font-family:"Times New Roman";
+       mso-bidi-font-family:"Times New Roman";
+       font-weight:bold;
+       mso-bidi-font-weight:normal;}
+p.MsoToc2, li.MsoToc2, div.MsoToc2
+       {mso-style-update:auto;
+       mso-style-parent:"TOC 1";
+       mso-style-next:Normal;
+       margin-top:0in;
+       margin-right:0in;
+       margin-bottom:0in;
+       margin-left:.2in;
+       margin-bottom:.0001pt;
+       mso-pagination:widow-orphan;
+       tab-stops:24.0pt right dotted 431.5pt;
+       font-size:11.0pt;
+       mso-bidi-font-size:12.0pt;
+       font-family:"Courier New";
+       mso-fareast-font-family:"Times New Roman";
+       mso-bidi-font-family:"Times New Roman";}
+p.MsoToc3, li.MsoToc3, div.MsoToc3
+       {mso-style-update:auto;
+       mso-style-next:Normal;
+       margin-top:0in;
+       margin-right:0in;
+       margin-bottom:0in;
+       margin-left:24.0pt;
+       margin-bottom:.0001pt;
+       mso-pagination:widow-orphan;
+       font-size:10.0pt;
+       mso-bidi-font-size:12.0pt;
+       font-family:"Times New Roman";
+       mso-fareast-font-family:"Times New Roman";}
+p.MsoCommentText, li.MsoCommentText, div.MsoCommentText
+       {margin:0in;
+       margin-bottom:.0001pt;
+       mso-pagination:widow-orphan;
+       font-size:10.0pt;
+       font-family:"Times New Roman";
+       mso-fareast-font-family:"Times New Roman";}
+p.MsoHeader, li.MsoHeader, div.MsoHeader
+       {margin:0in;
+       margin-bottom:.0001pt;
+       mso-pagination:widow-orphan;
+       tab-stops:center 3.0in right 6.0in;
+       font-size:10.0pt;
+       mso-bidi-font-size:12.0pt;
+       font-family:"Times New Roman";
+       mso-fareast-font-family:"Times New Roman";}
+p.MsoFooter, li.MsoFooter, div.MsoFooter
+       {margin:0in;
+       margin-bottom:.0001pt;
+       mso-pagination:widow-orphan;
+       tab-stops:center 3.0in right 6.0in;
+       font-size:10.0pt;
+       mso-bidi-font-size:12.0pt;
+       font-family:"Times New Roman";
+       mso-fareast-font-family:"Times New Roman";}
+p.MsoCaption, li.MsoCaption, div.MsoCaption
+       {mso-style-next:Normal;
+       margin-top:6.0pt;
+       margin-right:0in;
+       margin-bottom:6.0pt;
+       margin-left:0in;
+       mso-pagination:widow-orphan;
+       font-size:11.0pt;
+       mso-bidi-font-size:10.0pt;
+       font-family:Helvetica;
+       mso-fareast-font-family:"Times New Roman";
+       mso-bidi-font-family:"Times New Roman";
+       font-style:italic;
+       mso-bidi-font-style:normal;}
+p.MsoTof, li.MsoTof, div.MsoTof
+       {mso-style-update:auto;
+       mso-style-next:Normal;
+       margin-top:0in;
+       margin-right:0in;
+       margin-bottom:0in;
+       margin-left:24.0pt;
+       margin-bottom:.0001pt;
+       text-indent:-24.0pt;
+       mso-pagination:widow-orphan;
+       font-size:10.0pt;
+       mso-bidi-font-size:12.0pt;
+       font-family:"Times New Roman";
+       mso-fareast-font-family:"Times New Roman";}
+span.MsoCommentReference
+       {mso-ansi-font-size:8.0pt;
+       mso-bidi-font-size:8.0pt;}
+p.MsoListBullet, li.MsoListBullet, div.MsoListBullet
+       {mso-style-update:auto;
+       margin-top:0in;
+       margin-right:0in;
+       margin-bottom:0in;
+       margin-left:.25in;
+       margin-bottom:.0001pt;
+       text-indent:-.25in;
+       mso-pagination:widow-orphan;
+       mso-list:l0 level1 lfo7;
+       tab-stops:list .25in left 1.25in;
+       mso-layout-grid-align:none;
+       punctuation-wrap:simple;
+       text-autospace:none;
+       font-size:11.0pt;
+       mso-bidi-font-size:10.0pt;
+       font-family:"Times New Roman";
+       mso-fareast-font-family:"\FF2D\FF33 \FF30\30B4\30B7\30C3\30AF";
+       mso-fareast-language:JA;}
+p.MsoListBullet2, li.MsoListBullet2, div.MsoListBullet2
+       {margin-top:0in;
+       margin-right:0in;
+       margin-bottom:0in;
+       margin-left:74.9pt;
+       margin-bottom:.0001pt;
+       text-indent:-17.3pt;
+       mso-pagination:widow-orphan;
+       mso-list:l5 level1 lfo10;
+       tab-stops:list 1.05in left 1.25in;
+       mso-layout-grid-align:none;
+       punctuation-wrap:simple;
+       text-autospace:none;
+       font-size:10.0pt;
+       font-family:"Times New Roman";
+       mso-fareast-font-family:"\FF2D\FF33 \FF30\30B4\30B7\30C3\30AF";
+       mso-fareast-language:JA;}
+p.MsoBodyTextIndent, li.MsoBodyTextIndent, div.MsoBodyTextIndent
+       {margin-top:0in;
+       margin-right:0in;
+       margin-bottom:0in;
+       margin-left:.5in;
+       margin-bottom:.0001pt;
+       mso-pagination:widow-orphan;
+       font-size:10.0pt;
+       mso-bidi-font-size:12.0pt;
+       font-family:"Times New Roman";
+       mso-fareast-font-family:"Times New Roman";}
+p.MsoBodyText2, li.MsoBodyText2, div.MsoBodyText2
+       {margin:0in;
+       margin-bottom:.0001pt;
+       mso-pagination:widow-orphan;
+       font-size:10.0pt;
+       mso-bidi-font-size:12.0pt;
+       font-family:"Times New Roman";
+       mso-fareast-font-family:"Times New Roman";}
+a:link, span.MsoHyperlink
+       {color:blue;
+       text-decoration:underline;
+       text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+       {color:purple;
+       text-decoration:underline;
+       text-underline:single;}
+p.Figure1, li.Figure1, div.Figure1
+       {mso-style-name:"Figure\:1";
+       mso-style-update:auto;
+       margin:0in;
+       margin-bottom:.0001pt;
+       text-align:center;
+       text-indent:0in;
+       mso-pagination:widow-orphan;
+       mso-list:l3 level1 lfo12;
+       tab-stops:list .5in;
+       font-size:10.0pt;
+       mso-bidi-font-size:12.0pt;
+       font-family:Helvetica;
+       mso-fareast-font-family:"Times New Roman";
+       mso-bidi-font-family:"Times New Roman";}
+p.Table1, li.Table1, div.Table1
+       {mso-style-name:"Table 1 \:";
+       mso-style-update:auto;
+       mso-style-parent:"Figure\:1";
+       margin-top:0in;
+       margin-right:0in;
+       margin-bottom:0in;
+       margin-left:.25in;
+       margin-bottom:.0001pt;
+       text-align:center;
+       text-indent:-.25in;
+       mso-pagination:widow-orphan;
+       mso-list:l2 level1 lfo14;
+       tab-stops:list 1.0in;
+       font-size:10.0pt;
+       mso-bidi-font-size:12.0pt;
+       font-family:Helvetica;
+       mso-fareast-font-family:"Times New Roman";
+       mso-bidi-font-family:"Times New Roman";}
+p.kccomment, li.kccomment, div.kccomment
+       {mso-style-name:"kc comment";
+       margin:0in;
+       margin-bottom:.0001pt;
+       mso-pagination:widow-orphan;
+       font-size:10.0pt;
+       mso-bidi-font-size:12.0pt;
+       font-family:"Times New Roman";
+       mso-fareast-font-family:"Times New Roman";
+       color:blue;
+       vertical-align:super;}
+p.NOTE, li.NOTE, div.NOTE
+       {mso-style-name:NOTE;
+       mso-style-update:auto;
+       margin-top:0in;
+       margin-right:0in;
+       margin-bottom:0in;
+       margin-left:.7in;
+       margin-bottom:.0001pt;
+       text-indent:-.7in;
+       mso-pagination:widow-orphan;
+       mso-list:l10 level1 lfo16;
+       tab-stops:list .75in;
+       border:none;
+       mso-border-top-alt:solid windowtext .5pt;
+       mso-border-bottom-alt:solid windowtext .5pt;
+       padding:0in;
+       mso-padding-alt:1.0pt 0in 1.0pt 0in;
+       font-size:10.0pt;
+       mso-bidi-font-size:12.0pt;
+       font-family:"Times New Roman";
+       mso-fareast-font-family:"Times New Roman";}
+p.Numberedlist, li.Numberedlist, div.Numberedlist
+       {mso-style-name:"Numbered list";
+       mso-style-update:auto;
+       margin-top:0in;
+       margin-right:0in;
+       margin-bottom:0in;
+       margin-left:.5in;
+       margin-bottom:.0001pt;
+       text-indent:-.25in;
+       mso-pagination:widow-orphan;
+       mso-list:l9 level1 lfo18;
+       tab-stops:list .5in;
+       font-size:10.0pt;
+       mso-bidi-font-size:12.0pt;
+       font-family:"Times New Roman";
+       mso-fareast-font-family:"Times New Roman";}
+p.TableTitle, li.TableTitle, div.TableTitle
+       {mso-style-name:"Table Title";
+       margin-top:12.0pt;
+       margin-right:0in;
+       margin-bottom:12.0pt;
+       margin-left:0in;
+       mso-pagination:widow-orphan;
+       font-size:11.0pt;
+       mso-bidi-font-size:10.0pt;
+       font-family:Helvetica;
+       mso-fareast-font-family:"Times New Roman";
+       mso-bidi-font-family:"Times New Roman";
+       font-style:italic;
+       mso-bidi-font-style:normal;}
+p.tavlecell, li.tavlecell, div.tavlecell
+       {mso-style-name:"tavle cell";
+       mso-style-parent:"Table Title";
+       margin-top:12.0pt;
+       margin-right:0in;
+       margin-bottom:12.0pt;
+       margin-left:0in;
+       mso-pagination:widow-orphan;
+       font-size:11.0pt;
+       mso-bidi-font-size:10.0pt;
+       font-family:Helvetica;
+       mso-fareast-font-family:"Times New Roman";
+       mso-bidi-font-family:"Times New Roman";}
+p.Listb1, li.Listb1, div.Listb1
+       {mso-style-name:"List\:b1";
+       margin-top:0in;
+       margin-right:0in;
+       margin-bottom:0in;
+       margin-left:1.5in;
+       margin-bottom:.0001pt;
+       text-indent:-.25in;
+       mso-pagination:widow-orphan;
+       mso-list:l4 level3 lfo20;
+       tab-stops:list 1.5in;
+       font-size:10.0pt;
+       mso-bidi-font-size:12.0pt;
+       font-family:"Times New Roman";
+       mso-fareast-font-family:"Times New Roman";}
+p.Code, li.Code, div.Code
+       {mso-style-name:Code;
+       margin-top:6.0pt;
+       margin-right:0in;
+       margin-bottom:0in;
+       margin-left:0in;
+       margin-bottom:.0001pt;
+       mso-pagination:widow-orphan;
+       font-size:9.0pt;
+       mso-bidi-font-size:10.0pt;
+       font-family:Courier;
+       mso-fareast-font-family:"Times New Roman";
+       mso-bidi-font-family:"Times New Roman";}
+p.Paragraph, li.Paragraph, div.Paragraph
+       {mso-style-name:Paragraph;
+       margin-top:9.0pt;
+       margin-right:0in;
+       margin-bottom:0in;
+       margin-left:1.5in;
+       margin-bottom:.0001pt;
+       text-align:justify;
+       mso-pagination:widow-orphan;
+       font-size:10.0pt;
+       font-family:Arial;
+       mso-fareast-font-family:"Times New Roman";
+       mso-bidi-font-family:"Times New Roman";}
+p.Bullet1, li.Bullet1, div.Bullet1
+       {mso-style-name:"Bullet 1";
+       margin-top:9.0pt;
+       margin-right:0in;
+       margin-bottom:0in;
+       margin-left:1.75in;
+       margin-bottom:.0001pt;
+       text-indent:-.25in;
+       mso-pagination:widow-orphan;
+       page-break-after:avoid;
+       mso-list:l7 level1 lfo22;
+       tab-stops:list .25in;
+       font-size:10.0pt;
+       font-family:Helvetica;
+       mso-fareast-font-family:"Times New Roman";
+       mso-bidi-font-family:"Times New Roman";}
+p.TableCell, li.TableCell, div.TableCell
+       {mso-style-name:"Table Cell";
+       margin:0in;
+       margin-bottom:.0001pt;
+       mso-pagination:widow-orphan;
+       font-size:9.0pt;
+       mso-bidi-font-size:10.0pt;
+       font-family:Helvetica;
+       mso-fareast-font-family:"Times New Roman";
+       mso-bidi-font-family:"Times New Roman";}
+p.tableheading, li.tableheading, div.tableheading
+       {mso-style-name:"table heading";
+       mso-style-parent:Paragraph;
+       margin-top:9.0pt;
+       margin-right:0in;
+       margin-bottom:0in;
+       margin-left:1.5in;
+       margin-bottom:.0001pt;
+       text-align:justify;
+       mso-pagination:widow-orphan;
+       layout-grid-mode:char;
+       font-size:10.0pt;
+       font-family:Arial;
+       mso-fareast-font-family:"Times New Roman";
+       mso-bidi-font-family:"Times New Roman";}
+p.Bullet2, li.Bullet2, div.Bullet2
+       {mso-style-name:"Bullet 2";
+       margin-top:6.0pt;
+       margin-right:0in;
+       margin-bottom:0in;
+       margin-left:2.0in;
+       margin-bottom:.0001pt;
+       text-indent:-.25in;
+       mso-pagination:widow-orphan;
+       mso-list:l8 level1 lfo24;
+       tab-stops:list .5in;
+       font-size:10.0pt;
+       font-family:Helvetica;
+       mso-fareast-font-family:"Times New Roman";
+       mso-bidi-font-family:"Times New Roman";}
+span.sourcecode
+       {mso-style-name:"source code";
+       mso-ansi-font-size:10.0pt;
+       mso-ascii-font-family:"Courier New";
+       mso-hansi-font-family:"Courier New";}
+span.Style1
+       {mso-style-name:Style1;
+       mso-ansi-font-size:10.0pt;
+       mso-ascii-font-family:"Courier New";
+       mso-hansi-font-family:"Courier New";}
+span.Markforscrutiny
+       {mso-style-name:"Mark for scrutiny";
+       color:blue;
+       text-underline:black;
+       text-decoration:underline;
+       text-underline:words;}
+@page Section1
+       {size:8.5in 11.0in;
+       margin:1.0in 1.25in 1.0in 1.25in;
+       mso-header-margin:.5in;
+       mso-footer-margin:.5in;
+       mso-header:url("./ti_disclaimer_files/header.htm") h1;
+       mso-paper-source:0;}
+div.Section1
+       {page:Section1;}
+ /* List Definitions */
+@list l0
+       {mso-list-id:-119;
+       mso-list-type:simple;
+       mso-list-template-ids:-973583428;}
+@list l0:level1
+       {mso-level-number-format:bullet;
+       mso-level-style-link:"List Bullet";
+       mso-level-text:\F0B7;
+       mso-level-tab-stop:.25in;
+       mso-level-number-position:left;
+       margin-left:.25in;
+       text-indent:-.25in;
+       font-family:Symbol;}
+@list l1
+       {mso-list-id:114177860;
+       mso-list-template-ids:-240241298;}
+@list l1:level1
+       {mso-level-style-link:"Heading 1";
+       mso-level-text:%1;
+       mso-level-tab-stop:.3in;
+       mso-level-number-position:left;
+       margin-left:.3in;
+       text-indent:-.3in;
+       mso-ansi-font-size:16.0pt;
+       font-family:"Times New Roman";
+       mso-ansi-font-weight:bold;
+       mso-ansi-font-style:normal;}
+@list l1:level2
+       {mso-level-style-link:"Heading 2";
+       mso-level-text:"%1\.%2";
+       mso-level-tab-stop:.4in;
+       mso-level-number-position:left;
+       margin-left:.4in;
+       text-indent:-.4in;
+       mso-ansi-font-size:14.0pt;
+       font-family:"Times New Roman";
+       mso-ansi-font-weight:bold;
+       mso-ansi-font-style:normal;}
+@list l1:level3
+       {mso-level-style-link:"Heading 3";
+       mso-level-text:"%1\.%2\.%3";
+       mso-level-tab-stop:.5in;
+       mso-level-number-position:left;
+       margin-left:.5in;
+       text-indent:-.5in;
+       mso-ansi-font-size:12.0pt;
+       font-family:"Times New Roman";
+       mso-ansi-font-weight:bold;
+       mso-ansi-font-style:normal;}
+@list l1:level4
+       {mso-level-style-link:"Heading 4";
+       mso-level-text:"%1\.%2\.%3\.%4";
+       mso-level-tab-stop:.6in;
+       mso-level-number-position:left;
+       margin-left:.6in;
+       text-indent:-.6in;}
+@list l1:level5
+       {mso-level-style-link:"Heading 5";
+       mso-level-text:"%1\.%2\.%3\.%4\.%5";
+       mso-level-tab-stop:.7in;
+       mso-level-number-position:left;
+       margin-left:.7in;
+       text-indent:-.7in;}
+@list l1:level6
+       {mso-level-style-link:"Heading 6";
+       mso-level-text:"%1\.%2\.%3\.%4\.%5\.%6";
+       mso-level-tab-stop:.8in;
+       mso-level-number-position:left;
+       margin-left:.8in;
+       text-indent:-.8in;}
+@list l1:level7
+       {mso-level-style-link:"Heading 7";
+       mso-level-text:"%1\.%2\.%3\.%4\.%5\.%6\.%7";
+       mso-level-tab-stop:.9in;
+       mso-level-number-position:left;
+       margin-left:.9in;
+       text-indent:-.9in;}
+@list l1:level8
+       {mso-level-style-link:"Heading 8";
+       mso-level-text:"%1\.%2\.%3\.%4\.%5\.%6\.%7\.%8";
+       mso-level-tab-stop:1.0in;
+       mso-level-number-position:left;
+       margin-left:1.0in;
+       text-indent:-1.0in;}
+@list l1:level9
+       {mso-level-style-link:"Heading 9";
+       mso-level-text:"%1\.%2\.%3\.%4\.%5\.%6\.%7\.%8\.%9";
+       mso-level-tab-stop:1.1in;
+       mso-level-number-position:left;
+       margin-left:1.1in;
+       text-indent:-1.1in;}
+@list l2
+       {mso-list-id:866141587;
+       mso-list-type:hybrid;
+       mso-list-template-ids:-1891331636 573486916 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
+@list l2:level1
+       {mso-level-style-link:"Table 1 \:";
+       mso-level-text:"Table %1\.  ";
+       mso-level-tab-stop:1.0in;
+       mso-level-number-position:left;
+       margin-left:.25in;
+       text-indent:-.25in;}
+@list l3
+       {mso-list-id:917978346;
+       mso-list-type:hybrid;
+       mso-list-template-ids:270981470 441357252 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
+@list l3:level1
+       {mso-level-style-link:"Figure\:1";
+       mso-level-text:"Figure %1\.";
+       mso-level-tab-stop:.45in;
+       mso-level-number-position:right;
+       margin-left:0in;
+       text-indent:.2in;
+       font-family:Tahoma;
+       mso-bidi-font-family:"Times New Roman";}
+@list l3:level2
+       {mso-level-start-at:0;
+       mso-level-number-format:bullet;
+       mso-level-text:-;
+       mso-level-tab-stop:1.0in;
+       mso-level-number-position:left;
+       text-indent:-.25in;
+       font-family:"Times New Roman";
+       mso-fareast-font-family:"Times New Roman";}
+@list l4
+       {mso-list-id:1041705939;
+       mso-list-type:hybrid;
+       mso-list-template-ids:-250713390 -225915076 67698691 1343286562 67698689 67698691 67698693 67698689 67698691 67698693;}
+@list l4:level1
+       {mso-level-number-format:bullet;
+       mso-level-text:\F0B7;
+       mso-level-tab-stop:.5in;
+       mso-level-number-position:left;
+       text-indent:-.25in;
+       font-family:Symbol;
+       color:windowtext;}
+@list l4:level2
+       {mso-level-number-format:bullet;
+       mso-level-text:o;
+       mso-level-tab-stop:1.0in;
+       mso-level-number-position:left;
+       text-indent:-.25in;
+       font-family:"Courier New";
+       mso-bidi-font-family:"Times New Roman";}
+@list l4:level3
+       {mso-level-number-format:bullet;
+       mso-level-style-link:"List\:b1";
+       mso-level-text:\F06F;
+       mso-level-tab-stop:1.5in;
+       mso-level-number-position:left;
+       text-indent:-.25in;
+       mso-ansi-font-size:8.0pt;
+       font-family:"Monotype Sorts";}
+@list l5
+       {mso-list-id:1093236455;
+       mso-list-type:simple;
+       mso-list-template-ids:131606724;}
+@list l5:level1
+       {mso-level-number-format:bullet;
+       mso-level-style-link:"List Bullet 2";
+       mso-level-text:\F0B7;
+       mso-level-tab-stop:1.05in;
+       mso-level-number-position:left;
+       margin-left:74.9pt;
+       text-indent:-17.3pt;
+       font-family:Symbol;
+       color:windowtext;}
+@list l6
+       {mso-list-id:1426875844;
+       mso-list-type:hybrid;
+       mso-list-template-ids:-852165276 1996774054 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
+@list l6:level1
+       {mso-level-style-link:"Heading 1";
+       mso-level-text:%1;
+       mso-level-tab-stop:.25in;
+       mso-level-number-position:left;
+       margin-left:.25in;
+       text-indent:-.25in;
+       mso-ansi-font-size:14.0pt;
+       font-family:"Times New Roman";
+       mso-ansi-font-weight:normal;
+       mso-ansi-font-style:normal;}
+@list l7
+       {mso-list-id:1777600239;
+       mso-list-type:simple;
+       mso-list-template-ids:-1885074454;}
+@list l7:level1
+       {mso-level-number-format:bullet;
+       mso-level-style-link:"Bullet 1";
+       mso-level-text:\F06F;
+       mso-level-tab-stop:.25in;
+       mso-level-number-position:left;
+       margin-left:.25in;
+       text-indent:-.25in;
+       mso-ansi-font-size:8.0pt;
+       font-family:"Monotype Sorts";}
+@list l8
+       {mso-list-id:1800804630;
+       mso-list-type:simple;
+       mso-list-template-ids:-1217263056;}
+@list l8:level1
+       {mso-level-number-format:bullet;
+       mso-level-style-link:"Bullet 2";
+       mso-level-text:\F06E;
+       mso-level-tab-stop:.5in;
+       mso-level-number-position:left;
+       text-indent:-.25in;
+       font-family:Wingdings;}
+@list l9
+       {mso-list-id:1927886878;
+       mso-list-type:hybrid;
+       mso-list-template-ids:791423806 -1960554494 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
+@list l9:level1
+       {mso-level-style-link:"Numbered list";
+       mso-level-tab-stop:.5in;
+       mso-level-number-position:left;
+       text-indent:-.25in;}
+@list l10
+       {mso-list-id:2138402816;
+       mso-list-type:hybrid;
+       mso-list-template-ids:-1806919098 1218187656 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
+@list l10:level1
+       {mso-level-number-format:none;
+       mso-level-style-link:NOTE;
+       mso-level-text:"Note \: ";
+       mso-level-tab-stop:.75in;
+       mso-level-number-position:left;
+       margin-left:.7in;
+       text-indent:-.7in;
+       font-family:Tahoma;
+       mso-bidi-font-family:"Times New Roman";
+       mso-ansi-font-weight:bold;
+       mso-ansi-font-style:normal;}
+@list l10:level2
+       {mso-level-number-format:alpha-lower;
+       mso-level-tab-stop:1.0in;
+       mso-level-number-position:left;
+       text-indent:-.25in;}
+ol
+       {margin-bottom:0in;}
+ul
+       {margin-bottom:0in;}
+-->
+</style>
+<!--[if gte mso 9]><xml>
+ <o:shapedefaults v:ext="edit" spidmax="5122"/>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <o:shapelayout v:ext="edit">
+  <o:idmap v:ext="edit" data="1"/>
+ </o:shapelayout></xml><![endif]-->
+</head>
+
+<body lang=EN-US link=blue vlink=purple style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p class=MsoNormal align=center style='text-align:center;mso-layout-grid-align:
+none;text-autospace:none'><a name="_Ref34544099"><b><span style='font-size:
+11.0pt;font-family:Arial;mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></b></a></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><b><span style='font-size:11.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>IMPORTANT NOTICE<o:p></o:p></span></b></span></p>
+
+<p class=MsoNormal align=center style='text-align:center;mso-layout-grid-align:
+none;text-autospace:none'><span style='mso-bookmark:_Ref34544099'><b><span
+style='font-size:11.0pt;font-family:Arial;mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></b></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>Texas Instruments and its
+subsidiaries (TI) reserve the right to make changes to their products or to
+discontinue any<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>product or service without
+notice, and advise customers to obtain the latest version of relevant
+information to verify, before<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>placing orders, that information
+being relied on is current and complete. All products are sold subject to the
+terms and<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>conditions of sale supplied at
+the time of order acknowledgment, including those pertaining to warranty,
+patent<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>infringement, and limitation of
+liability.<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>TI warrants performance of its
+products to the specifications applicable at the time of sale in accordance
+with TI\92s<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>standard warranty. Testing and
+other quality control techniques are utilized to the extent TI deems necessary
+to support<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>this warranty. Specific testing
+of all parameters of each device is not necessarily performed, except those
+mandated by<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>government requirements.<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>Customers are responsible for
+their applications using TI components.<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>In order to minimize risks
+associated with the customer\92s applications, adequate design and operating
+safeguards must be<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>provided by the customer to
+minimize inherent or procedural hazards.<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>TI assumes no liability for
+applications assistance or customer product design. TI does not warrant or
+represent that any<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>license, either express or
+implied, is granted under any patent right, copyright, mask work right, or
+other intellectual<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>property right of TI covering or
+relating to any combination, machine, or process in which such products or
+services might<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>be or are used. TI\92s publication
+of information regarding any third party\92s products or services does not
+constitute TI\92s<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>approval, license, warranty or
+endorsement thereof.<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>Reproduction of information in TI
+data books or data sheets is permissible only if reproduction is without
+alteration and is<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>accompanied by all associated
+warranties, conditions, limitations and notices. Representation or reproduction
+o f this<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>information with alteration voids
+all warranties provided for an associated TI product or service, is an unfair
+and deceptive<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>business practice, and TI is not
+responsible nor liable for any such use.<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>Resale of TI\92s products or
+services with <i><u>statements different from or beyond the parameters</u> </i>stated
+by TI for that product<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>or service voids all express and
+any implied warranties for the associated TI product or service, is an unfair
+and deceptive<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>business practice, and TI is not
+responsible nor liable for any such use.<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>Also see: Standard Terms and
+Conditions of Sale for Semiconductor Products </span></span><a
+href="http://www.ti.com/sc/docs/stdterms.htm"><span style='mso-bookmark:_Ref34544099'>http://www.ti.com/sc/docs/stdterms.htm</span><span
+style='mso-bookmark:_Ref34544099'></span></a><span style='mso-bookmark:_Ref34544099'><span
+style='font-size:8.0pt;font-family:Arial;mso-bidi-font-family:"Times New Roman"'><o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>Mailing Address:<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>Texas Instruments<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>Post Office Box 655303<o:p></o:p></span></span></p>
+
+<p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
+style='mso-bookmark:_Ref34544099'><span style='font-size:8.0pt;font-family:
+Arial;mso-bidi-font-family:"Times New Roman"'>Dallas, Texas 75265</span></span><span
+style='mso-bookmark:_Ref34544099'><span style='mso-bidi-font-size:10.0pt;
+font-family:Arial;mso-bidi-font-family:"Times New Roman"'><o:p></o:p></span></span></p>
+
+<span style='mso-bookmark:_Ref34544099'></span>
+
+<p class=MsoHeader style='tab-stops:.5in center 3.0in right 6.0in'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
+
+<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
diff --git a/packages/ti/drv/cal/docs/doxygen/tifooter.htm b/packages/ti/drv/cal/docs/doxygen/tifooter.htm
new file mode 100644 (file)
index 0000000..4bdf9c9
--- /dev/null
@@ -0,0 +1,4 @@
+<hr size="1"><small>
+Copyright  $year, Texas Instruments Incorporated</small>
+</body>
+</html>
diff --git a/packages/ti/drv/cal/docs/doxygen/tiheader.htm b/packages/ti/drv/cal/docs/doxygen/tiheader.htm
new file mode 100644 (file)
index 0000000..57de9bb
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+<title>$title</title>
+<link href="$relpath$doxygen.css" rel="stylesheet" type="text/css">
+<link href="$relpath$tabs.css" rel="stylesheet" type="text/css">
+</head><body>
+<table width=100%>
+<tr>
+  <td bgcolor="black" width="1"><a href="http://www.ti.com"><img border=0 src="../tilogo.gif"></a></td>
+  <td bgcolor="red"><img src="../titagline.gif"></td>
+</tr>
+</table>
diff --git a/packages/ti/drv/cal/docs/doxygen/tilogo.gif b/packages/ti/drv/cal/docs/doxygen/tilogo.gif
new file mode 100644 (file)
index 0000000..f2fab2d
Binary files /dev/null and b/packages/ti/drv/cal/docs/doxygen/tilogo.gif differ
diff --git a/packages/ti/drv/cal/docs/doxygen/titagline.gif b/packages/ti/drv/cal/docs/doxygen/titagline.gif
new file mode 100644 (file)
index 0000000..743a024
Binary files /dev/null and b/packages/ti/drv/cal/docs/doxygen/titagline.gif differ
diff --git a/packages/ti/drv/cal/examples/cal_capture_test/makefile b/packages/ti/drv/cal/examples/cal_capture_test/makefile
new file mode 100644 (file)
index 0000000..e77eb11
--- /dev/null
@@ -0,0 +1,8 @@
+#
+# This file is the makefile for building CAL capture test app for TI RTOS
+#
+include $(PDK_INSTALL_PATH)/ti/build/Rules.make
+
+APP_NAME = cal_capture_testapp
+
+include makefile.mk
diff --git a/packages/ti/drv/cal/examples/cal_capture_test/makefile.mk b/packages/ti/drv/cal/examples/cal_capture_test/makefile.mk
new file mode 100644 (file)
index 0000000..8af700b
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# This file is the makefile for building CAL capture example application.
+#
+SRCDIR =   src
+INCDIR = . src
+
+# List all the external components/interfaces, whose interface header files
+# need to be included for this component
+INCLUDE_EXTERNAL_INTERFACES = pdk
+INCLUDE_INTERNAL_INTERFACES =
+
+# List all the components required by the application
+COMP_LIST_COMMON = csl fvid2 cal board uart i2c
+
+ifeq ($(SOC),$(filter $(SOC), am65xx))
+COMP_LIST_COMMON += sciclient
+endif
+
+CFLAGS_LOCAL_COMMON = $(PDK_CFLAGS) $(CAL_CFLAGS)
+
+ifeq ($(BUILD_OS_TYPE), baremetal)
+  COMP_LIST_COMMON += csl_init osal_nonos cal_app_utils_baremetal
+  SRCS_COMMON = main_baremetal.c
+  ifeq ($(ISA),$(filter $(ISA), a53))
+    LNKFLAGS_LOCAL_$(CORE) += --entry Entry
+  endif
+  CFLAGS_LOCAL_COMMON += -DBARE_METAL
+else
+  INCLUDE_EXTERNAL_INTERFACES += xdc bios
+  COMP_LIST_COMMON += osal_tirtos cal_app_utils
+  SRCS_COMMON = main_tirtos.c
+  # Enable XDC build for application by providing XDC CFG File per core
+  XDC_CFG_FILE_$(CORE) = $(PDK_INSTALL_PATH)/ti/build/$(SOC)/sysbios_$(ISA).cfg
+endif
+
+ifeq ($(CORE),$(filter $(CORE), mpu1_0 mpu1_1))
+EXTERNAL_LNKCMD_FILE_LOCAL = $(PDK_CAL_COMP_PATH)/examples/utils/src/V0/linker_cal_a53.lds
+endif
+
+PACKAGE_SRCS_COMMON = .
+
+# Common source files and CFLAGS across all platforms and cores
+SRCS_COMMON += CaptureCal_main.c
+
+# 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
diff --git a/packages/ti/drv/cal/examples/cal_capture_test/makefile_baremetal b/packages/ti/drv/cal/examples/cal_capture_test/makefile_baremetal
new file mode 100644 (file)
index 0000000..c2b842e
--- /dev/null
@@ -0,0 +1,9 @@
+#
+# This file is the makefile for building CAL capture test app for TI RTOS
+#
+include $(PDK_INSTALL_PATH)/ti/build/Rules.make
+
+APP_NAME = cal_baremetal_capture_testapp
+BUILD_OS_TYPE=baremetal
+
+include makefile.mk
diff --git a/packages/ti/drv/cal/examples/cal_capture_test/src/CaptureCal_main.c b/packages/ti/drv/cal/examples/cal_capture_test/src/CaptureCal_main.c
new file mode 100755 (executable)
index 0000000..91fdb59
--- /dev/null
@@ -0,0 +1,1303 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2018
+ *
+ *  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 CaptureCal_main.c
+ *
+ *  \brief CAL Capture demo application - Receives via CSI2/Parallel and
+ *          write to memory
+ *         Most board / EVM specifics are handled in function
+ *          appCaptcreateVidSensor () In addition to configuring the sensor
+ *          for the given config and enable sensor to stream.
+ *         On AM65xx only CSI2 based capture is supported.
+ */
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+
+#include <CaptureCal_main.h>
+
+/* ========================================================================== */
+/*                           Macros & Typedefs                                */
+/* ========================================================================== */
+
+/**< CSI2 PHY Clock Custom sensor. */
+#define APP_CAPT_CAL_SENSOR_BYPASS_PHY_CLK_MHz (400U)
+
+#define APP_CAPT_MAX_WIDTH  (1280U)
+#define APP_CAPT_MAX_HEIGHT (720U)
+
+/* ========================================================================== */
+/*                         Structure Declarations                             */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                          Function Declarations                             */
+/* ========================================================================== */
+
+static void appCaptInit(appCaptObj_t *appObj);
+static void appCaptDeInit(appCaptObj_t *appObj);
+static void appCapture4GivenConfig(appCaptObj_t *appObj, appCaptCfg_t *pCfg);
+static void appCaptDeriveCfg(appCaptObj_t *appObj, appCaptCfg_t *pCfg);
+static int32_t appCaptCreateDrv(appCaptObj_t *appObj);
+static int32_t appCaptDeleteDrv(appCaptObj_t *appObj);
+static int32_t appCaptSetDrvCfg(appCaptObj_t *appObj, appCaptCfg_t *pCfg);
+static int32_t appCaptAllocAndQFrames(appCaptObj_t *appObj);
+static int32_t appCaptFreeFrames(appCaptObj_t *appObj);
+static void appCaptCountQ(appCaptObj_t *appObj, Fvid2_FrameList *frmList,
+                          uint32_t streamId);
+static void appCaptCountDQ(appCaptObj_t *appObj, Fvid2_FrameList *frmList,
+                           uint32_t streamId);
+static void appCaptChkDQCounts(appCaptObj_t *appObj);
+static int32_t appCaptGetTestId(appCaptObj_t *appObj);
+static void appCaptErrCb(const uint32_t *event, uint32_t numEvents, Ptr arg);
+static int32_t appCaptEnableErrorReporting(appCaptObj_t *appObj);
+static int32_t appCaptEnableFrameEventNotification(appCaptObj_t *appObj,
+                                                    appCaptCfg_t *pCfg);
+static void appCaptChkFrameEvents(appCaptObj_t *appObj);
+void App_print(const char *format, ...);
+
+/* ========================================================================== */
+/*                            Global Variables                                */
+/* ========================================================================== */
+
+/**< demo application object */
+appCaptObj_t gCaptAppObj;
+
+/**< Different capture options supported by this demo */
+appCaptCfg_t gTestCfg[] = {
+    {"Sensor Config Bypassed CSI2 4Lanes capture color bars from UB954 ",   0U,
+     TRUE,
+     FVID2_VIFM_SCH_CSI2,
+     FVID2_VIFW_4LANES, 1U, 0U, CAL_CSI2_RGB888, FVID2_CCSF_BITS8_PACKED,
+     CAPT_APP_RUN_COUNT, 1280U, 720U, (1280U * 3U),
+     FVID2_VID_SENSOR_BYPASS_CSI2_DRV,
+     FVID2_STD_1080P_30, FVID2_DF_BAYER_BGGR, FVID2_CCSF_BITS8_PACKED
+    },
+    {"UB964 & SAT0088 and OV10635 CSI2 4 channel capture ",   1U,
+     TRUE,
+     FVID2_VIFM_SCH_CSI2,
+     FVID2_VIFW_4LANES, 4U, 0U, CAL_CSI2_YUV422_8B, FVID2_CCSF_BITS10_PACKED,
+     CAPT_APP_RUN_COUNT, 1280U, 720U, (1280U * 2U),
+     FVID2_VID_SENSOR_MULDES_OV1063X_DRV,
+     FVID2_STD_720P_60, FVID2_DF_BAYER_GRBG, FVID2_CCSF_BITS16_PACKED
+    },
+};
+
+/**< Number of options supported */
+#define APP_CAPT_NUM_OPTS              (sizeof (gTestCfg) / \
+                                        sizeof (gTestCfg[0U]))
+
+/* ========================================================================== */
+/*                          Function Definitions                              */
+/* ========================================================================== */
+
+/*
+ * Test task main
+ */
+void Cal_captureTest(void)
+{
+    CalUtils_MemHeapStatus startHeapStat1;
+    appCaptObj_t          *appObj = &gCaptAppObj;
+    uint32_t testId;
+
+    memset(&gCaptAppObj, 0x0, sizeof (appCaptObj_t));
+    appCaptInit(appObj);
+
+    while (1U)
+    {
+        /* Get the TestId */
+        testId = appCaptGetTestId(appObj);
+        if (testId < APP_CAPT_NUM_OPTS)
+        {
+            CalUtils_memGetHeapStat(&startHeapStat1);
+
+            appCapture4GivenConfig(
+                appObj,
+                &gTestCfg[testId]);
+
+            CalUtils_memCheckHeapStat(&startHeapStat1);
+        }
+        else
+        {
+            /* Exit */
+            break;
+        }
+    }
+    GT_0trace(CalTrace, GT_INFO,
+              APP_NAME ": Sample Application - DONE !!!\r\n");
+
+    appCaptDeInit(appObj);
+
+    return;
+}
+
+static void appCaptInit(appCaptObj_t *appObj)
+{
+    int32_t         retVal;
+    Fvid2_InitPrms  initPrms;
+
+    /* Fvid2 init */
+    Fvid2InitPrms_init(&initPrms);
+    initPrms.printFxn = &App_print;
+    retVal = Fvid2_init(&initPrms);
+    if (retVal != FVID2_SOK)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Fvid2 Init Failed!!!\r\n");
+    }
+       else
+       {
+               /* Prints require the fvid2 init to be done.
+                * So app start print is moved here. */
+               GT_0trace(CalTrace, GT_INFO,
+              APP_NAME ": Sample Application - STARTS !!!\r\n");
+       }
+
+    /* Cal init */
+    retVal = Cal_init();
+    if (retVal != FVID2_SOK)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": CAL Init Failed!!!\r\n");
+    }
+
+    retVal = CalUtils_memInit();
+    if (retVal != FVID2_SOK)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Mem Init Failed!!!\r\n");
+    }
+    CalUtils_memClearOnAlloc(TRUE);
+
+    if (FVID2_SOK == retVal)
+    {
+        GT_0trace(CalTrace, GT_INFO,
+                  APP_NAME ": CAL APP Initialized\r\n");
+    }
+
+    return;
+}
+
+static void appCaptDeInit(appCaptObj_t *appObj)
+{
+       int32_t         retVal;
+    /* Cal de-init */
+       retVal = CalUtils_memDeInit();
+    if (retVal != FVID2_SOK)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Mem De Init Failed!!!\r\n");
+    }
+
+       retVal = Cal_deInit();
+    if (retVal != FVID2_SOK)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": CAL De Init Failed!!!\r\n");
+    }
+
+    retVal = Fvid2_deInit(NULL);
+    if (retVal != FVID2_SOK)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Fvid2 De Init Failed!!!\r\n");
+    }
+
+    return;
+}
+
+/**
+ *  appCapture4GivenConfig
+ *  Capture test function.
+ */
+static void appCapture4GivenConfig(appCaptObj_t *appObj, appCaptCfg_t *pCfg)
+{
+    int32_t           retVal = FVID2_SOK;
+    volatile uint32_t lastFrameNo = 0;
+
+    /* Print test case information */
+    GT_1trace(CalTrace, GT_INFO,
+              APP_NAME ": Configured to capture %d frames \r\n",
+              pCfg->numFrames);
+    memcpy(&appObj->testPrms, pCfg, sizeof (appCaptCfg_t));
+
+    appObj->instId = CAL_CAPT_INST_ID_A_ID;
+
+    /* Make config required for open */
+    appCaptDeriveCfg(appObj, pCfg);
+
+    retVal = appCaptCreateDrv(appObj);
+    if (FVID2_SOK != retVal)
+    {
+        return;
+    }
+
+    retVal = appCaptSetDrvCfg(appObj, pCfg);
+    if (FVID2_SOK != retVal)
+    {
+        return;
+    }
+
+    retVal = appCaptEnableErrorReporting(appObj);
+    if (FVID2_SOK != retVal)
+    {
+        return;
+    }
+
+    retVal = appCaptEnableFrameEventNotification(appObj, pCfg);
+    if (FVID2_SOK != retVal)
+    {
+        return;
+    }
+
+    retVal = appCaptAllocAndQFrames(appObj);
+    if (FVID2_SOK != retVal)
+    {
+        return;
+    }
+
+    CalUtils_sensorConfigInit(pCfg->sensorDriverId);
+
+    appObj->rcvedFramesCount = 0x0;
+    appObj->frameWithCrcErrorCnt = 0x0;
+    appObj->frameWithWarning = 0x0;
+    appObj->frameErrorCnt = 0x0;
+    appObj->sofIntCount = 0x0;
+    appObj->unExpectedIntCnt = 0x0;
+    appObj->crcErrIntCnt = 0x0;
+    appObj->eccErrIntCnt = 0x0;
+    appObj->nLineEventIdx = 0x0;
+    appObj->eofEventIdx[0U] = 0x0;
+    appObj->eofEventIdx[1U] = 0x0;
+    appObj->eofEventIdx[2U] = 0x0;
+    appObj->eofEventIdx[3U] = 0x0;
+    appObj->frameEventTrack = 1U;
+    lastFrameNo = 0x0U;
+
+    GT_0trace(CalTrace, GT_INFO, APP_NAME ": Starting Capture now...\r\n");
+
+    retVal    = Fvid2_start(appObj->drvHandle, NULL);
+    if (FVID2_SOK != retVal)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Capture Start Failed!!!\r\n");
+        return;
+    }
+
+    /* Wait for reception completion */
+    while (appObj->rcvedFramesCount <
+           (appObj->numFramesToCapture * pCfg->numStreams))
+    {
+        if ((0U == lastFrameNo) && (appObj->rcvedFramesCount))
+        {
+            lastFrameNo = appObj->rcvedFramesCount;
+            GT_0trace(CalTrace, GT_INFO, APP_NAME ": Stream Detected!!!\r\n");
+        }
+    }
+
+    /* Disable time stamping of frame events */
+    appObj->frameEventTrack = 0U;
+
+    retVal = Fvid2_stop(appObj->drvHandle, NULL);
+    if (FVID2_SOK != retVal)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Capture Stop Failed!!!\r\n");
+        return;
+    }
+
+    retVal = appCaptFreeFrames(appObj);
+    if (FVID2_SOK != retVal)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Capture Stop Failed!!!\r\n");
+        return;
+    }
+
+    appCaptChkDQCounts(appObj);
+
+    appCaptChkFrameEvents(appObj);
+
+    retVal = appCaptDeleteDrv(appObj);
+    if (FVID2_SOK != retVal)
+    {
+        return;
+    }
+    CalUtils_sensorConfigDeInit(pCfg->sensorDriverId);
+
+       GT_0trace(CalTrace, GT_INFO, APP_NAME "All Tests Have Passed\r\n");
+    return;
+}
+
+/**
+ *  appCaptCb
+ *  \brief Driver callback function.
+ */
+static int32_t appCaptCb(Fvid2_Handle handle, Ptr appData, Ptr reserved)
+{
+    int32_t  retVal = FVID2_SOK;
+    uint32_t streamId, frmIdx;
+    static Fvid2_FrameList frmList;
+    Fvid2_Frame *pFrm;
+    appCaptObj_t *appObj = (appCaptObj_t *) appData;
+    GT_assert(CalTrace, appData != NULL);
+
+    for (streamId = 0U; streamId < appObj->numStream; streamId++)
+    {
+        retVal = Fvid2_dequeue(
+            appObj->drvHandle,
+            &frmList,
+            streamId,
+            FVID2_TIMEOUT_NONE);
+        if (FVID2_SOK == retVal)
+        {
+            for (frmIdx = 0; frmIdx < frmList.numFrames; frmIdx++)
+            {
+                pFrm = frmList.frames[frmIdx];
+                if (FVID2_FRAME_STATUS_COMPLETED != pFrm->status)
+                {
+                    switch (pFrm->status)
+                    {
+                        case FVID2_FRAME_STATUS_CRC_ERROR:
+                            appObj->frameWithCrcErrorCnt++;
+                        break;
+
+                        case FVID2_FRAME_STATUS_ECC_CORRECTED:
+                            appObj->frameWithWarning++;
+                        break;
+
+                        case FVID2_FRAME_STATUS_OVERFLOW:
+                        case FVID2_FRAME_STATUS_ECC_ERROR:
+                            appObj->frameErrorCnt++;
+                        break;
+                        default:
+                            appObj->frameErrorCnt++;
+                        break;
+                    }
+                }
+            }
+
+            appCaptCountDQ(appObj, &frmList, streamId);
+            appCaptCountQ(appObj, &frmList, streamId);
+
+            retVal = Fvid2_queue(appObj->drvHandle, &frmList, streamId);
+            if (FVID2_SOK != retVal)
+            {
+                GT_0trace(CalTrace, GT_ERR,
+                          APP_NAME ": Capture Queue Failed!!!\r\n");
+            }
+        }
+        appObj->rcvedFramesCount += frmList.numFrames;
+        appObj->totalFrmCount    += frmList.numFrames;
+    }
+    return FVID2_SOK;
+}
+
+/**
+ *  appCaptDeriveCfg
+ *  Initialize the global variables and frame pointers.
+ */
+static void appCaptDeriveCfg(appCaptObj_t *appObj, appCaptCfg_t *pCfg)
+{
+    uint32_t streamId;
+    Cal_CaptCreateParams  *createPrms;
+    Cal_CmplxIoCfg_t *pCmplxIoCfg;
+
+    appObj->maxWidth      = APP_CAPT_MAX_WIDTH;
+    appObj->maxHeight     = APP_CAPT_MAX_HEIGHT;
+    appObj->totalFrmCount = 0U;
+    appObj->totalCpuLoad  = 0U;
+    appObj->cpuLoadCount  = 0U;
+
+    appObj->instId    = CAL_CAPT_INST_ID_A_ID;
+    appObj->drvHandle = NULL;
+    Fvid2CbParams_init(&appObj->cbPrms);
+    appObj->cbPrms.cbFxn   = (Fvid2_CbFxn) &appCaptCb;
+    appObj->cbPrms.appData = appObj;
+
+    appObj->numStream = pCfg->numStreams;
+    GT_assert(CalTrace, ((0U < pCfg->numStreams) &&
+                            (pCfg->numStreams < CAL_CAPT_MAX_STREAMS)));
+
+    createPrms = &appObj->createPrms;
+    CalCaptCreateParams_init(&appObj->createPrms);
+    createPrms->videoIfMode     = pCfg->interfaceType;
+    createPrms->videoIfWidth    = pCfg->interfacewidth;
+    createPrms->bufCaptMode     = CAL_CAPT_BCM_LAST_FRM_REPEAT;
+    createPrms->numCh           = 1U;
+    createPrms->numStream       = appObj->numStream;
+    createPrms->pAdditionalArgs = &appObj->calOpenPrms;
+
+    appObj->calOpenPrms.csi2PhyClock[0] =
+                                APP_CAPT_CAL_SENSOR_BYPASS_PHY_CLK_MHz;
+
+    if (FVID2_VIFM_SCH_CPI == pCfg->interfaceType)
+    {
+        appObj->calOpenPrms.subModules[0U] =
+            (CAL_CAPT_INST_ID_SUB_CPORT_ID |
+             CAL_CAPT_INST_ID_SUB_DMA_WR_ID |
+             CAL_CAPT_INST_ID_SUB_DPCM_ENC_ID |
+             CAL_CAPT_INST_ID_SUB_PIX_PACK_ID |
+             CAL_CAPT_INST_ID_SUB_BYS_IN_ID);
+    }
+    else
+    {
+        appObj->calOpenPrms.subModules[0U] =
+            (CAL_CAPT_INST_ID_SUB_PPI_ID_0 |
+             CAL_CAPT_INST_ID_SUB_CSI2_ID |
+             CAL_CAPT_INST_ID_SUB_CPORT_ID |
+             CAL_CAPT_INST_ID_SUB_DMA_WR_ID |
+             CAL_CAPT_INST_ID_SUB_PIX_EXTRACT_ID |
+             CAL_CAPT_INST_ID_SUB_DPCM_DEC_ID |
+             CAL_CAPT_INST_ID_SUB_DPCM_ENC_ID |
+             CAL_CAPT_INST_ID_SUB_PIX_PACK_ID);
+    }
+
+    if (FVID2_VID_SENSOR_MULDES_OV1063X_DRV == pCfg->sensorDriverId)
+    {
+        appObj->calOpenPrms.subModules[1U] =
+            (
+                CAL_CAPT_INST_ID_SUB_PPI_ID_0 |
+                CAL_CAPT_INST_ID_SUB_CSI2_ID |
+                CAL_CAPT_INST_ID_SUB_CPORT_ID |
+                CAL_CAPT_INST_ID_SUB_DMA_WR_ID |
+                CAL_CAPT_INST_ID_SUB_PIX_EXTRACT_ID |
+                CAL_CAPT_INST_ID_SUB_DPCM_DEC_ID |
+                CAL_CAPT_INST_ID_SUB_DPCM_ENC_ID |
+                CAL_CAPT_INST_ID_SUB_PIX_PACK_ID);
+        appObj->calOpenPrms.subModules[2U] =
+            (
+                CAL_CAPT_INST_ID_SUB_PPI_ID_0 |
+                CAL_CAPT_INST_ID_SUB_CSI2_ID |
+                CAL_CAPT_INST_ID_SUB_CPORT_ID |
+                CAL_CAPT_INST_ID_SUB_DMA_WR_ID |
+                CAL_CAPT_INST_ID_SUB_PIX_EXTRACT_ID |
+                CAL_CAPT_INST_ID_SUB_DPCM_DEC_ID |
+                CAL_CAPT_INST_ID_SUB_DPCM_ENC_ID |
+                CAL_CAPT_INST_ID_SUB_PIX_PACK_ID);
+        appObj->calOpenPrms.subModules[3U] =
+            (
+                CAL_CAPT_INST_ID_SUB_PPI_ID_0 |
+                CAL_CAPT_INST_ID_SUB_CSI2_ID |
+                CAL_CAPT_INST_ID_SUB_CPORT_ID |
+                CAL_CAPT_INST_ID_SUB_DMA_WR_ID |
+                CAL_CAPT_INST_ID_SUB_PIX_EXTRACT_ID |
+                CAL_CAPT_INST_ID_SUB_DPCM_DEC_ID |
+                CAL_CAPT_INST_ID_SUB_DPCM_ENC_ID |
+                CAL_CAPT_INST_ID_SUB_PIX_PACK_ID);
+    }
+
+    for (streamId = 0U; streamId < CAL_CAPT_MAX_CMPLXIO_INST; streamId++)
+    {
+        appObj->calOpenPrms.isCmplxIoCfgValid[streamId] = FALSE;
+    }
+    appObj->calOpenPrms.isCmplxIoCfgValid[0] = TRUE;
+
+    pCmplxIoCfg                = &appObj->calOpenPrms.cmplxIoCfg[0U];
+    pCmplxIoCfg->enable        = TRUE;
+
+    pCmplxIoCfg->clockLane.pol      = FALSE;
+    pCmplxIoCfg->clockLane.position = 1U;
+    pCmplxIoCfg->data1Lane.pol      = FALSE;
+    pCmplxIoCfg->data1Lane.position = 2U;
+    pCmplxIoCfg->data2Lane.pol      = FALSE;
+    pCmplxIoCfg->data2Lane.position = 3U;
+    pCmplxIoCfg->data3Lane.pol      = FALSE;
+    pCmplxIoCfg->data3Lane.position = 4U;
+    pCmplxIoCfg->data4Lane.pol      = FALSE;
+    pCmplxIoCfg->data4Lane.position = 5U;
+
+    if (FVID2_VIFW_3LANES == pCfg->interfacewidth)
+    {
+        pCmplxIoCfg->data4Lane.position = 0U;
+    }
+    if (FVID2_VIFW_2LANES == pCfg->interfacewidth)
+    {
+        pCmplxIoCfg->data3Lane.position = 0U;
+        pCmplxIoCfg->data4Lane.position = 0U;
+    }
+    if (FVID2_VIFW_1LANES == pCfg->interfacewidth)
+    {
+        pCmplxIoCfg->data2Lane.position = 0U;
+        pCmplxIoCfg->data3Lane.position = 0U;
+        pCmplxIoCfg->data4Lane.position = 0U;
+    }
+
+    for (streamId = 0U; streamId < appObj->numStream; streamId++)
+    {
+        createPrms->chNumMap[streamId][0U] =
+            Cal_captMakeChNum(appObj->instId, streamId, 0U);
+    }
+
+    return;
+}
+
+static int32_t appCaptCreateDrv(appCaptObj_t *appObj)
+{
+    int32_t retVal = FVID2_SOK;
+
+    appObj->drvHandle = Fvid2_create(
+        FVID2_CAL_CAPT_DRV_ID,
+        appObj->instId,
+        &appObj->createPrms,
+        &appObj->createStatus,
+        &appObj->cbPrms);
+    if ((NULL == appObj->drvHandle) ||
+        (appObj->createStatus.retVal != FVID2_SOK))
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Capture Create Failed!!!\r\n");
+        retVal = appObj->createStatus.retVal;
+    }
+
+    GT_0trace(CalTrace, GT_INFO, APP_NAME ": CAL Capture created\r\n");
+
+    return (retVal);
+}
+
+static int32_t appCaptDeleteDrv(appCaptObj_t *appObj)
+{
+    int32_t  retVal = FVID2_SOK;
+    uint32_t streamId;
+    static Fvid2_FrameList frmList;
+
+    for (streamId = 0U;
+         streamId < appObj->createPrms.numStream;
+         streamId++)
+    {
+        /* Dequeue all the request from the driver */
+        while (1U)
+        {
+            retVal = Fvid2_dequeue(
+                appObj->drvHandle,
+                &frmList,
+                streamId,
+                FVID2_TIMEOUT_NONE);
+            if (FVID2_SOK != retVal)
+            {
+                break;
+            }
+            else
+            {
+                appCaptCountDQ(appObj, &frmList, streamId);
+            }
+        }
+    }
+    retVal = Fvid2_delete(appObj->drvHandle, NULL);
+    if (FVID2_SOK != retVal)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Capture Delete Failed!!!\r\n");
+    }
+    else
+    {
+        appObj->drvHandle = NULL;
+    }
+
+    GT_0trace(CalTrace, GT_INFO, APP_NAME ": Capture Driver deleted\r\n");
+
+    return (retVal);
+}
+
+static int32_t appCaptSetDrvCfg(appCaptObj_t *appObj, appCaptCfg_t *pCfg)
+{
+    uint32_t i;
+    int32_t  retVal = FVID2_SOK;
+    appObj->numFramesToCapture = pCfg->numFrames;
+    appObj->cfg.numStream      = pCfg->numStreams;
+    for (i = 0; i < pCfg->numStreams; i++)
+    {
+        appObj->cfg.streamId[i] = i;
+
+        appObj->cfg.inFmt[i].width  = pCfg->width;
+        appObj->cfg.inFmt[i].height = pCfg->height;
+
+        appObj->cfg.inFmt[i].pitch[0]   = pCfg->pitch;
+        appObj->cfg.inFmt[i].dataFormat = 0x0U;
+        appObj->cfg.inFmt[i].ccsFormat  = pCfg->bpp;
+        appObj->cfg.csi2DataFormat[i]   = pCfg->inCsi2DataFormat;
+        if (0 == i)
+        {
+            appObj->cfg.csi2VirtualChanNo[i] = pCfg->virtualChannel;
+        }
+        else if (1 == i)
+        {
+            appObj->cfg.csi2VirtualChanNo[i] = 1U;
+        }
+        else if (2 == i)
+        {
+            appObj->cfg.csi2VirtualChanNo[i] = 2U;
+        }
+        else
+        {
+            appObj->cfg.csi2VirtualChanNo[i] = 3U;
+        }
+        appObj->cfg.streamType[i] = CAL_TAG_PIX_DATA;
+
+        appObj->cfg.isPixProcCfgValid[i] = FALSE;
+        appObj->cfg.isBysOutCfgValid[i]  = FALSE;
+
+        if (FVID2_VIFM_SCH_CPI == pCfg->interfaceType)
+        {
+            appObj->cfg.bysInEnable[0] = TRUE;
+        }
+        else
+        {
+            appObj->cfg.bysInEnable[i] = FALSE;
+        }
+        appObj->cfg.isVportCfgValid[i] = FALSE;
+
+        appObj->cfg.writeToMem[i] = TRUE;
+
+        if (((CAL_CSI2_RAW12 == pCfg->inCsi2DataFormat) ||
+             (CAL_CSI2_RAW14 == pCfg->inCsi2DataFormat)) ||
+            (CAL_CSI2_RAW10 == pCfg->inCsi2DataFormat))
+        {
+            appObj->cfg.pixProcCfg[i].extract = CAL_PIX_EXRCT_B14_MIPI;
+            if (CAL_CSI2_RAW12 == pCfg->inCsi2DataFormat)
+            {
+                appObj->cfg.pixProcCfg[i].extract =
+                    CAL_PIX_EXRCT_B12_MIPI;
+            }
+            if (CAL_CSI2_RAW10 == pCfg->inCsi2DataFormat)
+            {
+                appObj->cfg.pixProcCfg[i].extract =
+                    CAL_PIX_EXRCT_B10_MIPI;
+            }
+            appObj->cfg.isPixProcCfgValid[i]   = TRUE;
+            appObj->cfg.pixProcCfg[i].decCodec = CAL_DPCM_DEC_BYPASS;
+            appObj->cfg.pixProcCfg[i].enableDpcmInitContext = FALSE;
+            appObj->cfg.pixProcCfg[i].encCodec = CAL_DPCM_ENC_BYPASS;
+            appObj->cfg.pixProcCfg[i].pack     = CAL_PIX_PACK_B16;
+            /* Write in 16 bit container */
+            appObj->cfg.inFmt[i].pitch[0] = appObj->cfg.inFmt[i].width * 2;
+            appObj->cfg.inFmt[i].ccsFormat      = FVID2_CCSF_BITS8_PACKED;
+            if (FVID2_VID_SENSOR_MULDES_OV1063X_DRV == pCfg->sensorDriverId)
+            {
+                /* SAT0088 + OV10635 sends 10 bit YUV, the UB96x is configured
+                    to forward MS 8bits only, hence extract and process 8 bits
+                    only */
+                appObj->cfg.pixProcCfg[i].extract = CAL_PIX_EXRCT_B8;
+                appObj->cfg.pixProcCfg[i].pack    = CAL_PIX_PACK_B8;
+            }
+            if (FVID2_VID_SENSOR_BYPASS_CSI2_DRV == pCfg->sensorDriverId)
+            {
+                appObj->cfg.isPixProcCfgValid[i]   = FALSE;
+                appObj->cfg.inFmt[i].pitch[0] = appObj->cfg.inFmt[i].width * 3;
+                appObj->cfg.inFmt[i].ccsFormat      = FVID2_CCSF_BITS8_PACKED;
+            }
+        }
+    }
+
+    retVal = Fvid2_control(appObj->drvHandle, IOCTL_CAL_CAPT_SET_PARAMS,
+                           &appObj->cfg, NULL);
+    if (FVID2_SOK != retVal)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Capture Set CAL Params Failed!!!\r\n");
+    }
+
+    GT_0trace(CalTrace, GT_INFO, APP_NAME ": CAL Capture Configured\r\n");
+
+    return (retVal);
+}
+
+/**
+ *  \brief Allocate and queue frames to driver
+ */
+static int32_t appCaptAllocAndQFrames(appCaptObj_t *appObj)
+{
+    int32_t                  retVal = FVID2_SOK;
+    uint32_t                 streamId, idx;
+    uint32_t                 bufSize;
+    Fvid2_Format           fmt;
+    Fvid2_Frame           *pFrm;
+    static Fvid2_FrameList frmList;
+    static Char            fileStr[200U];
+    char                  *fmtStr;
+
+    /* for every stream and channel in a capture handle */
+    Fvid2FrameList_init(&frmList);
+    for (streamId = 0U; streamId < appObj->createPrms.numStream; streamId++)
+    {
+        Fvid2Format_init(&fmt);
+        fmt.width      = appObj->testPrms.width;
+        fmt.height     = appObj->testPrms.height;
+        fmt.pitch[0]   = appObj->testPrms.pitch;
+        fmt.ccsFormat  = FVID2_CCSF_BITS8_PACKED;
+        fmt.dataFormat = FVID2_DF_YUV422I_UYVY;
+
+        idx = streamId * CAPT_APP_FRAMES_PER_STREAM;
+
+        if (idx >= (CAPT_APP_FRAMES_PER_STREAM * CAL_CAPT_MAX_STREAMS))
+        {
+            GT_assert(CalTrace, FALSE);
+        }
+
+        pFrm = (Fvid2_Frame *) &appObj->frames[idx];
+
+        /* fill format with channel specific values  */
+        fmt.chNum = Cal_captMakeChNum(appObj->instId, streamId, 0U);
+
+        /*
+         * alloc memory based on 'format'
+         * Allocated frame info is put in frames[]
+         * CAPT_APP_FRAMES_PER_STREAM is the number of buffers per channel to
+         * allocate
+         */
+        retVal = CalUtils_memFrameAlloc(&fmt, pFrm,
+                                        CAPT_APP_FRAMES_PER_STREAM);
+        if (FVID2_SOK != retVal)
+        {
+            GT_0trace(CalTrace, GT_ERR,
+                      APP_NAME ": Capture Frame Alloc Failed!!!\r\n");
+            break;
+        }
+
+        fmtStr = "yuyv422";
+        if(CAL_CSI2_RGB888 == appObj->testPrms.inCsi2DataFormat)
+        {
+            fmtStr = "rgb888";
+        }
+        snprintf(fileStr, sizeof (fileStr),
+                 "captureCalOption%uStr%u_%s_prog_packed_%u_%u.tigf",
+                 (unsigned int) appObj->testPrms.cfgId,
+                 (unsigned int) streamId,
+                 fmtStr,
+                 (unsigned int) appObj->testPrms.width,
+                 (unsigned int) appObj->testPrms.height);
+        CalUtils_memFrameGetSize(&fmt, &bufSize, NULL);
+        CacheP_wbInv((void *)pFrm[0].addr[0], (CAPT_APP_FRAMES_PER_STREAM * bufSize));
+        GT_3trace(
+            CalTrace, GT_INFO,
+            "saveRaw(0, 0x%.8x, \"D:\\\\%s\", %d, "
+            "32, false);\r\n",
+            pFrm[0].addr[0], fileStr, (bufSize / 4U));
+
+        /* Set number of frame in frame list */
+        for (idx = 0; idx < CAPT_APP_FRAMES_PER_STREAM; idx++)
+        {
+            /* Associate instance of sub-frame information structure with the
+                frame */
+            pFrm[idx].subFrameInfo = &appObj->subFrameInfo[idx];
+            pFrm[idx].appData = appObj;
+
+            frmList.frames[idx] = &pFrm[idx];
+            GT_2trace(CalTrace, GT_INFO, APP_NAME ": Captured Frames [%d]"
+                      " Available at 0x%x\r\n", idx, pFrm[idx].addr[0]);
+        }
+
+        frmList.numFrames = CAPT_APP_FRAMES_PER_STREAM;
+
+        if (0x0 == streamId)
+        {
+            uint32_t idx;
+            for (idx = 0; idx < CAPT_APP_FRAMES_PER_STREAM; idx++)
+            {
+                appObj->qCount[idx][0]   = (Uint32) frmList.frames[idx];
+                appObj->dQCount[idx][0]  = (Uint32) frmList.frames[idx];
+                appObj->qCount[idx][1U]  = 0U;
+                appObj->dQCount[idx][1U] = 0U;
+            }
+            appCaptCountQ(appObj, &frmList, 0);
+        }
+        if (0x1 == streamId)
+        {
+            uint32_t idx;
+            for (idx = 0; idx < CAPT_APP_FRAMES_PER_STREAM; idx++)
+            {
+                appObj->qCount[idx][2U]  = (Uint32) frmList.frames[idx];
+                appObj->dQCount[idx][2U] = (Uint32) frmList.frames[idx];
+                appObj->qCount[idx][3U]  = 0U;
+                appObj->dQCount[idx][3U] = 0U;
+            }
+            appCaptCountQ(appObj, &frmList, 1);
+        }
+        if (0x2 == streamId)
+        {
+            uint32_t idx;
+            for (idx = 0; idx < CAPT_APP_FRAMES_PER_STREAM; idx++)
+            {
+                appObj->qCount[idx][4U]  = (Uint32) frmList.frames[idx];
+                appObj->dQCount[idx][4U] = (Uint32) frmList.frames[idx];
+                appObj->qCount[idx][5U]  = 0U;
+                appObj->dQCount[idx][5U] = 0U;
+            }
+            appCaptCountQ(appObj, &frmList, 2);
+        }
+        if (0x3 == streamId)
+        {
+            uint32_t idx;
+            for (idx = 0; idx < CAPT_APP_FRAMES_PER_STREAM; idx++)
+            {
+                appObj->qCount[idx][6U]  = (Uint32) frmList.frames[idx];
+                appObj->dQCount[idx][6U] = (Uint32) frmList.frames[idx];
+                appObj->qCount[idx][7U]  = 0U;
+                appObj->dQCount[idx][7U] = 0U;
+            }
+            appCaptCountQ(appObj, &frmList, 3);
+        }
+        /*
+         * queue the frames in frmList
+         * All allocated frames are queued here as an example.
+         * In general atleast 2 frames per stream/channel need to queued
+         * before capture can be started.
+         * Failing which, frame could be dropped.
+         */
+        retVal = Fvid2_queue(appObj->drvHandle, &frmList, streamId);
+        if (FVID2_SOK != retVal)
+        {
+            GT_0trace(CalTrace, GT_ERR,
+                      APP_NAME ": Capture Queue Failed!!!\r\n");
+            break;
+        }
+    }
+
+    return (retVal);
+}
+
+static int32_t appCaptFreeFrames(appCaptObj_t *appObj)
+{
+    int32_t                  retVal = FVID2_SOK;
+    uint32_t                 streamId, idx;
+    Fvid2_Format           fmt;
+    Fvid2_Frame           *pFrm;
+    static Fvid2_FrameList frmList;
+
+    /* for every stream and channel in a capture handle */
+    Fvid2FrameList_init(&frmList);
+    for (streamId = 0U; streamId < appObj->createPrms.numStream; streamId++)
+    {
+        Fvid2Format_init(&fmt);
+        fmt.width      = appObj->testPrms.width;
+        fmt.height     = appObj->testPrms.height;
+        fmt.pitch[0]   = appObj->testPrms.pitch;
+        fmt.ccsFormat  = FVID2_CCSF_BITS8_PACKED;
+        fmt.dataFormat = FVID2_DF_YUV422I_UYVY;
+
+        while (1U)
+        {
+            retVal = Fvid2_dequeue(
+                appObj->drvHandle,
+                &frmList,
+                streamId,
+                FVID2_TIMEOUT_NONE);
+            if (FVID2_SOK != retVal)
+            {
+                break;
+            }
+            else
+            {
+                appCaptCountDQ(appObj, &frmList, streamId);
+            }
+        }
+
+        idx  = streamId * CAPT_APP_FRAMES_PER_STREAM;
+        pFrm = (Fvid2_Frame *) &appObj->frames[idx];
+
+        retVal = CalUtils_memFrameFree(&fmt, pFrm, CAPT_APP_FRAMES_PER_STREAM);
+        if (FVID2_SOK != retVal)
+        {
+            GT_0trace(CalTrace, GT_ERR,
+                      APP_NAME ": Capture Frame Free Failed!!!\r\n");
+        }
+
+        if (FVID2_SOK != retVal)
+        {
+            break;
+        }
+    }
+
+    return (retVal);
+}
+
+static void appCaptCountQ(appCaptObj_t *appObj, Fvid2_FrameList *frmList,
+                          uint32_t streamId)
+{
+    uint32_t frmIdx, frmAddr, cntIdx;
+    for (frmIdx = 0U; frmIdx < frmList->numFrames; frmIdx++)
+    {
+        frmAddr = (Uint32) frmList->frames[frmIdx];
+        for (cntIdx = 0U; cntIdx < CAPT_APP_FRAMES_PER_STREAM; cntIdx++)
+        {
+            if (0 == streamId)
+            {
+                if (appObj->qCount[cntIdx][0U] == frmAddr)
+                {
+                    appObj->qCount[cntIdx][1U]++;
+                }
+            }
+            else if (1 == streamId)
+            {
+                if (appObj->qCount[cntIdx][2U] == frmAddr)
+                {
+                    appObj->qCount[cntIdx][3U]++;
+                }
+            }
+            else if (2 == streamId)
+            {
+                if (appObj->qCount[cntIdx][4U] == frmAddr)
+                {
+                    appObj->qCount[cntIdx][5U]++;
+                }
+            }
+            else
+            {
+                if (appObj->qCount[cntIdx][6U] == frmAddr)
+                {
+                    appObj->qCount[cntIdx][7U]++;
+                }
+            }
+        }
+    }
+}
+
+static void appCaptCountDQ(appCaptObj_t *appObj, Fvid2_FrameList *frmList,
+                           uint32_t streamId)
+{
+    uint32_t frmIdx, frmAddr, cntIdx;
+    for (frmIdx = 0U; frmIdx < frmList->numFrames; frmIdx++)
+    {
+        frmAddr = (Uint32) frmList->frames[frmIdx];
+        for (cntIdx = 0U; cntIdx < CAPT_APP_FRAMES_PER_STREAM; cntIdx++)
+        {
+            if (0 == streamId)
+            {
+                if (appObj->dQCount[cntIdx][0U] == frmAddr)
+                {
+                    appObj->dQCount[cntIdx][1U]++;
+                }
+            }
+            else if (1 == streamId)
+            {
+                if (appObj->dQCount[cntIdx][2U] == frmAddr)
+                {
+                    appObj->dQCount[cntIdx][3U]++;
+                }
+            }
+            else if (2 == streamId)
+            {
+                if (appObj->dQCount[cntIdx][4U] == frmAddr)
+                {
+                    appObj->dQCount[cntIdx][5U]++;
+                }
+            }
+            else
+            {
+                if (appObj->dQCount[cntIdx][6U] == frmAddr)
+                {
+                    appObj->dQCount[cntIdx][7U]++;
+                }
+            }
+        }
+    }
+}
+
+static void appCaptChkDQCounts(appCaptObj_t *appObj)
+{
+    uint32_t cntIdx, isError;
+    isError = FALSE;
+    for (cntIdx = 0U; cntIdx < CAPT_APP_FRAMES_PER_STREAM; cntIdx++)
+    {
+        if (appObj->dQCount[cntIdx][0U] != appObj->qCount[cntIdx][0U])
+        {
+            isError = TRUE;
+            GT_1trace(
+                CalTrace, GT_INFO, APP_NAME
+                ": ERROR Q / DQ address are not in order [%d]!!!\r\n",
+                cntIdx);
+        }
+        if (appObj->dQCount[cntIdx][1U] != appObj->qCount[cntIdx][1U])
+        {
+            isError = TRUE;
+            GT_1trace(CalTrace, GT_INFO, APP_NAME
+                      ": ERROR Q / DQ counts do not match up [%d]!!!\r\n", cntIdx);
+        }
+        if (appObj->dQCount[cntIdx][2U] != appObj->qCount[cntIdx][2U])
+        {
+            isError = TRUE;
+            GT_1trace(
+                CalTrace, GT_INFO, APP_NAME
+                ": ERROR Q / DQ address are not in order [%d] - Stream 1!!!\r\n",
+                cntIdx);
+        }
+        if (appObj->dQCount[cntIdx][3U] != appObj->qCount[cntIdx][3U])
+        {
+            isError = TRUE;
+            GT_1trace(
+                CalTrace, GT_INFO, APP_NAME
+                ": ERROR Q / DQ counts do not match up [%d] - Stream 1!!!\r\n",
+                cntIdx);
+        }
+    }
+    if (FALSE == isError)
+    {
+        GT_0trace(CalTrace, GT_INFO, APP_NAME ": Q/Dq Counts match up\r\n");
+        GT_0trace(CalTrace, GT_INFO, APP_NAME ": Q/Dq Order match\r\n");
+    }
+}
+
+/**
+ *  appCaptGetTestId
+ *  Return the test ID to run.
+ */
+static int32_t appCaptGetTestId(appCaptObj_t *appObj)
+{
+    uint32_t       testCnt;
+    static int32_t testId = 0;
+    uint32_t       retVal;
+
+    GT_0trace(CalTrace, GT_INFO, " \r\n");
+    GT_0trace(CalTrace, GT_INFO,
+              "--------------------------------------\r\n");
+    GT_0trace(CalTrace, GT_INFO,
+              "Select test to run as per below table:\r\n");
+    GT_0trace(CalTrace, GT_INFO,
+              "--------------------------------------\r\n");
+    GT_0trace(CalTrace, GT_INFO, " \r\n");
+    for (testCnt = 0; testCnt < APP_CAPT_NUM_OPTS; testCnt++)
+    {
+        GT_2trace(CalTrace, GT_INFO,
+                  "%3d: %s\r\n", testCnt, gTestCfg[testCnt].testDescStr);
+    }
+    GT_2trace(CalTrace, GT_INFO,
+              "%3d: %s\r\n", APP_CAPT_NUM_OPTS, "EXIT\r\n");
+    GT_0trace(CalTrace, GT_INFO, " \r\n");
+    GT_0trace(CalTrace, GT_INFO, "Enter Test to Run (in UART console): \r\n");
+
+    while (1U)
+    {
+        UART_scanFmt("%d", &testId);
+        GT_1trace(CalTrace, GT_INFO, "%d\r\n", testId);
+        if ((testId >= 0) && (testId < APP_CAPT_NUM_OPTS))
+        {
+            retVal = testId;
+            testId++;
+            break;
+        }
+        else if (APP_CAPT_NUM_OPTS == testId)
+        {
+            retVal = testId;
+            break;
+        }
+        GT_0trace(CalTrace, GT_INFO, "Invalid Test ID. Enter Agian!!\r\n");
+    }
+
+    return (retVal);
+}
+
+static void appCaptErrCb(const uint32_t *event, uint32_t numEvents, Ptr arg)
+{
+    uint32_t idx;
+    appCaptObj_t *pAppObj = (appCaptObj_t *)arg;
+    for (idx = 0U; idx < numEvents; idx++)
+    {
+        if (CAL_CSI2_PPI_VC_SOF1 == event[idx])
+        {
+            pAppObj->sofIntCount++;
+        }
+        else if ((CAL_CSI2_PPI_VC_CRC_MISMATCH_VC1 == event[idx]) ||
+                 (CAL_CSI2_PPI_VC_CRC_MISMATCH_VC2 == event[idx]) ||
+                 (CAL_CSI2_PPI_VC_CRC_MISMATCH_VC3 == event[idx]) ||
+                 (CAL_CSI2_PPI_VC_CRC_MISMATCH_VC4 == event[idx]))
+        {
+            pAppObj->crcErrIntCnt++;
+        }
+        else if ((CAL_CSI2_PPI_VC_ECC_CORRECTION_VC1 == event[idx]) ||
+                 (CAL_CSI2_PPI_VC_ECC_CORRECTION_VC2 == event[idx]) ||
+                 (CAL_CSI2_PPI_VC_ECC_CORRECTION_VC3 == event[idx]) ||
+                 (CAL_CSI2_PPI_VC_ECC_CORRECTION_VC4 == event[idx]))
+        {
+            pAppObj->eccErrIntCnt++;
+        }
+        else
+        {
+            pAppObj->unExpectedIntCnt++;
+        }
+    }
+}
+
+static int32_t appCaptEnableErrorReporting(appCaptObj_t *appObj)
+{
+    int32_t retVal;
+    Cal_ErrorCfg_t errCfg;
+
+    errCfg.numErrorsToMonitor = 8U;
+    errCfg.cmplxIoId = 0U;
+    errCfg.errSrc[0U] = CAL_CSI2_PPI_VC_CRC_MISMATCH_VC1;
+    errCfg.errSrc[1U] = CAL_CSI2_PPI_VC_CRC_MISMATCH_VC2;
+    errCfg.errSrc[2U] = CAL_CSI2_PPI_VC_CRC_MISMATCH_VC3;
+    errCfg.errSrc[3U] = CAL_CSI2_PPI_VC_CRC_MISMATCH_VC4;
+    errCfg.errSrc[4U] = CAL_CSI2_PPI_VC_ECC_CORRECTION_VC1;
+    errCfg.errSrc[5U] = CAL_CSI2_PPI_VC_ECC_CORRECTION_VC2;
+    errCfg.errSrc[6U] = CAL_CSI2_PPI_VC_ECC_CORRECTION_VC3;
+    errCfg.errSrc[7U] = CAL_CSI2_PPI_VC_ECC_CORRECTION_VC4;
+
+    errCfg.appCb = &appCaptErrCb;
+    errCfg.pAppCbArgs = (Ptr)appObj;
+
+    retVal = Fvid2_control(appObj->drvHandle, IOCTL_CAL_CAPT_SET_ERR_PRMS,
+                           &errCfg, NULL);
+    if (FVID2_SOK != retVal)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Capture Set CAL Params Failed!!!\r\n");
+    }
+    return retVal;
+}
+
+static int32_t appCaptFrameEventNotifyCb(Fvid2_Handle handle, Fvid2_Frame *pFrame)
+{
+    appCaptObj_t *appObj;
+    uint32_t streamId, idx;
+    uint32_t static tsFrameEvents = 1U;
+
+    GT_assert(CalTrace, (handle != NULL));
+    GT_assert(CalTrace, (pFrame != NULL));
+    GT_assert(CalTrace, (pFrame->subFrameInfo != NULL));
+    GT_assert(CalTrace, (pFrame->appData != NULL));
+
+    streamId = Cal_captGetStreamId(pFrame->chNum);
+    appObj = (appCaptObj_t *)pFrame->appData;
+
+    if ((CAPT_APP_NTH_LINE_FRAME_EVENT == pFrame->subFrameInfo->subFrameNum) &&
+        (1U == tsFrameEvents))
+    {
+        idx = appObj->nLineEventIdx;
+        appObj->nLineInfo[idx].subFrameNum  =
+                                        pFrame->subFrameInfo->subFrameNum;
+        appObj->nLineInfo[idx].numInLines   =
+                                        pFrame->subFrameInfo->numInLines;
+        appObj->nLineInfo[idx].numOutLines  =
+                                        pFrame->subFrameInfo->numOutLines;
+
+        idx++;
+        if (idx >= CAPT_APP_FRAMES_PER_STREAM)
+        {
+            idx = 0U;
+        }
+        appObj->nLineEventIdx = idx;
+    }
+    if ((CAPT_APP_END_OF_FRAME_EVENT == pFrame->subFrameInfo->subFrameNum) &&
+        (1U == tsFrameEvents))
+    {
+        if (4U > streamId)
+        {
+            idx = appObj->eofEventIdx[streamId];
+            appObj->eofEventFrameAddr[idx][streamId] = (uint32_t)pFrame;
+            idx++;
+            if (idx >= CAPT_APP_FRAMES_PER_STREAM)
+            {
+                idx = 0U;
+            }
+            appObj->eofEventIdx[streamId] = idx;
+        }
+        if (1U != appObj->frameEventTrack)
+        {
+            tsFrameEvents = 0U;
+        }
+    }
+
+    return (FVID2_SOK);
+}
+
+static int32_t appCaptEnableFrameEventNotification(appCaptObj_t *appObj,
+                                                    appCaptCfg_t *pCfg)
+{
+    uint32_t streamId;
+    Cal_FrameEventNotifyCfg_t ntyCfg;
+    int32_t retVal = FVID2_SOK;
+
+        ntyCfg.numStream = 0U;
+        for (streamId = 0U; streamId < pCfg->numStreams; streamId++)
+        {
+            ntyCfg.streamId[streamId] = streamId;
+            if (CAPT_APP_NTH_LINE_STREAM_ID == streamId)
+            {
+                ntyCfg.notifyAfterFirstXLines[streamId] = 180U;
+            }
+            else
+            {
+                ntyCfg.notifyAfterFirstXLines[streamId] = 0U;
+            }
+            ntyCfg.notifyAfterEndOfFrame[streamId] = TRUE;
+            ntyCfg.numStream++;
+        }
+
+        ntyCfg.appCb = &appCaptFrameEventNotifyCb;
+        ntyCfg.pAdditionalArgs = NULL;
+
+        retVal = Fvid2_control(appObj->drvHandle,
+                            IOCTL_CAL_CAPT_SET_FRAME_EVENT_NOTIFY_PRMS, &ntyCfg, NULL);
+        if (FVID2_SOK != retVal)
+        {
+            GT_0trace(CalTrace, GT_ERR,
+            APP_NAME ": Capture Set CAL Frame Event Notification "
+                     "Failed!!!\r\n");
+        }
+    return retVal;
+}
+
+static void appCaptChkFrameEvents(appCaptObj_t *appObj)
+{
+    uint32_t idx;
+    /* Check the order in which events were reported */
+    for (idx = 0U; idx < CAPT_APP_FRAMES_PER_STREAM; idx++)
+    {
+        if (appObj->dQCount[idx][0U] != appObj->eofEventFrameAddr[idx][0])
+        {
+            GT_1trace(
+                CalTrace, GT_INFO, APP_NAME
+                ": ERROR DQ/EOF Frame address are not in order [%d]!!!\r\n",
+                idx);
+            break;
+        }
+    }
+
+}
+
+void App_print(const char *format, ...)
+{
+    va_list     vaArgPtr;
+
+    va_start(vaArgPtr, format);
+
+    UART_printf(format, vaArgPtr);
+    printf(format, vaArgPtr);
+
+    va_end(vaArgPtr);
+
+    return;
+}
diff --git a/packages/ti/drv/cal/examples/cal_capture_test/src/CaptureCal_main.h b/packages/ti/drv/cal/examples/cal_capture_test/src/CaptureCal_main.h
new file mode 100644 (file)
index 0000000..a95d105
--- /dev/null
@@ -0,0 +1,250 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2018
+ *
+ *  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 CaptureCal_main.h
+ *
+ *  \brief Defines various strcutures / defines needed by capture demo app.
+ *
+ */
+
+#ifndef CAPTURE_CAL_MAIN_H_
+#define CAPTURE_CAL_MAIN_H_
+
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+/* This is needed for vsnprintf */
+#include <stdarg.h>
+
+#ifndef BARE_METAL
+#include <xdc/std.h>
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+#include <ti/sysbios/utils/Load.h>
+#include <ti/sysbios/hal/Cache.h>
+#endif
+
+#include <ti/drv/fvid2/fvid2.h>
+#include <ti/drv/cal/cal.h>
+#include <ti/drv/uart/UART.h>
+#include <ti/drv/uart/UART_stdio.h>
+
+#include <ti/drv/cal/examples/utils/calutils.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ========================================================================== */
+/*                           Macros & Typedefs                                */
+/* ========================================================================== */
+
+#define APP_NAME                        "CAL_CAPT_APP"
+
+/**< Default run count in seconds in case of EVM else this is in frame count. */
+#define CAPT_APP_RUN_COUNT              (1000U)
+
+/**< Number of frames per stream */
+#define CAPT_APP_FRAMES_PER_STREAM      (2U)
+
+/**< End of frame event */
+#define CAPT_APP_END_OF_FRAME_EVENT     (1U)
+/**< Nth line frame event */
+#define CAPT_APP_NTH_LINE_FRAME_EVENT   (0U)
+/**< Stream for which Nth line frame events are to be enabled */
+#define CAPT_APP_NTH_LINE_STREAM_ID     (0U)
+/**< Control for which stream, the Nth line notification is enabled
+        Valid range is from 0 to 3 */
+#define FVID2_VID_SENSOR_MULDES_OV1063X_DRV (0x1001U)
+/** \brief Multi Deserializer OV1063X video sensor driver ID. */
+
+#define FVID2_VID_SENSOR_BYPASS_CSI2_DRV    (0x1002U)
+/** \brief By Pass sensor configurations */
+/* ========================================================================== */
+/*                         Structure Declarations                             */
+/* ========================================================================== */
+
+/**
+ * \brief Specify different config that would be used to cpature
+ */
+typedef struct appCaptCfg
+{
+    Char                   *testDescStr;
+    /**< Test description. */
+    uint32_t                  cfgId;
+    /**< Config identifier */
+    uint32_t                  useIt;
+    /**< Capture with this config, could be bypassed, by set this to FALSE */
+    Fvid2_VideoIfMode       interfaceType;
+    /**< Either CSI2, LVDS, Parallel */
+    uint32_t                interfacewidth;
+    /**< 1,2,3,4 lanes for CSI2, 4 lane for LVDS, 8-16 bits for parallel */
+    uint32_t                  numStreams;
+    /**< Should be 1 for all sensor with exception of UB960/TIDA00262 in which
+     *      case it can be upto 4. */
+    uint32_t                  virtualChannel;
+    /**< In case of CSI2 - specify the virtual channel */
+    Cal_Csi2DataFormat inCsi2DataFormat;
+    /**< Specify input data format */
+    uint32_t                  inBpp;
+    /**< Number of bits / pixel */
+    uint32_t                  numFrames;
+    /**< Specify number of frames to capture */
+    uint32_t                  width;
+    /**< Expected frame width that requires to be captured. If sensor streams
+     *      frames with greater width, the extra pixels would not be written.
+     *      If sensors streams frames with less line length, the received
+     *      lines are written. */
+    uint32_t                  height;
+    /**< Expected frame height requires to be captured. If sensor streams
+     *      frames with higher number of lines, the extra lines would not be
+     *      written / captured.*/
+    uint32_t                  pitch;
+    /**< Associated sensor driver, that would stream */
+    uint32_t                  sensorDriverId;
+    uint32_t                  standard;
+    /**< Resolution */
+    uint32_t                  dataFormat;
+    /**< Standard FVID2 resolution that sensor would be configured to stream */
+    uint32_t                  bpp;
+    /**< bits / pixel */
+}appCaptCfg_t;
+
+/**
+ *  \brief Capture application object.
+ */
+typedef struct appCaptObj
+{
+    Cal_CaptOpenParams_t      calOpenPrms;
+    /**< Cal create time parameters */
+    Fvid2_VideoIfMode         videoIfMode;
+    /**< CSI2, LVDS, Parallel etc... */
+    uint32_t                  videoIfWidth;
+    /**< Number of lanes in case CSI2 and number of bits in case of parallel */
+    uint32_t                    numStream;
+    /**< Number of channel in multi-ch case, must be 1 for single channel. */
+    uint32_t                    virtualChannel;
+    /**< Virtual channel of CSI2, if mode is CSI2 */
+    Cal_Csi2DataFormat        dataFormat;
+    /**< Data format of CSI2 stream */
+    uint32_t                    instId;
+    /**< Cal Instance ID. As defined in ti\drv\cal\include\cal_cfg.h*/
+    Cal_CaptCreateParams      createPrms;
+    /**< Create time parameters. */
+    Cal_CaptCreateStatus      createStatus;
+    /**< Create status returned by driver during Fvid2_create(). */
+    Fvid2_Handle              drvHandle;
+    /**< FVID2 capture driver handle. */
+    Fvid2_CbParams            cbPrms;
+    /**< Callback params. */
+
+    Cal_Cfg_t                 cfg;
+    /**< TODO currently done for 1 stream, update for mutiple streams */
+    uint32_t                    numFramesToCapture;
+    /**< Number of frames to receive for a given configuration */
+    uint32_t                    maxWidth;
+    /**< Max width in pixels - used for buffer allocation for all instance. */
+    uint32_t                    maxHeight;
+    /**< Max height in lines - used for buffer allocation for all instance. */
+
+    appCaptCfg_t                testPrms;
+
+    uint32_t                    totalFrmCount;
+    /**< Count of all frames captured. */
+    uint32_t                    totalCpuLoad;
+    /**< Accumulated CPU load - added every frame. */
+    uint32_t                    cpuLoadCount;
+    /**< CPU load count used to get average CPU load - incremented every
+     *   accumulation. */
+
+    Fvid2_Frame               frames[CAPT_APP_FRAMES_PER_STREAM * \
+                                     CAL_CAPT_MAX_STREAMS];
+    /**< FVID2 Frames that will be used for capture. */
+    Fvid2_SubFrameInfo        subFrameInfo[CAPT_APP_FRAMES_PER_STREAM * \
+                                     CAL_CAPT_MAX_STREAMS];
+    /**< Place holder to store sub-frameInfo */
+    volatile uint32_t           rcvedFramesCount;
+    /**< Received frames for a given config */
+    uint32_t                    qCount[CAPT_APP_FRAMES_PER_STREAM][8];
+    /**< Track Q frames */
+    uint32_t                    dQCount[CAPT_APP_FRAMES_PER_STREAM][8];
+    /**< Track DeQueued frames */
+    uint32_t                    frameWithCrcErrorCnt;
+    /**< Track the number of frames with CRC errors */
+    uint32_t                    frameWithWarning;
+    /**< Track the number of frames with warning, i.e. ecc corrected */
+    uint32_t                    frameErrorCnt;
+    /**< Other errors in frame */
+    volatile uint32_t           sofIntCount;
+    /**< Counts the number of Start Of Frame sync interrupts received
+            CSI2 i/f */
+    volatile uint32_t           crcErrIntCnt;
+    /**< Counts the number of CRC failure on CSI2 i/f */
+    volatile uint32_t           eccErrIntCnt;
+    /**< Counts the number of ECC failure on CSI2 i/f */
+    volatile uint32_t           unExpectedIntCnt;
+    /**< in case we receive un expected interrupt */
+
+    uint32_t                    frameEventTrack;
+    /**< Flag to track frame event notifications */
+    Fvid2_SubFrameInfo        nLineInfo[CAPT_APP_FRAMES_PER_STREAM];
+    /**< Stores first CAPT_APP_FRAMES_PER_STREAM Nth line notification */
+    uint32_t                    nLineEventTs[CAPT_APP_FRAMES_PER_STREAM];
+    /**< Stores first CAPT_APP_FRAMES_PER_STREAM time stamp for Nth line */
+    uint32_t                    nLineEventIdx;
+    /**< Index into the above arrays */
+
+    uint32_t                    eofEventFrameAddr[CAPT_APP_FRAMES_PER_STREAM][4];
+    /**< Stores first CAPT_APP_FRAMES_PER_STREAM frame address returned at EOF */
+    uint32_t                    eofEventTs[CAPT_APP_FRAMES_PER_STREAM][4];
+    /**< Stores first CAPT_APP_FRAMES_PER_STREAM time stamp at EOF */
+    uint32_t                    eofEventIdx[4];
+    /**< Index into the above arrays */
+
+}appCaptObj_t;
+
+/* ========================================================================== */
+/*                          Function Declarations                             */
+/* ========================================================================== */
+
+/* None */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* #ifndef CAPTURE_CAL_MAIN_H_ */
diff --git a/packages/ti/drv/cal/examples/cal_capture_test/src/main_baremetal.c b/packages/ti/drv/cal/examples/cal_capture_test/src/main_baremetal.c
new file mode 100644 (file)
index 0000000..7f5aa0d
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2018
+ *
+ *  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 main_baremetal.c
+ *
+ *  \brief Main file for baremetal build
+ */
+
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+
+#include <stdint.h>
+#include <ti/board/board.h>
+
+/* ========================================================================== */
+/*                           Macros & Typedefs                                */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                         Structure Declarations                             */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                          Function Declarations                             */
+/* ========================================================================== */
+
+extern int32_t Cal_captureTest(void);
+static int32_t appBoardInit(void);
+
+/* ========================================================================== */
+/*                            Global Variables                                */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                          Function Definitions                              */
+/* ========================================================================== */
+
+int main(void)
+{
+    appBoardInit();
+    Cal_captureTest();
+
+    return(0);
+}
+
+static int32_t appBoardInit(void)
+{
+    Board_initCfg boardCfg;
+
+    boardCfg = BOARD_INIT_PINMUX_CONFIG |
+                BOARD_INIT_UNLOCK_MMR |
+                BOARD_INIT_UART_STDIO;
+    Board_init(boardCfg);
+
+    return 0;
+}
diff --git a/packages/ti/drv/cal/examples/cal_capture_test/src/main_tirtos.c b/packages/ti/drv/cal/examples/cal_capture_test/src/main_tirtos.c
new file mode 100644 (file)
index 0000000..f7e6f57
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2018
+ *
+ *  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 main_tirtos.c
+ *
+ *  \brief Main file for TI-RTOS build
+ */
+
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+
+#include <stdint.h>
+/* XDCtools Header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/System.h>
+/* BIOS Header files */
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+#include <ti/board/board.h>
+
+/* ========================================================================== */
+/*                           Macros & Typedefs                                */
+/* ========================================================================== */
+
+/**< Demo application stack size */
+#define CAPT_APP_TSK_STACK_MAIN         (10U * 1024U)
+
+/**< Demo application task priority */
+#define CAPT_APP_TSK_PRI_MAIN           (10U)
+
+/* ========================================================================== */
+/*                         Structure Declarations                             */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                          Function Declarations                             */
+/* ========================================================================== */
+static Void taskFxn(UArg a0, UArg a1);
+extern void Cal_captureTest(void);
+static int32_t appBoardInit(void);
+
+/* ========================================================================== */
+/*                            Global Variables                                */
+/* ========================================================================== */
+/**< Align stack memory to integer boundary. */
+static uint8_t gCaptAppTskStackMain[CAPT_APP_TSK_STACK_MAIN]
+                    __attribute__ ((section (".bss:taskStackSection")))
+                    __attribute__((aligned(32)));
+/* ========================================================================== */
+/*                          Function Definitions                              */
+/* ========================================================================== */
+int main(void)
+{
+    Task_Handle task;
+    Error_Block eb;
+    Task_Params taskParams;
+
+    Error_init(&eb);
+
+    /* Initialize the task params */
+    Task_Params_init(&taskParams);
+    /* Set the task priority higher than the default priority (1) */
+    taskParams.priority      = CAPT_APP_TSK_PRI_MAIN;
+    taskParams.stack         = gCaptAppTskStackMain;
+    taskParams.stackSize     = sizeof (gCaptAppTskStackMain);
+
+    task = Task_create(taskFxn, &taskParams, &eb);
+    if(NULL == task)
+    {
+        BIOS_exit(0);
+    }
+    BIOS_start();    /* does not return */
+
+    return(0);
+}
+
+static Void taskFxn(UArg a0, UArg a1)
+{
+    appBoardInit();
+    Cal_captureTest();
+    return;
+}
+
+static int32_t appBoardInit(void)
+{
+    Board_initCfg boardCfg;
+
+    boardCfg = BOARD_INIT_PINMUX_CONFIG |
+                BOARD_INIT_UNLOCK_MMR |
+                BOARD_INIT_UART_STDIO;
+    Board_init(boardCfg);
+
+    return 0;
+}
+
+#if defined(BUILD_MPU) || defined (__C7100__)
+extern void Osal_initMmuDefault(void);
+void InitMmu(void)
+{
+    Osal_initMmuDefault();
+}
+#endif
diff --git a/packages/ti/drv/cal/examples/cal_loopback_test/makefile b/packages/ti/drv/cal/examples/cal_loopback_test/makefile
new file mode 100644 (file)
index 0000000..aef91e8
--- /dev/null
@@ -0,0 +1,8 @@
+#
+# This file is the makefile for building CAL loopback test app for TI RTOS
+#
+include $(PDK_INSTALL_PATH)/ti/build/Rules.make
+
+APP_NAME = cal_loopback_testapp
+
+include makefile.mk
diff --git a/packages/ti/drv/cal/examples/cal_loopback_test/makefile.mk b/packages/ti/drv/cal/examples/cal_loopback_test/makefile.mk
new file mode 100644 (file)
index 0000000..f0e218c
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# This file is the makefile for building CAL loopback example application.
+#
+SRCDIR =   src
+INCDIR = . src
+
+# List all the external components/interfaces, whose interface header files
+# need to be included for this component
+INCLUDE_EXTERNAL_INTERFACES = pdk
+INCLUDE_INTERNAL_INTERFACES =
+
+# List all the components required by the application
+COMP_LIST_COMMON = csl fvid2 cal dss board uart i2c
+COMP_LIST_COMMON += sciclient pm_lib
+COMP_LIST_COMMON += dss_app_utils
+CFLAGS_LOCAL_COMMON = $(PDK_CFLAGS) $(CAL_CFLAGS)
+
+ifeq ($(BUILD_OS_TYPE), baremetal)
+  COMP_LIST_COMMON += csl_init osal_nonos cal_app_utils_baremetal
+  SRCS_COMMON = main_baremetal.c
+  ifeq ($(ISA),$(filter $(ISA), a53))
+    LNKFLAGS_LOCAL_$(CORE) += --entry Entry
+  endif
+  CFLAGS_LOCAL_COMMON += -DBARE_METAL
+else
+  INCLUDE_EXTERNAL_INTERFACES += xdc bios
+  COMP_LIST_COMMON += osal_tirtos cal_app_utils
+  SRCS_COMMON = main_tirtos.c
+  # Enable XDC build for application by providing XDC CFG File per core
+  XDC_CFG_FILE_$(CORE) = $(PDK_INSTALL_PATH)/ti/build/$(SOC)/sysbios_$(ISA).cfg
+endif
+
+ifeq ($(CORE),$(filter $(CORE), mpu1_0 mpu1_1))
+EXTERNAL_LNKCMD_FILE_LOCAL = $(PDK_CAL_COMP_PATH)/examples/utils/src/V0/linker_cal_a53.lds
+endif
+
+PACKAGE_SRCS_COMMON = .
+
+# Common source files and CFLAGS across all platforms and cores
+SRCS_COMMON += cal_loopback_test.c
+
+# 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
diff --git a/packages/ti/drv/cal/examples/cal_loopback_test/makefile_baremetal b/packages/ti/drv/cal/examples/cal_loopback_test/makefile_baremetal
new file mode 100644 (file)
index 0000000..048d3d6
--- /dev/null
@@ -0,0 +1,9 @@
+#
+# This file is the makefile for building CAL loopback test app for baremetal
+#
+include $(PDK_INSTALL_PATH)/ti/build/Rules.make
+
+APP_NAME = cal_baremetal_loopback_testapp
+BUILD_OS_TYPE=baremetal
+
+include makefile.mk
diff --git a/packages/ti/drv/cal/examples/cal_loopback_test/src/cal_loopback_test.c b/packages/ti/drv/cal/examples/cal_loopback_test/src/cal_loopback_test.c
new file mode 100755 (executable)
index 0000000..9f16161
--- /dev/null
@@ -0,0 +1,1356 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2018
+ *
+ *  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 cal_loopback_test.c
+ *
+ *  \brief CAL Capture demo application - Receives via CSI2/Parallel and
+ *          write to memory
+ *         Most board / EVM specifics are handled in function
+ *          appCaptcreateVidSensor () In addition to configuring the sensor
+ *          for the given config and enable sensor to stream.
+ *         On AM65xx only CSI2 based capture is supported.
+ */
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+
+/* This is needed for vsnprintf */
+#include <stdio.h>
+#include <stdarg.h>
+#include <cal_loopback_test.h>
+
+/* ========================================================================== */
+/*                           Macros & Typedefs                                */
+/* ========================================================================== */
+
+/**< CSI2 PHY Clock Custom sensor. */
+#define APP_CAPT_CAL_SENSOR_BYPASS_PHY_CLK_MHz (400U)
+
+#define APP_CAPT_MAX_WIDTH (1280U)
+#define APP_CAPT_MAX_HEIGHT (720U)
+
+/* ========================================================================== */
+/*                         Structure Declarations                             */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                          Function Declarations                             */
+/* ========================================================================== */
+
+static void appCaptInit(appCaptObj_t *appObj);
+static void appCaptDeInit(appCaptObj_t *appObj);
+static void appCapture4GivenConfig(appCaptObj_t *appObj, appCaptCfg_t *pCfg);
+static void appCaptDeriveCfg(appCaptObj_t *appObj, appCaptCfg_t *pCfg);
+static int32_t appCaptCreateDrv(appCaptObj_t *appObj);
+static int32_t appCaptDeleteDrv(appCaptObj_t *appObj);
+static int32_t appCaptSetDrvCfg(appCaptObj_t *appObj, appCaptCfg_t *pCfg);
+static int32_t appCaptAllocAndQFrames(appCaptObj_t *appObj);
+static int32_t appCaptFreeFrames(appCaptObj_t *appObj);
+
+static void appCaptErrCb(const uint32_t *event, uint32_t numEvents, void * arg);
+static int32_t appCaptEnableErrorReporting(appCaptObj_t *appObj);
+
+static void DispApp_create(appCaptObj_t *appObj);
+static void DispApp_delete(appCaptObj_t *appObj);
+static int32_t DispApp_configDctrl(appCaptObj_t *appObj);
+static void DispApp_initParams(appCaptObj_t *appObj);
+static int32_t DispApp_allocAndQueueFrames(const appCaptObj_t *appObj,
+                                           DispApp_InstObj *instObj);
+static int32_t DispApp_pipeCbFxn(Fvid2_Handle handle, void *appData);
+
+void App_print(const char *format, ...);
+
+/* ========================================================================== */
+/*                            Global Variables                                */
+/* ========================================================================== */
+
+/**< demo application object */
+appCaptObj_t gCaptAppObj;
+
+/**< Different capture options supported by this demo */
+appCaptCfg_t gTestCfg =
+{
+    "Sensor Config Bypassed CSI2 4Lanes capture color bars from UB954 to DSS",   0U,
+    TRUE,
+    FVID2_VIFM_SCH_CSI2,
+    FVID2_VIFW_4LANES, 1U, 0U, CAL_CSI2_RGB888, FVID2_CCSF_BITS8_PACKED,
+    CAPT_APP_RUN_COUNT, 1280U, 720U, (1280U * 3U),
+    FVID2_VID_SENSOR_BYPASS_CSI2_DRV,
+    FVID2_STD_1080P_30, FVID2_DF_BAYER_BGGR, FVID2_CCSF_BITS8_PACKED,
+    /* Instance Id */
+    DSS_DISP_INST_VID1,
+    /* Pipe Id */
+    CSL_DSS_VID_PIPE_ID_VID1,
+    /* Pipe Node Id */
+    DSS_DCTRL_NODE_VID1,
+    /* Pipe Type */
+    CSL_DSS_VID_PIPE_TYPE_VID,
+    /* Data format */
+    FVID2_DF_BGR24_888,
+    /* Input buffer width */
+    1280U,
+    /* Input buffer height */
+    720U,
+    /* Scan format */
+    FVID2_SF_PROGRESSIVE,
+    /* Output buffer width */
+    1280U,
+    /* Output buffer height */
+    720U,
+    /* Scaler enable */
+    FALSE,
+    /* Global Alpha */
+    0xFFU,
+    /* Pre-multiply alpha */
+    FALSE,
+    /* X Position */
+    0U,
+    /* Y position */
+    0U,
+    /* Invalid Pipe Id */
+    CSL_DSS_VID_PIPE_ID_VID1
+};
+
+/* ========================================================================== */
+/*                          Function Definitions                              */
+/* ========================================================================== */
+
+/*
+ * Test task main
+ */
+void Cal_loopbackTest(void)
+{
+    CalUtils_MemHeapStatus startHeapStat1;
+    appCaptObj_t          *appObj = &gCaptAppObj;
+
+    memset(&gCaptAppObj, 0x0, sizeof (appCaptObj_t));
+    appCaptInit(appObj);
+
+    CalUtils_memGetHeapStat(&startHeapStat1);
+
+    appCapture4GivenConfig(appObj, &gTestCfg);
+
+    CalUtils_memCheckHeapStat(&startHeapStat1);
+
+    GT_0trace(CalTrace, GT_INFO,
+              APP_NAME ": Sample Application - DONE !!!\r\n");
+
+    appCaptDeInit(appObj);
+
+    return;
+}
+
+static void appCaptInit(appCaptObj_t *appObj)
+{
+    int32_t         retVal;
+    Fvid2_InitPrms  initPrms;
+
+    /* Fvid2 init */
+    Fvid2InitPrms_init(&initPrms);
+    initPrms.printFxn = &App_print;
+    retVal = Fvid2_init(&initPrms);
+    if (retVal != FVID2_SOK)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Fvid2 Init Failed!!!\r\n");
+    }
+       else
+       {
+               /* Prints require the fvid2 init to be done.
+                * So app start print is moved here. */
+               GT_0trace(CalTrace, GT_INFO,
+              APP_NAME ": Sample Application - STARTS !!!\r\n");
+       }
+
+    /* Cal init */
+    retVal = Cal_init();
+    if (retVal != FVID2_SOK)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": System Init Failed!!!\r\n");
+    }
+
+    retVal = CalUtils_memInit();
+    if (retVal != FVID2_SOK)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Mem Init Failed!!!\r\n");
+    }
+    CalUtils_memClearOnAlloc(TRUE);
+
+    Dss_initParamsInit(&appObj->initParams);
+    Dss_init(&appObj->initParams);
+
+    if(FVID2_SOK == retVal)
+    {
+        /* Create DCTRL handle, used for common driver configuration */
+        appObj->dctrlHandle = Fvid2_create(
+            DSS_DCTRL_DRV_ID,
+            DSS_DCTRL_INST_0,
+            NULL,
+            NULL,
+            NULL);
+        if(NULL == appObj->dctrlHandle)
+        {
+            GT_0trace(CalTrace, GT_ERR,
+              APP_NAME ": DCTRL Create Failed!!!\r\n");
+        }
+    }
+
+    if(FVID2_SOK == retVal)
+    {
+         GT_0trace(CalTrace, GT_INFO,
+              APP_NAME ": DispApp_init() - DONE !!!\r\n");
+    }
+
+    if (FVID2_SOK == retVal)
+    {
+        GT_0trace(CalTrace, GT_INFO,
+                  APP_NAME ": CAL APP Initialized\r\n");
+    }
+
+    return;
+}
+
+static void appCaptDeInit(appCaptObj_t *appObj)
+{
+    int32_t  retVal = FVID2_SOK;
+    /* Cal de-init */
+       retVal = CalUtils_memDeInit();
+       retVal += Cal_deInit();
+
+    /* Delete DCTRL handle */
+    retVal = Fvid2_delete(appObj->dctrlHandle, NULL);
+    retVal += Dss_deInit();
+    retVal += Fvid2_deInit(NULL);
+
+    return;
+}
+
+/**
+ *  appCapture4GivenConfig
+ *  Capture test function.
+ */
+static void appCapture4GivenConfig(appCaptObj_t *appObj, appCaptCfg_t *pCfg)
+{
+    int32_t           retVal = FVID2_SOK;
+    volatile uint32_t lastFrameNo = 0;
+    DispApp_InstObj instObj;
+
+    /* Print test case information */
+    GT_1trace(CalTrace, GT_INFO,
+              APP_NAME ": Configured to capture %d frames \r\n",
+              pCfg->numFrames);
+    memcpy(&appObj->testPrms, pCfg, sizeof (appCaptCfg_t));
+
+    appObj->instId = CAL_CAPT_INST_ID_A_ID;
+
+    /* Make config required for open */
+    appCaptDeriveCfg(appObj, pCfg);
+
+    retVal = appCaptCreateDrv(appObj);
+    if (FVID2_SOK != retVal)
+    {
+        return;
+    }
+
+    retVal = appCaptSetDrvCfg(appObj, pCfg);
+    if (FVID2_SOK != retVal)
+    {
+        return;
+    }
+
+    retVal = appCaptEnableErrorReporting(appObj);
+    if (FVID2_SOK != retVal)
+    {
+        return;
+    }
+
+    retVal = appCaptAllocAndQFrames(appObj);
+    if (FVID2_SOK != retVal)
+    {
+        return;
+    }
+
+    CalUtils_sensorConfigInit(pCfg->sensorDriverId);
+
+    appObj->rcvedFramesCount = 0x0;
+    appObj->frameWithCrcErrorCnt = 0x0;
+    appObj->frameWithWarning = 0x0;
+    appObj->frameErrorCnt = 0x0;
+    appObj->sofIntCount = 0x0;
+    appObj->unExpectedIntCnt = 0x0;
+    appObj->crcErrIntCnt = 0x0;
+    appObj->eccErrIntCnt = 0x0;
+    lastFrameNo = 0x0U;
+
+    GT_0trace(CalTrace, GT_INFO, APP_NAME ": Starting Capture now...\r\n");
+
+    GT_0trace(CalTrace, GT_INFO,
+              APP_NAME ": Starting display ... !!!\r\n");
+    GT_0trace(CalTrace, GT_INFO,
+              APP_NAME ": Display in progress ... DO NOT HALT !!!\r\n");
+
+    retVal    = Fvid2_start(appObj->drvHandle, NULL);
+    if (FVID2_SOK != retVal)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Capture Start Failed!!!\r\n");
+        return;
+    }
+
+    /* Start driver */
+    instObj = appObj->instObj;
+    retVal = Fvid2_start(instObj.drvHandle, NULL);
+    if(retVal != FVID2_SOK)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+              APP_NAME ": Display Start Failed!!!\r\n");
+    }
+
+    /* Wait for reception completion */
+    while (appObj->rcvedFramesCount <
+           (appObj->numFramesToCapture * pCfg->numStreams))
+    {
+        if ((0U == lastFrameNo) && (appObj->rcvedFramesCount))
+        {
+            lastFrameNo = appObj->rcvedFramesCount;
+            GT_0trace(CalTrace, GT_INFO, APP_NAME ": Stream Detected!!!\r\n");
+        }
+    }
+
+    retVal = Fvid2_stop(appObj->drvHandle, NULL);
+    if (FVID2_SOK != retVal)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Capture Stop Failed!!!\r\n");
+        return;
+    }
+
+    instObj = appObj->instObj;
+    retVal  = Fvid2_stop(instObj.drvHandle, NULL);
+    if(retVal != FVID2_SOK)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+              APP_NAME ": Display Stop Failed!!!\r\n");
+    }
+
+    retVal = appCaptFreeFrames(appObj);
+    if (FVID2_SOK != retVal)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Capture Stop Failed!!!\r\n");
+        return;
+    }
+
+    retVal = appCaptDeleteDrv(appObj);
+    if (FVID2_SOK != retVal)
+    {
+        return;
+    }
+    CalUtils_sensorConfigDeInit(pCfg->sensorDriverId);
+
+       GT_0trace(CalTrace, GT_INFO, APP_NAME ": All Tests Have Passed\r\n");
+    return;
+}
+
+/**
+ *  appCaptCb
+ *  \brief Driver callback function.
+ */
+static int32_t appCaptCb(Fvid2_Handle handle, void * appData, void * reserved)
+{
+    int32_t  retVal = FVID2_SOK;
+    uint32_t streamId, frmIdx;
+    static Fvid2_FrameList frmList;
+    Fvid2_Frame *pFrm;
+    appCaptObj_t *appObj = (appCaptObj_t *) appData;
+    GT_assert(CalTrace, appData != NULL);
+
+    for (streamId = 0U; streamId < appObj->numStream; streamId++)
+    {
+        retVal = Fvid2_dequeue(
+            appObj->drvHandle,
+            &frmList,
+            streamId,
+            FVID2_TIMEOUT_NONE);
+        if (FVID2_SOK == retVal)
+        {
+            for (frmIdx = 0; frmIdx < frmList.numFrames; frmIdx++)
+            {
+                pFrm = frmList.frames[frmIdx];
+                if (FVID2_FRAME_STATUS_COMPLETED != pFrm->status)
+                {
+                    switch (pFrm->status)
+                    {
+                        case FVID2_FRAME_STATUS_CRC_ERROR:
+                            appObj->frameWithCrcErrorCnt++;
+                        break;
+
+                        case FVID2_FRAME_STATUS_ECC_CORRECTED:
+                            appObj->frameWithWarning++;
+                        break;
+
+                        case FVID2_FRAME_STATUS_OVERFLOW:
+                        case FVID2_FRAME_STATUS_ECC_ERROR:
+                            appObj->frameErrorCnt++;
+                        break;
+                        default:
+                            appObj->frameErrorCnt++;
+                        break;
+                    }
+                }
+            }
+
+            retVal = Fvid2_queue(
+                        appObj->instObj.drvHandle,
+                        &frmList,
+                        streamId);
+            if (FVID2_SOK != retVal)
+            {
+                while(1);
+            }
+        }
+        appObj->rcvedFramesCount += frmList.numFrames;
+        appObj->totalFrmCount    += frmList.numFrames;
+    }
+    return FVID2_SOK;
+}
+
+/**
+ *  appCaptDeriveCfg
+ *  Initialize the global variables and frame pointers.
+ */
+static void appCaptDeriveCfg(appCaptObj_t *appObj, appCaptCfg_t *pCfg)
+{
+    uint32_t streamId;
+    Cal_CaptCreateParams  *createPrms;
+    Cal_CmplxIoCfg_t *pCmplxIoCfg;
+
+    appObj->maxWidth      = APP_CAPT_MAX_WIDTH;
+    appObj->maxHeight     = APP_CAPT_MAX_HEIGHT;
+    appObj->totalFrmCount = 0U;
+    appObj->totalCpuLoad  = 0U;
+    appObj->cpuLoadCount  = 0U;
+
+    appObj->instId    = CAL_CAPT_INST_ID_A_ID;
+    appObj->drvHandle = NULL;
+    Fvid2CbParams_init(&appObj->cbPrms);
+    appObj->cbPrms.cbFxn   = (Fvid2_CbFxn) &appCaptCb;
+    appObj->cbPrms.appData = appObj;
+
+    appObj->numStream = pCfg->numStreams;
+    GT_assert(CalTrace, ((0U < pCfg->numStreams) &&
+                            (pCfg->numStreams < CAL_CAPT_MAX_STREAMS)));
+
+    createPrms = &appObj->createPrms;
+    CalCaptCreateParams_init(&appObj->createPrms);
+    createPrms->videoIfMode     = pCfg->interfaceType;
+    createPrms->videoIfWidth    = pCfg->interfacewidth;
+    createPrms->bufCaptMode     = CAL_CAPT_BCM_LAST_FRM_REPEAT;
+    createPrms->numCh           = 1U;
+    createPrms->numStream       = appObj->numStream;
+    createPrms->pAdditionalArgs = &appObj->calOpenPrms;
+
+    appObj->calOpenPrms.csi2PhyClock[0] =
+                                APP_CAPT_CAL_SENSOR_BYPASS_PHY_CLK_MHz;
+
+    if (FVID2_VIFM_SCH_CPI == pCfg->interfaceType)
+    {
+        appObj->calOpenPrms.subModules[0U] =
+            (CAL_CAPT_INST_ID_SUB_CPORT_ID |
+             CAL_CAPT_INST_ID_SUB_DMA_WR_ID |
+             CAL_CAPT_INST_ID_SUB_DPCM_ENC_ID |
+             CAL_CAPT_INST_ID_SUB_PIX_PACK_ID |
+             CAL_CAPT_INST_ID_SUB_BYS_IN_ID);
+    }
+    else
+    {
+        appObj->calOpenPrms.subModules[0U] =
+            (CAL_CAPT_INST_ID_SUB_PPI_ID_0 |
+             CAL_CAPT_INST_ID_SUB_CSI2_ID |
+             CAL_CAPT_INST_ID_SUB_CPORT_ID |
+             CAL_CAPT_INST_ID_SUB_DMA_WR_ID |
+             CAL_CAPT_INST_ID_SUB_PIX_EXTRACT_ID |
+             CAL_CAPT_INST_ID_SUB_DPCM_DEC_ID |
+             CAL_CAPT_INST_ID_SUB_DPCM_ENC_ID |
+             CAL_CAPT_INST_ID_SUB_PIX_PACK_ID);
+    }
+
+    if (FVID2_VID_SENSOR_MULDES_OV1063X_DRV == pCfg->sensorDriverId)
+    {
+        appObj->calOpenPrms.subModules[1U] =
+            (
+                CAL_CAPT_INST_ID_SUB_PPI_ID_0 |
+                CAL_CAPT_INST_ID_SUB_CSI2_ID |
+                CAL_CAPT_INST_ID_SUB_CPORT_ID |
+                CAL_CAPT_INST_ID_SUB_DMA_WR_ID |
+                CAL_CAPT_INST_ID_SUB_PIX_EXTRACT_ID |
+                CAL_CAPT_INST_ID_SUB_DPCM_DEC_ID |
+                CAL_CAPT_INST_ID_SUB_DPCM_ENC_ID |
+                CAL_CAPT_INST_ID_SUB_PIX_PACK_ID);
+        appObj->calOpenPrms.subModules[2U] =
+            (
+                CAL_CAPT_INST_ID_SUB_PPI_ID_0 |
+                CAL_CAPT_INST_ID_SUB_CSI2_ID |
+                CAL_CAPT_INST_ID_SUB_CPORT_ID |
+                CAL_CAPT_INST_ID_SUB_DMA_WR_ID |
+                CAL_CAPT_INST_ID_SUB_PIX_EXTRACT_ID |
+                CAL_CAPT_INST_ID_SUB_DPCM_DEC_ID |
+                CAL_CAPT_INST_ID_SUB_DPCM_ENC_ID |
+                CAL_CAPT_INST_ID_SUB_PIX_PACK_ID);
+        appObj->calOpenPrms.subModules[3U] =
+            (
+                CAL_CAPT_INST_ID_SUB_PPI_ID_0 |
+                CAL_CAPT_INST_ID_SUB_CSI2_ID |
+                CAL_CAPT_INST_ID_SUB_CPORT_ID |
+                CAL_CAPT_INST_ID_SUB_DMA_WR_ID |
+                CAL_CAPT_INST_ID_SUB_PIX_EXTRACT_ID |
+                CAL_CAPT_INST_ID_SUB_DPCM_DEC_ID |
+                CAL_CAPT_INST_ID_SUB_DPCM_ENC_ID |
+                CAL_CAPT_INST_ID_SUB_PIX_PACK_ID);
+    }
+
+    for (streamId = 0U; streamId < CAL_CAPT_MAX_CMPLXIO_INST; streamId++)
+    {
+        appObj->calOpenPrms.isCmplxIoCfgValid[streamId] = FALSE;
+    }
+    appObj->calOpenPrms.isCmplxIoCfgValid[0] = TRUE;
+
+    pCmplxIoCfg                = &appObj->calOpenPrms.cmplxIoCfg[0U];
+    pCmplxIoCfg->enable        = TRUE;
+
+    pCmplxIoCfg->clockLane.pol      = FALSE;
+    pCmplxIoCfg->clockLane.position = 1U;
+    pCmplxIoCfg->data1Lane.pol      = FALSE;
+    pCmplxIoCfg->data1Lane.position = 2U;
+    pCmplxIoCfg->data2Lane.pol      = FALSE;
+    pCmplxIoCfg->data2Lane.position = 3U;
+    pCmplxIoCfg->data3Lane.pol      = FALSE;
+    pCmplxIoCfg->data3Lane.position = 4U;
+    pCmplxIoCfg->data4Lane.pol      = FALSE;
+    pCmplxIoCfg->data4Lane.position = 5U;
+
+    if (FVID2_VIFW_3LANES == pCfg->interfacewidth)
+    {
+        pCmplxIoCfg->data4Lane.position = 0U;
+    }
+    if (FVID2_VIFW_2LANES == pCfg->interfacewidth)
+    {
+        pCmplxIoCfg->data3Lane.position = 0U;
+        pCmplxIoCfg->data4Lane.position = 0U;
+    }
+    if (FVID2_VIFW_1LANES == pCfg->interfacewidth)
+    {
+        pCmplxIoCfg->data2Lane.position = 0U;
+        pCmplxIoCfg->data3Lane.position = 0U;
+        pCmplxIoCfg->data4Lane.position = 0U;
+    }
+
+    for (streamId = 0U; streamId < appObj->numStream; streamId++)
+    {
+        createPrms->chNumMap[streamId][0U] =
+            Cal_captMakeChNum(appObj->instId, streamId, 0U);
+    }
+
+    return;
+}
+
+static int32_t appCaptCreateDrv(appCaptObj_t *appObj)
+{
+    int32_t retVal = FVID2_SOK;
+
+    appObj->drvHandle = Fvid2_create(
+        FVID2_CAL_CAPT_DRV_ID,
+        appObj->instId,
+        &appObj->createPrms,
+        &appObj->createStatus,
+        &appObj->cbPrms);
+    if ((NULL == appObj->drvHandle) ||
+        (appObj->createStatus.retVal != FVID2_SOK))
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Capture Create Failed!!!\r\n");
+        retVal = appObj->createStatus.retVal;
+    }
+
+    DispApp_create(appObj);
+
+    GT_0trace(CalTrace, GT_INFO, APP_NAME ": CAL Capture created\r\n");
+
+    return (retVal);
+}
+
+static int32_t appCaptDeleteDrv(appCaptObj_t *appObj)
+{
+    int32_t  retVal = FVID2_SOK;
+
+    retVal = Fvid2_delete(appObj->drvHandle, NULL);
+    if (FVID2_SOK != retVal)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Capture Delete Failed!!!\r\n");
+    }
+    else
+    {
+        appObj->drvHandle = NULL;
+    }
+
+    DispApp_delete(appObj);
+
+    GT_0trace(CalTrace, GT_INFO, APP_NAME ": Capture Driver deleted\r\n");
+
+    return (retVal);
+}
+
+static int32_t appCaptSetDrvCfg(appCaptObj_t *appObj, appCaptCfg_t *pCfg)
+{
+    uint32_t i;
+    int32_t  retVal = FVID2_SOK;
+    appObj->numFramesToCapture = pCfg->numFrames;
+    appObj->cfg.numStream      = pCfg->numStreams;
+    for (i = 0; i < pCfg->numStreams; i++)
+    {
+        appObj->cfg.streamId[i] = i;
+
+        appObj->cfg.inFmt[i].width  = pCfg->width;
+        appObj->cfg.inFmt[i].height = pCfg->height;
+
+        appObj->cfg.inFmt[i].pitch[0]   = pCfg->pitch;
+        appObj->cfg.inFmt[i].dataFormat = gTestCfg.inDataFmt;
+        appObj->cfg.inFmt[i].ccsFormat  = pCfg->bpp;
+        appObj->cfg.csi2DataFormat[i]   = pCfg->inCsi2DataFormat;
+        if (0 == i)
+        {
+            appObj->cfg.csi2VirtualChanNo[i] = pCfg->virtualChannel;
+        }
+        else if (1 == i)
+        {
+            appObj->cfg.csi2VirtualChanNo[i] = 1U;
+        }
+        else if (2 == i)
+        {
+            appObj->cfg.csi2VirtualChanNo[i] = 2U;
+        }
+        else
+        {
+            appObj->cfg.csi2VirtualChanNo[i] = 3U;
+        }
+        appObj->cfg.streamType[i] = CAL_TAG_PIX_DATA;
+
+        appObj->cfg.isPixProcCfgValid[i] = FALSE;
+        appObj->cfg.isBysOutCfgValid[i]  = FALSE;
+
+        if (FVID2_VIFM_SCH_CPI == pCfg->interfaceType)
+        {
+            appObj->cfg.bysInEnable[0] = TRUE;
+        }
+        else
+        {
+            appObj->cfg.bysInEnable[i] = FALSE;
+        }
+        appObj->cfg.isVportCfgValid[i] = FALSE;
+
+        appObj->cfg.writeToMem[i] = TRUE;
+
+        if (((CAL_CSI2_RAW12 == pCfg->inCsi2DataFormat) ||
+             (CAL_CSI2_RAW14 == pCfg->inCsi2DataFormat)) ||
+            (CAL_CSI2_RAW10 == pCfg->inCsi2DataFormat))
+        {
+            appObj->cfg.pixProcCfg[i].extract = CAL_PIX_EXRCT_B14_MIPI;
+            if (CAL_CSI2_RAW12 == pCfg->inCsi2DataFormat)
+            {
+                appObj->cfg.pixProcCfg[i].extract =
+                    CAL_PIX_EXRCT_B12_MIPI;
+            }
+            if (CAL_CSI2_RAW10 == pCfg->inCsi2DataFormat)
+            {
+                appObj->cfg.pixProcCfg[i].extract =
+                    CAL_PIX_EXRCT_B10_MIPI;
+            }
+            appObj->cfg.isPixProcCfgValid[i]   = TRUE;
+            appObj->cfg.pixProcCfg[i].decCodec = CAL_DPCM_DEC_BYPASS;
+            appObj->cfg.pixProcCfg[i].enableDpcmInitContext = FALSE;
+            appObj->cfg.pixProcCfg[i].encCodec = CAL_DPCM_ENC_BYPASS;
+            appObj->cfg.pixProcCfg[i].pack     = CAL_PIX_PACK_B16;
+            /* Write in 16 bit container */
+            appObj->cfg.inFmt[i].pitch[0] = appObj->cfg.inFmt[i].width * 2;
+            appObj->cfg.inFmt[i].ccsFormat      = FVID2_CCSF_BITS8_PACKED;
+            if (FVID2_VID_SENSOR_MULDES_OV1063X_DRV == pCfg->sensorDriverId)
+            {
+                /* SAT0088 + OV10635 sends 10 bit YUV, the UB96x is configured
+                    to forward MS 8bits only, hence extract and process 8 bits
+                    only */
+                appObj->cfg.pixProcCfg[i].extract = CAL_PIX_EXRCT_B8;
+                appObj->cfg.pixProcCfg[i].pack    = CAL_PIX_PACK_B8;
+            }
+            if (FVID2_VID_SENSOR_BYPASS_CSI2_DRV == pCfg->sensorDriverId)
+            {
+                appObj->cfg.isPixProcCfgValid[i]   = FALSE;
+                appObj->cfg.inFmt[i].pitch[0] = appObj->cfg.inFmt[i].width * 3;
+                appObj->cfg.inFmt[i].ccsFormat      = FVID2_CCSF_BITS8_PACKED;
+            }
+        }
+    }
+
+    retVal = Fvid2_control(appObj->drvHandle, IOCTL_CAL_CAPT_SET_PARAMS,
+                           &appObj->cfg, NULL);
+    if (FVID2_SOK != retVal)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Capture Set CAL Params Failed!!!\r\n");
+    }
+
+    GT_0trace(CalTrace, GT_INFO, APP_NAME ": CAL Capture Configured\r\n");
+
+    return (retVal);
+}
+
+/**
+ *  \brief Allocate and queue frames to driver
+ */
+static int32_t appCaptAllocAndQFrames(appCaptObj_t *appObj)
+{
+    int32_t                 retVal = FVID2_SOK;
+    uint32_t                streamId, idx;
+    uint32_t                bufSize;
+    Fvid2_Format            fmt;
+    Fvid2_Frame            *pFrm;
+    static Fvid2_FrameList  frmList;
+    static Char             fileStr[200U];
+
+    /* for every stream and channel in a capture handle */
+    Fvid2FrameList_init(&frmList);
+    for (streamId = 0U; streamId < appObj->createPrms.numStream; streamId++)
+    {
+        Fvid2Format_init(&fmt);
+        fmt.width      = appObj->testPrms.width;
+        fmt.height     = appObj->testPrms.height;
+        fmt.pitch[0]   = appObj->testPrms.pitch;
+        fmt.ccsFormat  = FVID2_CCSF_BITS8_PACKED;
+        fmt.dataFormat = gTestCfg.inDataFmt;
+
+        idx = streamId * CAPT_APP_FRAMES_PER_STREAM;
+
+        if (idx >= (CAPT_APP_FRAMES_PER_STREAM * CAL_CAPT_MAX_STREAMS))
+        {
+            GT_assert(CalTrace, FALSE);
+        }
+
+        pFrm = (Fvid2_Frame *) &appObj->frames[idx];
+
+        /* fill format with channel specific values  */
+        fmt.chNum = Cal_captMakeChNum(appObj->instId, streamId, 0U);
+
+        /*
+         * alloc memory based on 'format'
+         * Allocated frame info is put in frames[]
+         * CAPT_APP_FRAMES_PER_STREAM is the number of buffers per channel to
+         * allocate
+         */
+        retVal = CalUtils_memFrameAlloc(&fmt, pFrm,
+                                        CAPT_APP_FRAMES_PER_STREAM);
+        if (FVID2_SOK != retVal)
+        {
+            GT_0trace(CalTrace, GT_ERR,
+                      APP_NAME ": Capture Frame Alloc Failed!!!\r\n");
+            break;
+        }
+
+        CalUtils_memFrameGetSize(&fmt, &bufSize, NULL);
+        CacheP_wbInv((void *)pFrm[0].addr[0], (CAPT_APP_FRAMES_PER_STREAM * bufSize));
+
+        snprintf(fileStr, sizeof (fileStr),
+                 "captureCalOption%uStr%u_prog_packed_%u_%u.tigf",
+                 (unsigned int) appObj->testPrms.cfgId,
+                 (unsigned int) streamId,
+                 (unsigned int) appObj->testPrms.width,
+                 (unsigned int) appObj->testPrms.height);
+        GT_3trace(
+            CalTrace, GT_INFO,
+            "saveRaw(0, 0x%.8x, \"D:\\\\%s\", %d, 32, false);\r\n",
+            pFrm[0].addr[0], fileStr, (bufSize / 4U));
+
+        /* Set number of frame in frame list */
+        for (idx = 0; idx < CAPT_APP_FRAMES_PER_STREAM; idx++)
+        {
+            /* Associate instance of sub-frame information structure with the
+                frame */
+            pFrm[idx].subFrameInfo = NULL;
+            pFrm[idx].appData = appObj;
+
+            frmList.frames[idx] = &pFrm[idx];
+            GT_2trace(CalTrace, GT_INFO, APP_NAME ": Captured Frames [%d]"
+                      " Available at 0x%x\r\n", idx, pFrm[idx].addr[0]);
+        }
+        frmList.numFrames = CAPT_APP_FRAMES_PER_STREAM;
+
+        /*
+         * queue the frames in frmList
+         * All allocated frames are queued here as an example.
+         * In general atleast 2 frames per stream/channel need to queued
+         * before capture can be started.
+         * Failing which, frame could be dropped.
+         */
+        retVal = Fvid2_queue(appObj->drvHandle, &frmList, streamId);
+        if (FVID2_SOK != retVal)
+        {
+            GT_0trace(CalTrace, GT_ERR,
+                      APP_NAME ": Capture Queue Failed!!!\r\n");
+            break;
+        }
+    }
+
+    return (retVal);
+}
+
+static int32_t appCaptFreeFrames(appCaptObj_t *appObj)
+{
+    int32_t                  retVal = FVID2_SOK;
+    uint32_t                 streamId, idx;
+    Fvid2_Format           fmt;
+    Fvid2_Frame           *pFrm;
+    static Fvid2_FrameList frmList;
+
+    /* for every stream and channel in a capture handle */
+    Fvid2FrameList_init(&frmList);
+    for (streamId = 0U; streamId < appObj->createPrms.numStream; streamId++)
+    {
+        Fvid2Format_init(&fmt);
+        fmt.width      = appObj->testPrms.width;
+        fmt.height     = appObj->testPrms.height;
+        fmt.pitch[0]   = appObj->testPrms.pitch;
+        fmt.ccsFormat  = FVID2_CCSF_BITS8_PACKED;
+        fmt.dataFormat = gTestCfg.inDataFmt;
+
+        /* Dequeue all the request from the driver */
+        while (1U)
+        {
+            retVal = Fvid2_dequeue(
+                appObj->drvHandle,
+                &frmList,
+                streamId,
+                FVID2_TIMEOUT_NONE);
+            if (FVID2_SOK != retVal)
+            {
+                break;
+            }
+        }
+
+        idx  = streamId * CAPT_APP_FRAMES_PER_STREAM;
+        pFrm = (Fvid2_Frame *) &appObj->frames[idx];
+        retVal = CalUtils_memFrameFree(&fmt, pFrm, CAPT_APP_FRAMES_PER_STREAM);
+        if (FVID2_SOK != retVal)
+        {
+            GT_0trace(CalTrace, GT_ERR,
+                      APP_NAME ": Capture Frame Free Failed!!!\r\n");
+        }
+
+        if (FVID2_SOK != retVal)
+        {
+            break;
+        }
+    }
+
+    return (retVal);
+}
+
+static void appCaptErrCb(const uint32_t *event, uint32_t numEvents, void * arg)
+{
+    uint32_t idx;
+    appCaptObj_t *pAppObj = (appCaptObj_t *)arg;
+    for (idx = 0U; idx < numEvents; idx++)
+    {
+        if (CAL_CSI2_PPI_VC_SOF1 == event[idx])
+        {
+            pAppObj->sofIntCount++;
+        }
+        else if ((CAL_CSI2_PPI_VC_CRC_MISMATCH_VC1 == event[idx]) ||
+                 (CAL_CSI2_PPI_VC_CRC_MISMATCH_VC2 == event[idx]) ||
+                 (CAL_CSI2_PPI_VC_CRC_MISMATCH_VC3 == event[idx]) ||
+                 (CAL_CSI2_PPI_VC_CRC_MISMATCH_VC4 == event[idx]))
+        {
+            pAppObj->crcErrIntCnt++;
+        }
+        else if ((CAL_CSI2_PPI_VC_ECC_CORRECTION_VC1 == event[idx]) ||
+                 (CAL_CSI2_PPI_VC_ECC_CORRECTION_VC2 == event[idx]) ||
+                 (CAL_CSI2_PPI_VC_ECC_CORRECTION_VC3 == event[idx]) ||
+                 (CAL_CSI2_PPI_VC_ECC_CORRECTION_VC4 == event[idx]))
+        {
+            pAppObj->eccErrIntCnt++;
+        }
+        else
+        {
+            pAppObj->unExpectedIntCnt++;
+        }
+    }
+}
+
+static int32_t appCaptEnableErrorReporting(appCaptObj_t *appObj)
+{
+    int32_t retVal;
+    Cal_ErrorCfg_t errCfg;
+
+    errCfg.numErrorsToMonitor = 8U;
+    errCfg.cmplxIoId = 0U;
+    errCfg.errSrc[0U] = CAL_CSI2_PPI_VC_CRC_MISMATCH_VC1;
+    errCfg.errSrc[1U] = CAL_CSI2_PPI_VC_CRC_MISMATCH_VC2;
+    errCfg.errSrc[2U] = CAL_CSI2_PPI_VC_CRC_MISMATCH_VC3;
+    errCfg.errSrc[3U] = CAL_CSI2_PPI_VC_CRC_MISMATCH_VC4;
+    errCfg.errSrc[4U] = CAL_CSI2_PPI_VC_ECC_CORRECTION_VC1;
+    errCfg.errSrc[5U] = CAL_CSI2_PPI_VC_ECC_CORRECTION_VC2;
+    errCfg.errSrc[6U] = CAL_CSI2_PPI_VC_ECC_CORRECTION_VC3;
+    errCfg.errSrc[7U] = CAL_CSI2_PPI_VC_ECC_CORRECTION_VC4;
+
+    errCfg.appCb = &appCaptErrCb;
+    errCfg.pAppCbArgs = (void *)appObj;
+
+    retVal = Fvid2_control(appObj->drvHandle, IOCTL_CAL_CAPT_SET_ERR_PRMS,
+                           &errCfg, NULL);
+    if (FVID2_SOK != retVal)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Capture Set CAL Params Failed!!!\r\n");
+    }
+    return retVal;
+}
+
+static void DispApp_create(appCaptObj_t *appObj)
+{
+    int32_t retVal = FVID2_SOK;
+    SemaphoreP_Params semParams;
+    Dss_DctrlVpParams *vpParams;
+    DispApp_InstObj *instObj;
+
+    DispApp_initParams(appObj);
+    vpParams = &appObj->vpParams;
+    Dss_dctrlVpParamsInit(vpParams);
+
+    vpParams->vpId = TEST_VP_ID;
+    vpParams->lcdOpTimingCfg.mInfo.standard = FVID2_STD_CUSTOM;
+    vpParams->lcdOpTimingCfg.mInfo.width = DISP_APP_LCD_WIDTH;
+    vpParams->lcdOpTimingCfg.mInfo.height = DISP_APP_LCD_HEIGHT;
+    vpParams->lcdOpTimingCfg.mInfo.hFrontPorch = 48U;
+    vpParams->lcdOpTimingCfg.mInfo.hBackPorch = 80U;
+    vpParams->lcdOpTimingCfg.mInfo.hSyncLen = 32U;
+    vpParams->lcdOpTimingCfg.mInfo.vFrontPorch = 3U;
+    vpParams->lcdOpTimingCfg.mInfo.vBackPorch = 14U;
+    vpParams->lcdOpTimingCfg.mInfo.vSyncLen = 6U;
+    vpParams->lcdOpTimingCfg.dvoFormat = FVID2_DV_GENERIC_DISCSYNC;
+    vpParams->lcdOpTimingCfg.videoIfWidth = FVID2_VIFW_24BIT;
+
+    vpParams->lcdPolarityCfg.actVidPolarity = FVID2_POL_HIGH;
+    vpParams->lcdPolarityCfg.pixelClkPolarity = FVID2_EDGE_POL_FALLING;
+    vpParams->lcdPolarityCfg.hsPolarity = FVID2_POL_HIGH;
+    vpParams->lcdPolarityCfg.vsPolarity = FVID2_POL_HIGH;
+
+    DispApp_configDctrl(appObj);
+
+    instObj = &appObj->instObj;
+    SemaphoreP_Params_init(&semParams);
+    semParams.mode = SemaphoreP_Mode_BINARY;
+    instObj->drvHandle = Fvid2_create(
+        DSS_DISP_DRV_ID,
+        instObj->instId,
+        &instObj->createParams,
+        &instObj->createStatus,
+        &instObj->cbParams);
+    if((NULL == instObj->drvHandle) ||
+       (instObj->createStatus.retVal != FVID2_SOK))
+    {
+        GT_0trace(CalTrace, GT_ERR,
+              APP_NAME ": Display Create Failed!!!\r\n");
+        retVal = instObj->createStatus.retVal;
+    }
+
+    if(FVID2_SOK == retVal)
+    {
+        retVal = Fvid2_control(
+            instObj->drvHandle,
+            IOCTL_DSS_DISP_SET_DSS_PARAMS,
+            &instObj->dispParams,
+            NULL);
+        if(retVal != FVID2_SOK)
+        {
+            GT_0trace(CalTrace, GT_ERR,
+              APP_NAME ": DSS Set Params IOCTL Failed!!!\r\n");
+        }
+    }
+
+    if(FVID2_SOK == retVal)
+    {
+        retVal = DispApp_allocAndQueueFrames(appObj, instObj);
+        if(retVal != FVID2_SOK)
+        {
+            GT_0trace(CalTrace, GT_ERR,
+              APP_NAME ": Display Alloc and Queue Failed!!!\r\n");
+        }
+    }
+
+    if(FVID2_SOK == retVal)
+    {
+        GT_0trace(CalTrace, GT_INFO,
+              APP_NAME ": Display create complete!!\r\n");
+    }
+
+    return;
+}
+
+static void DispApp_delete(appCaptObj_t *appObj)
+{
+    int32_t             retVal;
+    Dss_DctrlVpParams  *vpParams;
+    Dss_DctrlPathInfo  *pathInfo;
+    DispApp_InstObj    *instObj;
+    Fvid2_FrameList     frmList;
+    Fvid2_Format        fmt;
+    Fvid2_Frame        *pFrm;
+
+    vpParams = &appObj->vpParams;
+    pathInfo = &appObj->dctrlPathInfo;
+
+    retVal = Fvid2_control(
+        appObj->dctrlHandle,
+        IOCTL_DSS_DCTRL_CLEAR_PATH,
+        pathInfo,
+        NULL);
+    if(FVID2_SOK != retVal)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+              APP_NAME ": DCTRL Clear Path Failed!!!\r\n");
+    }
+
+    retVal = Fvid2_control(
+        appObj->dctrlHandle,
+        IOCTL_DSS_DCTRL_STOP_VP,
+        vpParams,
+        NULL);
+    if(FVID2_SOK != retVal)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+              APP_NAME ": VP Stop Failed!!!\r\n");
+    }
+
+    /* Dequeue all the request from the driver */
+    instObj = &appObj->instObj;
+    while (1U)
+    {
+        retVal = Fvid2_dequeue(
+            instObj->drvHandle,
+            &frmList,
+            0U,
+            FVID2_TIMEOUT_NONE);
+        if(FVID2_SOK != retVal)
+        {
+            break;
+        }
+    }
+
+    /* Free-up display buffers */
+    Fvid2Format_init(&fmt);
+    fmt.chNum      = 0U;
+    fmt.width      = appObj->testPrms.width;
+    fmt.height     = appObj->testPrms.height;
+    fmt.pitch[0U]  = appObj->testPrms.pitch;
+    fmt.ccsFormat  = FVID2_CCSF_BITS8_PACKED;
+    fmt.dataFormat = gTestCfg.inDataFmt;
+
+    pFrm = (Fvid2_Frame *) &instObj->dispFrames[0U];
+    retVal = CalUtils_memFrameFree(&fmt, pFrm, LPBK_APP_DISP_MAX_FRM);
+    if (FVID2_SOK != retVal)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Display Frame Free Failed!!!\r\n");
+    }
+
+    retVal = Fvid2_delete(instObj->drvHandle, NULL);
+    if(FVID2_SOK != retVal)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+              APP_NAME ": Display Delete Failed!!!\r\n");
+    }
+
+    if(FVID2_SOK == retVal)
+    {
+         GT_0trace(CalTrace, GT_INFO,
+              APP_NAME ": Display delete complete!!\r\n");
+    }
+
+    return;
+}
+
+static void DispApp_initParams(appCaptObj_t *appObj)
+{
+    uint32_t i;
+    Dss_DispParams *dispParams;
+    DispApp_InstObj *instObj;
+
+    /* Initialize video pipes */
+    instObj = &appObj->instObj;
+    instObj->instId = gTestCfg.instId;
+    Dss_dispCreateParamsInit(&instObj->createParams);
+    Fvid2CbParams_init(&instObj->cbParams);
+    instObj->cbParams.cbFxn = &DispApp_pipeCbFxn;
+    instObj->cbParams.appData = appObj;
+
+    dispParams = &instObj->dispParams;
+    Dss_dispParamsInit(dispParams);
+    dispParams->pipeCfg.pipeType = gTestCfg.pipeType;
+    dispParams->pipeCfg.inFmt.width = gTestCfg.inWidth;
+    dispParams->pipeCfg.inFmt.height = gTestCfg.inHeight;
+    for(i=0U; i<FVID2_MAX_PLANES; i++)
+    {
+        dispParams->pipeCfg.inFmt.pitch[i] = gTestCfg.pitch;
+    }
+    dispParams->pipeCfg.inFmt.dataFormat = gTestCfg.inDataFmt;
+    dispParams->pipeCfg.inFmt.scanFormat = gTestCfg.inScanFmt;
+    dispParams->pipeCfg.inFmt.ccsFormat  = FVID2_CCSF_BITS8_PACKED;
+    dispParams->pipeCfg.outWidth = gTestCfg.outWidth;
+    dispParams->pipeCfg.outHeight = gTestCfg.outHeight;
+    dispParams->pipeCfg.scEnable = gTestCfg.scEnable;
+    dispParams->alphaCfg.globalAlpha = gTestCfg.globalAlpha;
+    dispParams->alphaCfg.preMultiplyAlpha = gTestCfg.preMultiplyAlpha;
+    dispParams->layerPos.startX = gTestCfg.posx;
+    dispParams->layerPos.startY = gTestCfg.posy;
+}
+
+/**
+ *  \brief Allocate and queue frames to driver
+ */
+static Int32 DispApp_allocAndQueueFrames(const appCaptObj_t *appObj,
+                                           DispApp_InstObj *instObj)
+{
+    Int32           retVal = FVID2_SOK;
+    UInt32          frmId;
+    UInt32          bufSize;
+    Fvid2_Format    fmt;
+    Fvid2_Frame    *frm;
+    Fvid2_FrameList frmList;
+
+    Fvid2FrameList_init(&frmList);
+
+    Fvid2Format_init(&fmt);
+    frm = &instObj->dispFrames[0U];
+
+    /* fill format with channel specific values  */
+    /* Set channel number as invalid so that the blank frame is used only
+     * at the start */
+    fmt.chNum      = 0U;
+    fmt.width      = appObj->testPrms.width;
+    fmt.height     = appObj->testPrms.height;
+    fmt.pitch[0U]  = appObj->testPrms.pitch;
+    fmt.ccsFormat  = FVID2_CCSF_BITS8_PACKED;
+    fmt.dataFormat = gTestCfg.inDataFmt;
+
+    /*
+     * alloc memory based on 'format'
+     * Allocated frame info is put in frames[]
+     * LPBK_APP_DISP_MAX_FRM is the number of buffers per channel to
+     * allocate
+     */
+    retVal = CalUtils_memFrameAlloc(&fmt, frm, LPBK_APP_DISP_MAX_FRM);
+    if (FVID2_SOK != retVal)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+                  APP_NAME ": Display Frame Alloc Failed!!!\r\n");
+    }
+
+    for (frmId = 0U; frmId < LPBK_APP_DISP_MAX_FRM; frmId++)
+    {
+        frm[frmId].fid     = FVID2_FID_FRAME;
+        frm[frmId].appData = instObj;
+
+        /* Fill with background color */
+        CalUtils_memFrameGetSize(&fmt, &bufSize, NULL);
+        /* Flush and invalidate the CPU write */
+        CacheP_wbInv((void *)frm[frmId].addr[0U], (LPBK_APP_DISP_MAX_FRM * bufSize));
+
+        /* Set number of frame in frame list - one at a time */
+        frmList.numFrames  = 1U;
+        frmList.frames[0U] = &frm[frmId];
+
+        /*
+         * queue the frames in frmList
+         * All allocate frames are queued here as an example.
+         * In general atleast 2 frames per channel need to queued
+         * before starting display,
+         * else frame will get dropped until frames are queued
+         */
+        retVal = Fvid2_queue(instObj->drvHandle, &frmList, 0U);
+        if (FVID2_SOK != retVal)
+        {
+            GT_0trace(CalTrace, GT_ERR,
+                      APP_NAME ": Display Queue Failed!!!\r\n");
+            break;
+        }
+    }
+
+    return (retVal);
+}
+
+static int32_t DispApp_configDctrl(appCaptObj_t *appObj)
+{
+    int32_t retVal = FVID2_SOK;
+    Dss_DctrlVpParams *vpParams;
+    Dss_DctrlOverlayParams *overlayParams;
+    Dss_DctrlOverlayLayerParams *layerParams;
+    Dss_DctrlPathInfo *pathInfo;
+#if defined (SOC_AM65XX)
+    Dss_DctrlOldiParams *oldiParams;
+    oldiParams = &appObj->oldiParams;
+    Dss_dctrlOldiParamsInit(oldiParams);
+#endif
+    vpParams = &appObj->vpParams;
+    overlayParams = &appObj->overlayParams;
+    layerParams = &appObj->layerParams;
+    pathInfo = &appObj->dctrlPathInfo;
+    Dss_dctrlOverlayParamsInit(overlayParams);
+    Dss_dctrlOverlayLayerParamsInit(layerParams);
+    Dss_dctrlPathInfoInit(pathInfo);
+
+    pathInfo->edgeInfo[pathInfo->numEdges].startNode = gTestCfg.pipeNodeId;
+    pathInfo->edgeInfo[pathInfo->numEdges].endNode = TEST_DCTRL_OVERLAY_NODE_ID;
+    pathInfo->numEdges++;
+    pathInfo->edgeInfo[pathInfo->numEdges].startNode = TEST_DCTRL_OVERLAY_NODE_ID;
+    pathInfo->edgeInfo[pathInfo->numEdges].endNode = TEST_DCTRL_VP_NODE_ID;
+    pathInfo->numEdges++;
+    pathInfo->edgeInfo[pathInfo->numEdges].startNode = TEST_DCTRL_VP_NODE_ID;
+    pathInfo->edgeInfo[pathInfo->numEdges].endNode = TEST_DCTRL_OUT_NODE_ID;
+    pathInfo->numEdges++;
+
+    retVal = Fvid2_control(
+        appObj->dctrlHandle,
+        IOCTL_DSS_DCTRL_SET_PATH,
+        pathInfo,
+        NULL);
+    if(retVal != FVID2_SOK)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+              APP_NAME ": Dctrl Set Path IOCTL Failed!!!\r\n");
+    }
+
+    retVal = Fvid2_control(
+        appObj->dctrlHandle,
+        IOCTL_DSS_DCTRL_SET_VP_PARAMS,
+        vpParams,
+        NULL);
+    if(retVal != FVID2_SOK)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+              APP_NAME ": Dctrl Set VP Params IOCTL Failed!!!\r\n");
+    }
+
+#if defined (SOC_AM65XX)
+    retVal = Fvid2_control(
+        appObj->dctrlHandle,
+        IOCTL_DSS_DCTRL_SET_OLDI_PARAMS,
+        oldiParams,
+        NULL);
+    if(retVal != FVID2_SOK)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+              APP_NAME ": DCTRL Set OLDI Params IOCTL Failed!!!\r\n");
+    }
+#endif
+
+    overlayParams->overlayId = TEST_OVERLAY_ID;
+    overlayParams->colorbarEnable = FALSE;
+    overlayParams->overlayCfg.colorKeyEnable = TRUE;
+    overlayParams->overlayCfg.colorKeySel = CSL_DSS_OVERLAY_TRANS_COLOR_DEST;
+    overlayParams->overlayCfg.backGroundColor = 0x101010U;
+    retVal = Fvid2_control(
+        appObj->dctrlHandle,
+        IOCTL_DSS_DCTRL_SET_OVERLAY_PARAMS,
+        overlayParams,
+        NULL);
+    if(retVal != FVID2_SOK)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+              APP_NAME ": DCTRL Set Overlay Params IOCTL Failed!!!\r\n");
+    }
+
+    layerParams->overlayId = TEST_OVERLAY_ID;
+    layerParams->pipeLayerNum[gTestCfg.pipeId] = CSL_DSS_OVERLAY_LAYER_NUM_1;
+#if defined (SOC_J7)
+    layerParams->pipeLayerNum[gTestCfg.invalidPipeId] =
+                                                CSL_DSS_OVERLAY_LAYER_INVALID;
+#endif
+    retVal = Fvid2_control(
+        appObj->dctrlHandle,
+        IOCTL_DSS_DCTRL_SET_LAYER_PARAMS,
+        layerParams,
+        NULL);
+    if(retVal != FVID2_SOK)
+    {
+        GT_0trace(CalTrace, GT_ERR,
+              APP_NAME ": DCTRL Set Layer Params IOCTL Failed!!!\r\n");
+    }
+
+    return (retVal);
+}
+
+static int32_t DispApp_pipeCbFxn(Fvid2_Handle handle, void *appData)
+{
+    int32_t retVal  = FVID2_SOK;
+    appCaptObj_t *appObj = (appCaptObj_t *) appData;
+    GT_assert(DssTrace, (NULL != appObj));
+    static Fvid2_FrameList frmList;
+
+    retVal = Fvid2_dequeue(appObj->instObj.drvHandle, &frmList, 0U, FVID2_TIMEOUT_NONE);
+    if(FVID2_SOK == retVal)
+    {
+        retVal = Fvid2_queue(appObj->drvHandle, &frmList, 0U);
+        if (FVID2_SOK != retVal)
+        {
+            while(1);
+        }
+    }
+
+    return (retVal);
+}
+
+void App_print(const char *format, ...)
+{
+    va_list     vaArgPtr;
+
+    va_start(vaArgPtr, format);
+
+    UART_printf(format, vaArgPtr);
+    printf(format, vaArgPtr);
+
+    va_end(vaArgPtr);
+
+    return;
+}
diff --git a/packages/ti/drv/cal/examples/cal_loopback_test/src/cal_loopback_test.h b/packages/ti/drv/cal/examples/cal_loopback_test/src/cal_loopback_test.h
new file mode 100755 (executable)
index 0000000..0b820af
--- /dev/null
@@ -0,0 +1,309 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2018
+ *
+ *  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 CaptureCal_main.h
+ *
+ *  \brief Defines various strcutures / defines needed by capture demo app.
+ *
+ */
+
+#ifndef CAL_LOOPBACK_TEST_H_
+#define CAL_LOOPBACK_TEST_H_
+
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef BARE_METAL
+#include <xdc/std.h>
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+#include <ti/sysbios/utils/Load.h>
+#include <ti/sysbios/hal/Cache.h>
+#endif
+
+#include <ti/drv/fvid2/fvid2.h>
+#include <ti/drv/cal/cal.h>
+#include <ti/drv/dss/dss.h>
+#include <ti/drv/uart/UART.h>
+#include <ti/drv/uart/UART_stdio.h>
+
+#include <ti/drv/cal/examples/utils/calutils.h>
+#include <ti/drv/dss/examples/utils/app_utils.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ========================================================================== */
+/*                           Macros & Typedefs                                */
+/* ========================================================================== */
+
+#define APP_NAME                        "CAL_LOOPBACK_APP"
+
+/**< Default run count in seconds in case of EVM else this is in frame count. */
+#define CAPT_APP_RUN_COUNT              (1000U)
+
+/**< Number of frames per stream */
+#define CAPT_APP_FRAMES_PER_STREAM      (2U)
+
+/**< End of frame event */
+#define CAPT_APP_END_OF_FRAME_EVENT     (1U)
+/**< Nth line frame event */
+#define CAPT_APP_NTH_LINE_FRAME_EVENT   (0U)
+/**< Stream for which Nth line frame events are to be enabled */
+#define CAPT_APP_NTH_LINE_STREAM_ID     (0U)
+
+#define DISP_APP_LCD_WIDTH              (1280U)
+#define DISP_APP_LCD_HEIGHT             (800U)
+
+/* Worst case frames per handle */
+#define DISP_APP_MAX_FRAMES_PER_HANDLE  (2U)
+
+#define TEST_VP_ID                      (CSL_DSS_VP_ID_1)
+#define TEST_OVERLAY_ID                 (CSL_DSS_OVERLAY_ID_1)
+#define TEST_DCTRL_OVERLAY_NODE_ID      (DSS_DCTRL_NODE_OVERLAY1)
+#define TEST_DCTRL_VP_NODE_ID           (DSS_DCTRL_NODE_VP1)
+#define TEST_DCTRL_OUT_NODE_ID          (DSS_DCTRL_NODE_OLDI)
+
+/* Worst case frames per handle - used for blank frames */
+#define LPBK_APP_DISP_MAX_FRM           (1U)
+
+/* ========================================================================== */
+/*                         Structure Declarations                             */
+/* ========================================================================== */
+
+/**
+ * \brief Specify different config that would be used to cpature
+ */
+typedef struct appCaptCfg
+{
+    Char                   *testDescStr;
+    /**< Test description. */
+    uint32_t                  cfgId;
+    /**< Config identifier */
+    uint32_t                  useIt;
+    /**< Capture with this config, could be bypassed, by set this to FALSE */
+    Fvid2_VideoIfMode       interfaceType;
+    /**< Either CSI2, LVDS, Parallel */
+    uint32_t                interfacewidth;
+    /**< 1,2,3,4 lanes for CSI2, 4 lane for LVDS, 8-16 bits for parallel */
+    uint32_t                  numStreams;
+    /**< Should be 1 for all sensor with exception of UB960/TIDA00262 in which
+     *      case it can be upto 4. */
+    uint32_t                  virtualChannel;
+    /**< In case of CSI2 - specify the virtual channel */
+    Cal_Csi2DataFormat inCsi2DataFormat;
+    /**< Specify input data format */
+    uint32_t                  inBpp;
+    /**< Number of bits / pixel */
+    uint32_t                  numFrames;
+    /**< Specify number of frames to capture */
+    uint32_t                  width;
+    /**< Expected frame width that requires to be captured. If sensor streams
+     *      frames with greater width, the extra pixels would not be written.
+     *      If sensors streams frames with less line length, the received
+     *      lines are written. */
+    uint32_t                  height;
+    /**< Expected frame height requires to be captured. If sensor streams
+     *      frames with higher number of lines, the extra lines would not be
+     *      written / captured.*/
+    uint32_t                  pitch;
+    /**< Associated sensor driver, that would stream */
+    uint32_t                  sensorDriverId;
+    uint32_t                  standard;
+    /**< Resolution */
+    uint32_t                  dataFormat;
+    /**< Standard FVID2 resolution that sensor would be configured to stream */
+    uint32_t                  bpp;
+    /**< bits / pixel */
+    uint32_t instId;
+    /**< Driver instance id */
+    uint32_t pipeId;
+    /**< Pipe id */
+    uint32_t pipeNodeId;
+    /**< Pipe Node id */
+    uint32_t pipeType;
+    /**< Video pipe type */
+    uint32_t inDataFmt;
+    /**< Data format */
+    uint32_t inWidth;
+    /**< Input buffer resolution width in pixels */
+    uint32_t inHeight;
+    /**< Input buffer resolution height in lines */
+    uint32_t inScanFmt;
+    /**< Scan format */
+    uint32_t outWidth;
+    /**< Output buffer resolution width in pixels */
+    uint32_t outHeight;
+    /**< Output buffer resolution height in lines */
+    uint32_t scEnable;
+    /**< Scaler enable */
+    uint32_t globalAlpha;
+    /**< Global Alpha value */
+    uint32_t preMultiplyAlpha;
+    /**< Pre-multiply Alpha value */
+    uint32_t posx;
+    /**< Input buffer position x. */
+    uint32_t posy;
+    /**< Input buffer position y. */
+    uint32_t invalidPipeId;
+    /**< Pipe id */
+}appCaptCfg_t;
+
+/**
+ *  \brief Driver instance information.
+ */
+typedef struct
+{
+    uint32_t instId;
+    /**< Instance ID */
+    Dss_DispCreateParams createParams;
+    /**< Create time parameters */
+    Dss_DispCreateStatus createStatus;
+    /**< Create status returned by driver during Fvid2_create() */
+    Dss_DispParams dispParams;
+    /**< DSS display parameters */
+    Fvid2_Handle drvHandle;
+    /**< FVID2 display driver handle */
+    Fvid2_CbParams cbParams;
+    /**< Callback parameters */
+    Fvid2_Frame  dispFrames[LPBK_APP_DISP_MAX_FRM];
+    /**< FVID2 Frames that will be used for display. */
+
+} DispApp_InstObj;
+
+/**
+ *  \brief Capture application object.
+ */
+typedef struct appCaptObj
+{
+    Cal_CaptOpenParams_t      calOpenPrms;
+    /**< Cal create time parameters */
+    Fvid2_VideoIfMode         videoIfMode;
+    /**< CSI2, LVDS, Parallel etc... */
+    uint32_t                  videoIfWidth;
+    /**< Number of lanes in case CSI2 and number of bits in case of parallel */
+    uint32_t                    numStream;
+    /**< Number of channel in multi-ch case, must be 1 for single channel. */
+    //uint32_t                    virtualChannel;
+    /**< Virtual channel of CSI2, if mode is CSI2 */
+    Cal_Csi2DataFormat        dataFormat;
+    /**< Data format of CSI2 stream */
+    uint32_t                    instId;
+    /**< Cal Instance ID. As defined in ti\drv\cal\include\cal_cfg.h*/
+    Cal_CaptCreateParams      createPrms;
+    /**< Create time parameters. */
+    Cal_CaptCreateStatus      createStatus;
+    /**< Create status returned by driver during Fvid2_create(). */
+    Fvid2_Handle              drvHandle;
+    /**< FVID2 capture driver handle. */
+    Fvid2_CbParams            cbPrms;
+    /**< Callback params. */
+
+    Cal_Cfg_t                 cfg;
+    /**< TODO currently done for 1 stream, update for mutiple streams */
+    uint32_t                    numFramesToCapture;
+    /**< Number of frames to receive for a given configuration */
+    uint32_t                    maxWidth;
+    /**< Max width in pixels - used for buffer allocation for all instance. */
+    uint32_t                    maxHeight;
+    /**< Max height in lines - used for buffer allocation for all instance. */
+
+    appCaptCfg_t                testPrms;
+
+    uint32_t                    totalFrmCount;
+    /**< Count of all frames captured. */
+    uint32_t                    totalCpuLoad;
+    /**< Accumulated CPU load - added every frame. */
+    uint32_t                    cpuLoadCount;
+    /**< CPU load count used to get average CPU load - incremented every
+     *   accumulation. */
+
+    Fvid2_Frame                 frames[CAPT_APP_FRAMES_PER_STREAM * \
+                                     CAL_CAPT_MAX_STREAMS];
+    /**< FVID2 Frames that will be used for capture. */
+    volatile uint32_t           rcvedFramesCount;
+    /**< Received frames for a given config */
+    uint32_t                    frameWithCrcErrorCnt;
+    /**< Track the number of frames with CRC errors */
+    uint32_t                    frameWithWarning;
+    /**< Track the number of frames with warning, i.e. ecc corrected */
+    uint32_t                    frameErrorCnt;
+    /**< Other errors in frame */
+    volatile uint32_t           sofIntCount;
+    /**< Counts the number of Start Of Frame sync interrupts received
+            CSI2 i/f */
+    volatile uint32_t           crcErrIntCnt;
+    /**< Counts the number of CRC failure on CSI2 i/f */
+    volatile uint32_t           eccErrIntCnt;
+    /**< Counts the number of ECC failure on CSI2 i/f */
+    volatile uint32_t           unExpectedIntCnt;
+    /**< in case we receive un expected interrupt */
+
+    /**< Index into the above arrays */
+    DispApp_InstObj instObj;
+    /**< Display driver instance objects */
+    Fvid2_Handle dctrlHandle;
+    /**< DCTRL handle */
+    Dss_InitParams initParams;
+    /**< DSS Initialization Parameters */
+    Dss_DctrlPathInfo dctrlPathInfo;
+    /**< DSS Path Information */
+    Dss_DctrlVpParams vpParams;
+    /**< VP Params */
+    Dss_DctrlOverlayParams overlayParams;
+    /**< Overlay Params */
+    Dss_DctrlOverlayLayerParams layerParams;
+    /**< Layer Params */
+#if defined (SOC_AM65XX)
+    Dss_DctrlOldiParams oldiParams;
+    /**< OLDI Params */
+#endif
+}appCaptObj_t;
+
+/* ========================================================================== */
+/*                          Function Declarations                             */
+/* ========================================================================== */
+
+/* None */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* #ifndef CAL_LOOPBACK_TEST_H_ */
diff --git a/packages/ti/drv/cal/examples/cal_loopback_test/src/main_baremetal.c b/packages/ti/drv/cal/examples/cal_loopback_test/src/main_baremetal.c
new file mode 100755 (executable)
index 0000000..11159d8
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2018
+ *
+ *  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 main_baremetal.c
+ *
+ *  \brief Main file for baremetal build
+ */
+
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <ti/board/board.h>
+#include <ti/drv/dss/examples/utils/app_utils.h>
+
+/* ========================================================================== */
+/*                           Macros & Typedefs                                */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                         Structure Declarations                             */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                          Function Declarations                             */
+/* ========================================================================== */
+
+extern int32_t Cal_loopbackTest(void);
+static int32_t appBoardInit(void);
+
+/* ========================================================================== */
+/*                            Global Variables                                */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                          Function Definitions                              */
+/* ========================================================================== */
+
+int main(void)
+{
+    appBoardInit();
+    Cal_loopbackTest();
+
+    return(0);
+}
+
+static int32_t appBoardInit(void)
+{
+    Board_initCfg boardCfg;
+
+    boardCfg = BOARD_INIT_PINMUX_CONFIG |
+                BOARD_INIT_UNLOCK_MMR |
+                BOARD_INIT_UART_STDIO;
+    Board_init(boardCfg);
+
+#if defined (SOC_AM65XX)
+    App_configureLCD(APP_OUTPUT_OLDI);
+#else
+    App_configureLCD(APP_OUTPUT_HDMI);
+#endif
+    App_configureSoC();
+
+    return 0;
+}
diff --git a/packages/ti/drv/cal/examples/cal_loopback_test/src/main_tirtos.c b/packages/ti/drv/cal/examples/cal_loopback_test/src/main_tirtos.c
new file mode 100644 (file)
index 0000000..cb0b95a
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2018
+ *
+ *  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 main_tirtos.c
+ *
+ *  \brief Main file for TI-RTOS build
+ */
+
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+
+#include <stdio.h>
+/* XDCtools Header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/System.h>
+/* BIOS Header files */
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+#include <ti/board/board.h>
+#include <ti/drv/dss/examples/utils/app_utils.h>
+
+/* ========================================================================== */
+/*                           Macros & Typedefs                                */
+/* ========================================================================== */
+
+/**< Demo application stack size */
+#define CAPT_APP_TSK_STACK_MAIN         (10U * 1024U)
+
+/**< Demo application task priority */
+#define CAPT_APP_TSK_PRI_MAIN           (10U)
+
+/* ========================================================================== */
+/*                         Structure Declarations                             */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                          Function Declarations                             */
+/* ========================================================================== */
+static Void taskFxn(UArg a0, UArg a1);
+extern void Cal_loopbackTest(void);
+static int32_t appBoardInit(void);
+
+/* ========================================================================== */
+/*                            Global Variables                                */
+/* ========================================================================== */
+/**< Align stack memory to integer boundary. */
+static uint8_t gCaptAppTskStackMain[CAPT_APP_TSK_STACK_MAIN]
+                    __attribute__ ((section (".bss:taskStackSection")))
+                    __attribute__((aligned(32)));
+/* ========================================================================== */
+/*                          Function Definitions                              */
+/* ========================================================================== */
+int main(void)
+{
+    Task_Handle task;
+    Error_Block eb;
+    Task_Params taskParams;
+
+    Error_init(&eb);
+
+    /* Initialize the task params */
+    Task_Params_init(&taskParams);
+    /* Set the task priority higher than the default priority (1) */
+    taskParams.priority      = CAPT_APP_TSK_PRI_MAIN;
+    taskParams.stack         = gCaptAppTskStackMain;
+    taskParams.stackSize     = sizeof (gCaptAppTskStackMain);
+
+    task = Task_create(taskFxn, &taskParams, &eb);
+    if(NULL == task)
+    {
+        BIOS_exit(0);
+    }
+    BIOS_start();    /* does not return */
+
+    return(0);
+}
+
+static Void taskFxn(UArg a0, UArg a1)
+{
+    appBoardInit();
+    Cal_loopbackTest();
+    return;
+}
+
+static int32_t appBoardInit(void)
+{
+    Board_initCfg boardCfg;
+
+    boardCfg = BOARD_INIT_PINMUX_CONFIG |
+                BOARD_INIT_UNLOCK_MMR |
+                BOARD_INIT_UART_STDIO;
+    Board_init(boardCfg);
+
+#if defined (SOC_AM65XX)
+    App_configureLCD(APP_OUTPUT_OLDI);
+#else
+    App_configureLCD(APP_OUTPUT_HDMI);
+#endif
+    App_configureSoC();
+
+    return 0;
+}
+
+#if defined(BUILD_MPU) || defined (__C7100__)
+extern void Osal_initMmuDefault(void);
+void InitMmu(void)
+{
+    Osal_initMmuDefault();
+}
+#endif
diff --git a/packages/ti/drv/cal/examples/utils/calutils.h b/packages/ti/drv/cal/examples/utils/calutils.h
new file mode 100644 (file)
index 0000000..70d39d7
--- /dev/null
@@ -0,0 +1,290 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2018
+ *
+ *  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.
+ */
+
+/**
+ *  \ingroup CALUTILS_API
+ *  \defgroup CALUTILS_MEM_API Frame buffer memory allocator API
+ *
+ *  APIs to allocate frame buffer memory from a predefined memory pool
+ *  @{
+ */
+
+/**
+ *  \file calutils_mem.h
+ *
+ *  \brief Frame buffer memory allocator API.
+ */
+
+#ifndef CALUTILS_H_
+#define CALUTILS_H_
+
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+
+#include <ti/drv/fvid2/fvid2.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ========================================================================== */
+/*                           Macros & Typedefs                                */
+/* ========================================================================== */
+
+/** \brief Utility define for Kilobyte, i.e 1024 bytes */
+#ifndef KB
+#define KB ((uint32_t) 1024U)
+#endif
+
+/** \brief Utility define for Megabyte, i.e 1024*1024 bytes */
+#ifndef MB
+#define MB (KB * KB)
+#endif
+
+#define CAL_BUFFER_ALIGNMENT_RECOMMENDED    (32U)
+
+/** \brief Log enable for CAL Utils modules. */
+#define CalUtilsTrace                        (GT_INFO | GT_TraceState_Enable)
+
+#define FVID2_VID_SENSOR_MULDES_OV1063X_DRV (0x1001U)
+/** \brief Multi Deserializer OV1063X video sensor driver ID. */
+
+#define FVID2_VID_SENSOR_BYPASS_CSI2_DRV    (0x1002U)
+/** \brief By Pass sensor configurations */
+
+/* ========================================================================== */
+/*                         Structure Declarations                             */
+/* ========================================================================== */
+
+/**
+ *  struct CalUtils_MemHeapStatus
+ *  \brief He.
+ */
+typedef struct
+{
+    uint32_t freeSysHeapSize;
+    /**< Current system heap free space. */
+    uint32_t freeBufHeapSize;
+    /**< Current buffer heap free space. */
+} CalUtils_MemHeapStatus;
+
+/* ========================================================================== */
+/*                          Function Declarations                             */
+/* ========================================================================== */
+
+/**
+ *  \brief One time system init of memory allocator
+ *
+ *  Should be called by application before using allocate APIs
+ *
+ *  \return 0 on sucess, else failure
+ */
+int32_t CalUtils_memInit(void);
+
+/**
+ *  \brief One time system init of memory allocator
+ *
+ *  Should be called by application before using allocate APIs.
+ *  This is same as CalUtils_memInit(), except that a larger heap size is used.
+ *  Right now only chains app will used this large heap.
+ *  When using large heap a different config.bld needs to be used.
+ *  For chains app this is setup via Makefile's in HDVPSS driver build system.
+ *
+ *  Only ONE of CalUtils_memInit() or
+ *  CalUtils_memInit_largeHeap() should be called during system init.
+ *
+ *  \return 0 on sucess, else failure
+ */
+int32_t CalUtils_memInit_largeHeap(void);
+
+/**
+ *  \brief One time system de-init of memory allocator
+ *
+ *  Should be called by application at system de-init
+ *
+ *  \return 0 on sucess, else failure
+ */
+int32_t CalUtils_memDeInit(void);
+
+/**
+ *  \brief Allocate a frame
+ *
+ *  Use Fvid2_Format to allocate a frame.
+ *  Fill Fvid2_Frame fields like chNum based on Fvid2_Format
+ *
+ *  \param  pFormat   [IN] Data format information
+ *  \param  pFrame    [OUT] Initialzed Fvid2_Frame structure
+ *  \param  numFrames [IN] Number of frames to allocate
+ *
+ *  \return 0 on sucess, else failure
+ */
+int32_t CalUtils_memFrameAlloc(Fvid2_Format *pFormat,
+                             Fvid2_Frame  *pFrame,
+                             uint32_t        numFrames);
+
+/**
+ *  \brief Free's previously allocate Fvid2_Frame's
+ *
+ *  \param  pFormat   [IN] Data format information
+ *  \param  pFrame    [IN] Fvid2_Frame structure
+ *  \param  numFrames [IN] Number of frames to free
+ *
+ *  \return 0 on sucess, else failure
+ */
+int32_t CalUtils_memFrameFree(const Fvid2_Format *pFormat,
+                            Fvid2_Frame        *pFrame,
+                            uint32_t              numFrames);
+
+/**
+ *  \brief Returns the memory required to allocate a single
+ *  buffer as per provided format.
+ *
+ *  This will be used by the CalUtils_memFrameAlloc() function
+ *  and application could use this function to find out the memory
+ *  allocated for a frame.
+ *
+ *  \param  pFormat   [IN]  Data format information
+ *  \param  size      [OUT] Size in bytes needed per frame.
+ *                          This parameter can't be NULL.
+ *  \param  cOffset   [OUT] Returns the chroma buffer offset
+ *                          in case of YUV planar/semi-planar formats.
+ *                          If this parameter is NULL, the value is not
+ *                          returned.
+ *
+ *  \return 0 on sucess, else failure
+ */
+int32_t CalUtils_memFrameGetSize(const Fvid2_Format *pFormat,
+                               uint32_t             *size,
+                               uint32_t             *cOffset);
+
+/**
+ *  \brief Allocate memory from memory pool
+ *
+ *  \param size   [IN] size in bytes
+ *  \param align  [IN] alignment in bytes
+ *
+ *  \return NULL or error, else memory pointer
+ */
+void * CalUtils_memAlloc(uint32_t size, uint32_t align);
+
+/**
+ *  \brief Free previously allocate memory pointer
+ *
+ *  \param addr [IN] memory pointer to free
+ *  \param size [IN] size of memory pointed to by the memory pointer
+ *
+ *  \return 0 on sucess, else failure
+ */
+int32_t CalUtils_memFree(void *addr, uint32_t size);
+
+/**
+ *  \brief Control if allocated buffer needs to be cleared to 0
+ *
+ *  By default allocated buffer will not be cleared to 0
+ *
+ *  \param enable   [IN] TRUE: clear allocated buffer,
+ *                       FALSE: do not clear allocated buffer
+ *
+ *  \return 0 on sucess, else failure
+ */
+int32_t CalUtils_memClearOnAlloc(Bool enable);
+
+/**
+ *  CalUtils_memGetHeapStat
+ *  \brief Returns the current status (free size) of the various heaps used.
+ *
+ *  This function could be called before calling the module init function or
+ *  after module deinit function.
+ *
+ *  \param heapStat [OUT]   Status filled by the function.
+ *
+ */
+void CalUtils_memGetHeapStat(CalUtils_MemHeapStatus *heapStat);
+
+/**
+ *  CalUtils_memCheckHeapStat
+ *  \brief Checks the current status of each heap with the value passed.
+ *
+ *  This returns an error if the values of each of the heap doesn't match.
+ *  This function could be called before calling the module init function or
+ *  after module deinit function.
+ *
+ *  \param heapStat [IN]    Older status to be compared with the current status.
+ *
+ *  \return                 Returns 0 if the heap sizes match else return
+ *                          FVID2_EFAIL.
+ */
+int32_t CalUtils_memCheckHeapStat(const CalUtils_MemHeapStatus *heapStat);
+
+/**
+ *  \brief Returns the system heap free memory (in bytes)
+ */
+uint32_t CalUtils_memGetSystemHeapFreeSpace(void);
+
+/**
+ *  \brief Returns the buffer heap free memory (in bytes)
+ */
+uint32_t CalUtils_memGetBufferHeapFreeSpace(void);
+
+/**
+ *  \brief Init heap with user specified memory area
+ *
+ *  This API is used internally by CalUtils_memInit() and
+ *  CalUtils_memInit_largeHeap()
+ *  so typically user's will NOT use this API directly
+ */
+int32_t CalUtils_memInit_internal(uint32_t *pMemAddr, uint32_t memSize);
+
+static inline uint32_t CalUtils_floor(uint32_t val, uint32_t align);
+static inline uint32_t CalUtils_align(uint32_t val, uint32_t align);
+
+static inline uint32_t CalUtils_floor(uint32_t val, uint32_t align)
+{
+    return ((uint32_t) ((val / align) * align));
+}
+
+static inline uint32_t CalUtils_align(uint32_t val, uint32_t align)
+{
+    return (CalUtils_floor((uint32_t) (val + (align - 1U)), align));
+}
+
+void CalUtils_sensorConfigInit(uint32_t sensorDriverId);
+void CalUtils_sensorConfigDeInit(uint32_t sensorDriverId);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* #define CALUTILS_H_ */
+
+/* @} */
diff --git a/packages/ti/drv/cal/examples/utils/makefile b/packages/ti/drv/cal/examples/utils/makefile
new file mode 100644 (file)
index 0000000..6788be9
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# This file is the makefile for building CAL app utils library.
+#
+ifeq ($(RULES_MAKE), )
+include $(PDK_INSTALL_PATH)/ti/build/Rules.make
+else
+include $(RULES_MAKE)
+endif
+
+MODULE_NAME = cal_app_utils
+
+SRCDIR = . src src/V0
+INCDIR = . src src/V0
+
+# List all the external components/interfaces, whose interface header files
+# need to be included for this component
+INCLUDE_EXTERNAL_INTERFACES = pdk
+INCLUDE_EXTERNAL_INTERFACES += xdc bios
+INCLUDE_INTERNAL_INTERFACES = csl
+
+# Common source files and CFLAGS across all platforms and cores
+SRCS_COMMON = calutils_mem.c
+ifeq ($(BOARD),$(filter $(BOARD), am65xx_evm))
+SRCS_COMMON += calapp_sensor.c calutils_ub95x.c
+SRCS_COMMON += calutils_ub964_sat88_ov1063x.c calutils_ub964_sat88_ov1063x_reg.c
+endif
+
+PACKAGE_SRCS_COMMON = .
+CFLAGS_LOCAL_COMMON = $(PDK_CFLAGS) $(CAL_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
diff --git a/packages/ti/drv/cal/examples/utils/makefile_baremetal b/packages/ti/drv/cal/examples/utils/makefile_baremetal
new file mode 100644 (file)
index 0000000..970dfd7
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# This file is the makefile for building CAL app utils library.
+#
+ifeq ($(RULES_MAKE), )
+include $(PDK_INSTALL_PATH)/ti/build/Rules.make
+else
+include $(RULES_MAKE)
+endif
+
+MODULE_NAME = cal_app_utils_baremetal
+BUILD_OS_TYPE=baremetal
+
+SRCDIR = . src src/V0
+INCDIR = . src src/V0
+
+# List all the external components/interfaces, whose interface header files
+# need to be included for this component
+INCLUDE_EXTERNAL_INTERFACES = pdk
+INCLUDE_INTERNAL_INTERFACES = csl
+
+# Common source files and CFLAGS across all platforms and cores
+SRCS_COMMON = calutils_mem.c
+ifeq ($(BOARD),$(filter $(BOARD), am65xx_evm))
+SRCS_COMMON += calapp_sensor.c calutils_ub95x.c
+SRCS_COMMON += calutils_ub964_sat88_ov1063x.c calutils_ub964_sat88_ov1063x_reg.c
+endif
+
+PACKAGE_SRCS_COMMON = .
+CFLAGS_LOCAL_COMMON = $(PDK_CFLAGS) $(CAL_CFLAGS)
+CFLAGS_LOCAL_COMMON += -DBARE_METAL
+
+# 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
diff --git a/packages/ti/drv/cal/examples/utils/src/V0/calapp_sensor.c b/packages/ti/drv/cal/examples/utils/src/V0/calapp_sensor.c
new file mode 100644 (file)
index 0000000..49e51fc
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2018
+ *
+ *  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 calapp_sensor.c
+ *
+ *  \brief Sensor API.
+ *
+ */
+
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+
+#include <calutils.h>
+#include <ti/drv/fvid2/fvid2.h>
+#include <ti/drv/cal/cal.h>
+#include <calutils_ub95x.h>
+#include <calutils_ub964_sat88_ov1063x.h>
+
+/* ========================================================================== */
+/*                           Macros & Typedefs                                */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                         Structure Declarations                             */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                          Function Declarations                             */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                            Global Variables                                */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                          Function Definitions                              */
+/* ========================================================================== */
+
+void CalUtils_sensorConfigInit(uint32_t sensorDriverId)
+{
+    if (sensorDriverId == FVID2_VID_SENSOR_BYPASS_CSI2_DRV)
+    {
+        CalUtils_appInitUb954_Ub953();
+    }
+    else if (sensorDriverId == FVID2_VID_SENSOR_MULDES_OV1063X_DRV)
+    {
+        CalUtils_appInitUb964_sat88_ov1063x();
+    }
+    else
+    {
+        GT_0trace(CalUtilsTrace, GT_ERR, "Sensor Driver Not Supported\r\n");
+    }
+}
+
+void CalUtils_sensorConfigDeInit(uint32_t sensorDriverId)
+{
+    if (sensorDriverId == FVID2_VID_SENSOR_BYPASS_CSI2_DRV)
+    {
+        CalUtils_appDeInitUb954_Ub953();
+    }
+    else if (sensorDriverId == FVID2_VID_SENSOR_MULDES_OV1063X_DRV)
+    {
+        CalUtils_appDeinitUb964_sat88_ov1063x();
+    }
+    else
+    {
+        GT_0trace(CalUtilsTrace, GT_ERR, "Sensor Driver Not Supported\r\n");
+    }
+}
+
diff --git a/packages/ti/drv/cal/examples/utils/src/V0/calutils_ub95x.c b/packages/ti/drv/cal/examples/utils/src/V0/calutils_ub95x.c
new file mode 100755 (executable)
index 0000000..190dead
--- /dev/null
@@ -0,0 +1,233 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2018
+ *
+ *  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 calutils_ub95x.c
+ *
+ *  \brief Implements APIs to initialize, de-initialize UB954 * UB953 EVM,
+ *           address aliases & reset sensors.
+ *
+ */
+
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+
+#include <ti/csl/soc.h>
+#include <calutils_ub95x.h>
+#include <ti/drv/i2c/I2C.h>
+#include <ti/drv/i2c/soc/I2C_soc.h>
+
+
+/* ========================================================================== */
+/*                           Macros & Typedefs                                */
+/* ========================================================================== */
+/**< UB954 I2C Address */
+#define UB954_I2C_ADDRESS           (0x3D)
+
+/**< UB953 I2C Address */
+#define UB953_I2C_ADDRESS           (0x18)
+/**< UB953 Alias I2C Address */
+#define UB953_I2C_ALIAS_ADDRESS     (0x74)
+
+/**< OV7261 I2C Address */
+#define OV7261_I2C_ADDRESS          (0x60)
+/**< OV7261 Alias I2C Address */
+#define OV7261_I2C_ALIAS_ADDRESS    (0x38)
+
+/**< Temperature sensor I2C Address */
+#define TEMP_SENS_I2C_ADDRESS       (0x48)
+/**< Temperature sensor Alias I2C Address */
+#define TEMP_SENS_I2C_ALIAS_ADDRESS (0x76)
+
+/**< LED Driver I2C Address */
+#define LED_DRV_I2C_ADDRESS         (0x49)
+/**< LED Driver Alias I2C Address */
+#define LED_DRV_I2C_ALIAS_ADDRESS   (0x78)
+
+#define I2C_TRANSACTION_TIMEOUT     (2000U)
+
+/**
+ *  \brief Register address and value pair, with delay.
+ */
+typedef struct
+{
+    uint8_t nRegAddr;
+    /**< Register Address */
+    uint8_t nRegValue;
+    /**< Slave Address */
+    uint32_t nDelay;
+    /**< Delay to be applied, after the register is programmed */
+} CalUtils_Ub95xI2cParams;
+
+/* ========================================================================== */
+/*                          Function Declarations                             */
+/* ========================================================================== */
+
+/* ========================================================================== */
+/*                            Global Variables                                */
+/* ========================================================================== */
+I2C_Handle gI2cHandle = NULL;
+static CalUtils_Ub95xI2cParams gUb954Cfg[]={
+    {0x4c, 0x01, 0x1},
+    {0x58, 0X5e, 0x2},
+    {0x5b, (UB953_I2C_ADDRESS           << 1U), 0x1},
+    {0x5c, (UB953_I2C_ALIAS_ADDRESS     << 1U), 0x1},
+    {0x5D, (OV7261_I2C_ADDRESS          << 1U), 0x1},
+    {0x65, (OV7261_I2C_ALIAS_ADDRESS    << 1U), 0x1},
+    {0x5e, (TEMP_SENS_I2C_ADDRESS       << 1U), 0x1},
+    {0x66, (TEMP_SENS_I2C_ALIAS_ADDRESS << 1U), 0x1},
+    {0x5f, (LED_DRV_I2C_ADDRESS         << 1U), 0x1},
+    {0x67, (LED_DRV_I2C_ALIAS_ADDRESS   << 1U), 0x1},
+    {0x1f, 0x02, 0x1},
+    {0x12, 0x13, 0x1},
+    {0x32, 0x01, 0x1},
+    {0x33, 0x03, 0x1},
+    {0xB0, 0x00, 0x1}, /* Indirect access to pattern genrator */
+    {0xB1, 0x01, 0x1}, /* Select Reg PGEN_CTL */
+    {0xB2, 0x01, 0x1}, /* Write 1 to it */
+    {0x20, 0x00, 0x1}
+    };
+/* NOTE : Expect to see color bar, where the color values should be default
+    i.e. first bar = 0xAA, 2nd Bar = 0x33, 3rd bar = 0xF0, 4th bar = 0x7F
+        5th bar = 0x55, 6th bar = 0xCC, 7th bar = 0x0F and 8th bar = 0x80 */
+/* ========================================================================== */
+/*                          Function Implementation                           */
+/* ========================================================================== */
+void CalUtils_appInitUb954_Ub953(void)
+{
+    I2C_Params i2cParams;
+    I2C_Transaction i2cTransaction;
+    I2C_HwAttrs   i2c_cfg;
+    int16_t transferStatus;
+
+    uint32_t idx, numRegs;
+
+    /* Get the default I2C init configurations */
+    I2C_socGetInitCfg(CALUTILS_UB954_I2C_INST, &i2c_cfg);
+    /* Set the default I2C init configurations */
+    I2C_socSetInitCfg(CALUTILS_UB954_I2C_INST, &i2c_cfg);
+
+    I2C_init();
+
+    I2C_Params_init(&i2cParams);
+    i2cParams.transferMode = I2C_MODE_BLOCKING;
+    i2cParams.bitRate      = I2C_400kHz;
+
+    gI2cHandle = I2C_open(CALUTILS_UB954_I2C_INST, &i2cParams);
+
+    numRegs = sizeof(gUb954Cfg) / (sizeof(gUb954Cfg[0]));
+    I2C_transactionInit(&i2cTransaction);
+    i2cTransaction.slaveAddress = UB954_I2C_ADDRESS;
+
+    for (idx = 0U; idx < numRegs; idx++)
+    {
+        i2cTransaction.writeBuf = (uint8_t *)&gUb954Cfg[idx];
+        i2cTransaction.writeCount = 2U;
+        i2cTransaction.readBuf = NULL;
+        i2cTransaction.readCount = 0U;
+        i2cTransaction.timeout   = I2C_TRANSACTION_TIMEOUT;
+        transferStatus = I2C_transfer(gI2cHandle, &i2cTransaction);
+    
+        if (transferStatus != I2C_STS_SUCCESS)
+        {
+            GT_1trace(calUtilsTrace, GT_ERR,
+                      "Could not configure UB954 in regWrite of idx: %d!!!\r\n", idx);
+            break;
+        }
+    #if defined (BARE_METAL)
+        Osal_delay((gUb954Cfg[idx].nDelay + 1));
+    #else
+        Osal_delay((gUb954Cfg[idx].nDelay + 1) * 100);
+    #endif
+        GT_1trace(calUtilsTrace, GT_DEBUG, "Written I2C reg index: %d \r\n", idx);
+    }
+    GT_1trace(calUtilsTrace, GT_DEBUG,
+              "Configured UB954. Number of I2C regs Configured [%d]!!!\r\n", idx);
+
+    return;
+}
+
+void CalUtils_appDeInitUb954_Ub953(void)
+{
+    I2C_Transaction i2cTransaction;
+    uint8_t         data[2];
+    int16_t transferStatus;
+
+    /* Disable Forwarding
+     *   regAddr = 0x20;
+     *   regValue = 0x48;
+     */
+    data[0] = 0x20;
+    data[1] = 0x48;
+    I2C_transactionInit(&i2cTransaction);
+    i2cTransaction.slaveAddress = UB954_I2C_ADDRESS;
+    i2cTransaction.writeBuf = (uint8_t *)&data[0];
+    i2cTransaction.writeCount = 2U;
+    i2cTransaction.readBuf = NULL;
+    i2cTransaction.readCount = 0U;
+    i2cTransaction.timeout   = I2C_TRANSACTION_TIMEOUT;
+    transferStatus = I2C_transfer(gI2cHandle, &i2cTransaction);
+
+    if (transferStatus != I2C_STS_SUCCESS)
+    {
+        GT_0trace(calUtilsTrace, GT_ERR, "Could not disable forwarding UB954 !!!\r\n");
+    }
+    else
+    {
+               /* TODO: Removing delay results in I2C error. Need to be checked.     */
+               Osal_delay(1000);
+        /* Reset
+        *   regAddr = 0x01;
+        *   regValue = 0x03;
+        */
+        data[0] = 0x01;
+        data[1] = 0x03;
+        i2cTransaction.writeBuf = (uint8_t *)&data[0];
+        i2cTransaction.writeCount = 2U;
+        i2cTransaction.readBuf = NULL;
+        i2cTransaction.readCount = 0U;
+        i2cTransaction.timeout   = I2C_TRANSACTION_TIMEOUT;
+        transferStatus = I2C_transfer(gI2cHandle, &i2cTransaction);
+               /* TODO: Removing delay results in I2C error. Need to be checked.     */
+               Osal_delay(1000);
+        if (transferStatus != I2C_STS_SUCCESS)
+        {
+            GT_0trace(calUtilsTrace, GT_ERR, "Could not reset UB954 !!!\r\n");
+        }
+    }
+
+    I2C_close(gI2cHandle);
+    return;
+}
+
+
diff --git a/packages/ti/drv/cal/examples/utils/src/V0/calutils_ub95x.h b/packages/ti/drv/cal/examples/utils/src/V0/calutils_ub95x.h
new file mode 100644 (file)
index 0000000..5f28f20
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2018
+ *
+ *  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.
+ */
+
+/**
+ *  \addtogroup CALUTILS_UB960_API
+ *  @{
+ */
+
+/**
+ *  \file calutils_ub960.h
+ *
+ *  \brief Defines APIs to initialize, de-initialize UB960 EVM, address aliases
+ *          & reset sensors.
+ *
+ *  TODO: Get serializer address function should be common for all modules.
+ *          Right now, its seperate for TIDA, SAT0088 & IMI modules
+ */
+
+#ifndef CALUTILS_UB95X_H_
+#define CALUTILS_UB95X_H_
+
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+#include <ti/drv/fvid2/fvid2.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ========================================================================== */
+/*                           Macros & Typedefs                                */
+/* ========================================================================== */
+/**< I2C Instance to be used */
+#define CALUTILS_UB954_I2C_INST                  (0x1U)
+
+/**< I2C Inst Base addr */
+#define CALUTILS_UB954_I2C_INST_BASEADDR         (0x02010000U)
+
+/** \brief Log enable for CAL modules. */
+#define calUtilsTrace       (GT_INFO | GT_TraceState_Enable)
+/* ========================================================================== */
+/*                         Structure Declarations                             */
+/* ========================================================================== */
+/* None */
+
+/* ========================================================================== */
+/*                          Function Declarations                             */
+/* ========================================================================== */
+
+/**
+ *  \brief Initializes the UB954 & UB953.
+ *          Initializes UB954, UB953 and configures to access 2 other remote
+ *          I2C slaves
+ */
+void CalUtils_appInitUb954_Ub953(void);
+
+/**
+ *  \brief De Initializes the UB954 & UB953
+ *              Turns off power to 1 slave, resets UB953 & UB954
+ */
+void CalUtils_appDeInitUb954_Ub953(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* #define CALUTILS_UB95X_H_ */
+
+/* @} */
diff --git a/packages/ti/drv/cal/examples/utils/src/V0/calutils_ub964_sat88_ov1063x.c b/packages/ti/drv/cal/examples/utils/src/V0/calutils_ub964_sat88_ov1063x.c
new file mode 100644 (file)
index 0000000..6598fb3
--- /dev/null
@@ -0,0 +1,217 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2018
+ *
+ *  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 calutils_ub964_sat88_ov1063x.c
+ *
+ *  \brief Implements APIs to initialize, de-initialize UB964 EVM,
+ *         With SAT0088 module and the OV1063x 
+ *
+ */
+
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+
+#include <ti/csl/soc.h>
+#include <calutils_ub964_sat88_ov1063x.h>
+#include <ti/drv/i2c/I2C.h>
+#include <ti/drv/i2c/soc/I2C_soc.h>
+
+
+/* ========================================================================== */
+/*                           Macros & Typedefs                                */
+/* ========================================================================== */
+#define I2C_TRANSACTION_TIMEOUT     (2000U)
+
+/* ========================================================================== */
+/*                          Function Declarations                             */
+/* ========================================================================== */
+
+/* ========================================================================== */
+/*                            Global Variables                                */
+/* ========================================================================== */
+I2C_Handle gUb960I2cHandle = NULL;
+uint8_t    gLvdsOv1063xAddr[4] = {0x38, 0x39, 0x3A, 0x3B};
+
+extern uint32_t gUb960Cfg_SAT0088_OV10635_size;
+extern uint32_t gUb960Cfg_Ov1063xLvdsSensorsDefault_size;
+extern const CalUtils_SensorConfigParams gUb960Cfg_Ov1063xLvdsSensorsDefault[];
+extern const CalUtils_Ub960I2cParams gUb960Cfg_SAT0088_OV10635[];
+
+/* ========================================================================== */
+/*                          Function Implementation                           */
+/* ========================================================================== */
+void CalUtils_appInitUb964_sat88_ov1063x(void)
+{
+    I2C_Params i2cParams;
+    I2C_Transaction i2cTransaction;
+    I2C_HwAttrs   i2c_cfg;
+    int16_t transferStatus;
+    UInt8  nRegValue[5];
+    UInt16 nAddr;
+
+    uint32_t idx, numRegs, sensorIdx;
+
+    /* Get the default I2C init configurations */
+    I2C_socGetInitCfg(CALUTILS_UB964_I2C_INST, &i2c_cfg);
+    /* Set the default I2C init configurations */
+    I2C_socSetInitCfg(CALUTILS_UB964_I2C_INST, &i2c_cfg);
+
+    I2C_init();
+
+    I2C_Params_init(&i2cParams);
+    i2cParams.transferMode = I2C_MODE_BLOCKING;
+    i2cParams.bitRate      = I2C_400kHz;
+
+    gUb960I2cHandle = I2C_open(CALUTILS_UB964_I2C_INST, &i2cParams);
+
+    numRegs = gUb960Cfg_SAT0088_OV10635_size;
+    I2C_transactionInit(&i2cTransaction);
+    i2cTransaction.slaveAddress = UB960_I2C_ADDRESS;
+
+    GT_0trace(calUtilsTrace, GT_INFO, "Configuring UB 964\r\n");
+    for (idx = 0U; idx < numRegs; idx++)
+    {
+        i2cTransaction.writeBuf = (uint8_t *)&gUb960Cfg_SAT0088_OV10635[idx];
+        i2cTransaction.writeCount = 2U;
+        i2cTransaction.readBuf = NULL;
+        i2cTransaction.readCount = 0U;
+        i2cTransaction.timeout   = I2C_TRANSACTION_TIMEOUT;
+        transferStatus = I2C_transfer(gUb960I2cHandle, &i2cTransaction);
+    
+        if (transferStatus != I2C_STS_SUCCESS)
+        {
+            GT_1trace(calUtilsTrace, GT_ERR,
+                      "Could not configure UB954 in regWrite of idx: %d!!!\r\n", idx);
+            break;
+        }
+        if (gUb960Cfg_SAT0088_OV10635[idx].nDelay != 0U)
+        {
+            Osal_delay(gUb960Cfg_SAT0088_OV10635[idx].nDelay);
+        }
+        GT_1trace(calUtilsTrace, GT_DEBUG, "Written I2C reg index: %d \r\n", idx);
+    }
+    
+    /* Now Configure All the 4 ov1063x sensors connected over LVDS. */
+    for (sensorIdx = 0U; sensorIdx < 4U; sensorIdx++)
+    {
+        GT_1trace(calUtilsTrace, GT_INFO, "Configuring Sensor %d\r\n", sensorIdx);
+        I2C_transactionInit(&i2cTransaction);
+        i2cTransaction.slaveAddress = gLvdsOv1063xAddr[sensorIdx];
+        numRegs = gUb960Cfg_Ov1063xLvdsSensorsDefault_size;
+        for (idx = 0U; idx < numRegs; idx++)
+        {
+            nAddr = gUb960Cfg_Ov1063xLvdsSensorsDefault[idx].nRegAddr & (UInt16) 0xFFFFU;
+            /* MSB of the address */
+            nRegValue[0] = (UInt8) ((UInt16) (nAddr & 0xFFFFU) >> 8);
+            /* LSB of the address */
+            nRegValue[1] = (UInt8) (nAddr & 0x00FFU);
+            /* Data */
+            nRegValue[2] = gUb960Cfg_Ov1063xLvdsSensorsDefault[idx].nRegValue;
+
+            i2cTransaction.writeBuf = nRegValue;
+            i2cTransaction.writeCount = 3U;
+            i2cTransaction.readBuf = NULL;
+            i2cTransaction.readCount = 0U;
+            i2cTransaction.timeout   = I2C_TRANSACTION_TIMEOUT;
+            transferStatus = I2C_transfer(gUb960I2cHandle, &i2cTransaction);
+            if (transferStatus != I2C_STS_SUCCESS)
+            {
+                GT_1trace(calUtilsTrace, GT_ERR,
+                        "Could not configure OV1063x in regWrite of idx: %d!!!\r\n", idx);
+                break;
+            }
+            if (gUb960Cfg_Ov1063xLvdsSensorsDefault[idx].nDelay != 0U)
+            {
+                Osal_delay((gUb960Cfg_Ov1063xLvdsSensorsDefault[idx].nDelay) * 100);
+            }
+            GT_2trace(calUtilsTrace, GT_DEBUG, "Written I2C Sensor index: %d, reg index: %d \r\n", sensorIdx, idx);
+        }
+    }
+    
+    GT_0trace(calUtilsTrace, GT_INFO, "Configured UB964. !!!\r\n");
+
+    return;
+}
+
+void CalUtils_appDeinitUb964_sat88_ov1063x(void)
+{
+    I2C_Transaction i2cTransaction;
+    uint8_t         data[2];
+    int16_t transferStatus;
+
+    /* Disable Forwarding
+     *   regAddr = 0x20;
+     *   regValue = 0x48;
+     */
+    data[0] = 0x20;
+    data[1] = 0x48;
+    I2C_transactionInit(&i2cTransaction);
+    i2cTransaction.slaveAddress = UB960_I2C_ADDRESS;
+    i2cTransaction.writeBuf = (uint8_t *)&data[0];
+    i2cTransaction.writeCount = 2U;
+    i2cTransaction.readBuf = NULL;
+    i2cTransaction.readCount = 0U;
+    i2cTransaction.timeout   = I2C_TRANSACTION_TIMEOUT;
+    transferStatus = I2C_transfer(gUb960I2cHandle, &i2cTransaction);
+
+    if (transferStatus != I2C_STS_SUCCESS)
+    {
+        GT_0trace(calUtilsTrace, GT_ERR, "Could not disable forwarding UB954 !!!\r\n");
+    }
+    else
+    {
+        /* Reset
+        *   regAddr = 0x01;
+        *   regValue = 0x03;
+        */
+        data[0] = 0x01;
+        data[1] = 0x03;
+        i2cTransaction.writeBuf = (uint8_t *)&data[0];
+        i2cTransaction.writeCount = 2U;
+        i2cTransaction.readBuf = NULL;
+        i2cTransaction.readCount = 0U;
+        i2cTransaction.timeout   = I2C_TRANSACTION_TIMEOUT;
+        transferStatus = I2C_transfer(gUb960I2cHandle, &i2cTransaction);
+        /* TODO: Removing delay results in I2C error. Need to be checked.     */
+        Osal_delay(100);
+        if (transferStatus != I2C_STS_SUCCESS)
+        {
+            GT_0trace(calUtilsTrace, GT_ERR, "Could not reset UB954 !!!\r\n");
+        }
+    }
+    I2C_close(gUb960I2cHandle);
+    return;
+}
+
+
diff --git a/packages/ti/drv/cal/examples/utils/src/V0/calutils_ub964_sat88_ov1063x.h b/packages/ti/drv/cal/examples/utils/src/V0/calutils_ub964_sat88_ov1063x.h
new file mode 100644 (file)
index 0000000..281f36e
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2018
+ *
+ *  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.
+ */
+
+/**
+ *  \addtogroup CALUTILS_UB960_API
+ *  @{
+ */
+
+/**
+ *  \file calutils_ub960.h
+ *
+ *  \brief Defines APIs to initialize, de-initialize UB960 EVM, address aliases
+ *          & reset sensors.
+ *
+ *  TODO: Get serializer address function should be common for all modules.
+ *          Right now, its seperate for TIDA, SAT0088 & IMI modules
+ */
+
+#ifndef CALUTILS_UB964_SAT88_OV10640_H_
+#define CALUTILS_UB964_SAT88_OV10640_H_
+
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+#include <ti/drv/fvid2/fvid2.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ========================================================================== */
+/*                           Macros & Typedefs                                */
+/* ========================================================================== */
+/**< I2C Instance to be used */
+#define CALUTILS_UB964_I2C_INST                  (0x1U)
+
+/**< I2C Inst Base addr */
+#define CALUTILS_UB964_I2C_INST_BASEADDR         (0x02010000U)
+
+/**< UB960 I2C Address */
+#define UB960_I2C_ADDRESS           (0x3D)
+
+#define SAT0088_OV10635_SER_ADDR                    (0x58U) /* 0xB0/2 */
+/**< 7 Bit serailizer address */
+#define SAT0088_OV10635_SENSOR_ADDR                 (0x30U) /* 0x60/2 */
+/**< 7 Bit sensor address */
+
+#define SAT0088_OV10635_PORT_0_SER_ALIAS_ADDR       (0x74U)
+/**< Serializer address */
+#define SAT0088_OV10635_PORT_0_SENSOR_ALIAS_ADDR    (0x38U) /* 0x70/2 */
+/**< Sensor address */
+#define SAT0088_OV10635_PORT_1_SER_ALIAS_ADDR       (0x76U)
+/**< Serializer address */
+#define SAT0088_OV10635_PORT_1_SENSOR_ALIAS_ADDR    (0x39U) /* 0x72/2 */
+/**< Sensor address */
+#define SAT0088_OV10635_PORT_2_SER_ALIAS_ADDR       (0x78U)
+/**< Serializer address */
+#define SAT0088_OV10635_PORT_2_SENSOR_ALIAS_ADDR    (0x3AU) /* 0x74/2 */
+/**< Sensor address */
+#define SAT0088_OV10635_PORT_3_SER_ALIAS_ADDR       (0x7AU)
+/**< Serializer address */
+#define SAT0088_OV10635_PORT_3_SENSOR_ALIAS_ADDR    (0x3BU) /* 0x76/2 */
+/**< Sensor address */
+
+/** \brief Log enable for CAL modules. */
+#define calUtilsTrace       (GT_INFO | GT_TraceState_Enable)
+/* ========================================================================== */
+/*                         Structure Declarations                             */
+/* ========================================================================== */
+
+/**
+ *  \brief Register address and value pair, with delay.
+ */
+typedef struct
+{
+    uint8_t nRegAddr;
+    /**< Register Address */
+    uint8_t nRegValue;
+    /**< Slave Address */
+    uint32_t nDelay;
+    /**< Delay to be applied, after the register is programmed */
+} CalUtils_Ub960I2cParams;
+
+/**
+ *  \brief Register address and value pair, with delay.
+ */
+typedef struct
+{
+    uint16_t nRegAddr;
+    /**< Register Address */
+    uint8_t nRegValue;
+    /**< Slave Address */
+    uint32_t nDelay;
+    /**< Delay to be applied, after the register is programmed */
+} CalUtils_SensorConfigParams;
+
+
+
+/* ========================================================================== */
+/*                          Function Declarations                             */
+/* ========================================================================== */
+
+/**
+ *  \brief Initializes the UB954 & UB953.
+ *          Initializes UB954, UB953 and configures to access 2 other remote
+ *          I2C slaves
+ */
+void CalUtils_appInitUb964_sat88_ov1063x(void);
+
+/**
+ *  \brief De Initializes the UB954 & UB953
+ *              Turns off power to 1 slave, resets UB953 & UB954
+ */
+void CalUtils_appDeinitUb964_sat88_ov1063x(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* #define CALUTILS_UB95X_H_ */
+
+/* @} */
diff --git a/packages/ti/drv/cal/examples/utils/src/V0/calutils_ub964_sat88_ov1063x_reg.c b/packages/ti/drv/cal/examples/utils/src/V0/calutils_ub964_sat88_ov1063x_reg.c
new file mode 100644 (file)
index 0000000..9f7b21f
--- /dev/null
@@ -0,0 +1,755 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2018
+ *
+ *  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 calutils_ub964_sat88_ov1063x.c
+ *
+ *  \brief Implements APIs to initialize, de-initialize UB964 EVM,
+ *         With SAT0088 module and the OV1063x 
+ *
+ */
+
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+
+#include <ti/csl/soc.h>
+#include <calutils_ub964_sat88_ov1063x.h>
+
+/* ========================================================================== */
+/*                           Macros & Typedefs                                */
+/* ========================================================================== */
+
+/* ========================================================================== */
+/*                          Function Declarations                             */
+/* ========================================================================== */
+
+/* ========================================================================== */
+/*                            Global Variables                                */
+/* ========================================================================== */
+const CalUtils_Ub960I2cParams gUb960Cfg_SAT0088_OV10635[] = {
+    {0x01, 0x01, 0xFFF},    /* Digital Reset 0 */
+    {0x1F, 0x00, 0x4FF},    /* UB960 = 0x5 and UB964 = 0x00, 800 MHz DDR */
+    {0x1D, 0xFF, 0x4FF},    /* Frame Count limit high byte limit to 0xFF */
+    {0x1E, 0xFF, 0x4FF},    /* Frame Count limit low byte limit to 0xFF */
+
+    /* Port 0 */
+    {0x4C, 0x01, 0x0},
+    {0x58, 0x58, 0x0},
+    {0x5D, ((UInt8) (SAT0088_OV10635_SER_ADDR << 1U)), 0x0},
+    {0x65, ((UInt8) (SAT0088_OV10635_PORT_0_SER_ALIAS_ADDR << 1U)), 0x0},
+    {0x5E, ((UInt8) (SAT0088_OV10635_SENSOR_ADDR << 1U)), 0x0},
+    {0x66, ((UInt8) (SAT0088_OV10635_PORT_0_SENSOR_ALIAS_ADDR << 1U)), 0x0},
+    {0x7C, 0x81, 0x0},  /* SAT0088+OV10635,frame-valid polarity inversion &
+                            process 8 MS bits only */
+    {0x6e, 0x98, 0x0},  /*0x99: GPIO0=1 GPIO1 = 1. 0x98 = GPIO0=0 GPIO1 = 1 */
+    {0x70, 0x1E, 0x0},  /* VPS_ISS_CAL_CSI2_YUV422_8B */
+    {0x71, 0x2C, 0x0},
+    {0x6D, 0x7F, 0x0}, /* 0x7E RAW 12, 0x7F RAW 10 */
+
+    /* Port 1 */
+    {0x4C, 0x12, 0x0},
+    {0x58, 0x58, 0x0},
+    {0x5D, ((UInt8) (SAT0088_OV10635_SER_ADDR << 1U)), 0x0},
+    {0x65, ((UInt8) (SAT0088_OV10635_PORT_1_SER_ALIAS_ADDR << 1U)), 0x0},
+    {0x5E, ((UInt8) (SAT0088_OV10635_SENSOR_ADDR << 1U)), 0x0},
+    {0x66, ((UInt8) (SAT0088_OV10635_PORT_1_SENSOR_ALIAS_ADDR << 1U)), 0x0},
+    {0x7C, 0x81, 0x0},
+    {0x6e, 0x98, 0x0},
+    {0x70, 0x5E, 0x0},  /* VPS_ISS_CAL_CSI2_YUV422_8B */
+    {0x71, 0x6C, 0x0},
+    {0x6D, 0x7F, 0x0}, /* 0x7E RAW 12, 0x7F RAW 10 */
+
+    /* Port 2 */
+    {0x4C, 0x24, 0x0},
+    {0x58, 0x58, 0x0},
+    {0x5D, ((UInt8) (SAT0088_OV10635_SER_ADDR << 1U)), 0x0},
+    {0x65, ((UInt8) (SAT0088_OV10635_PORT_2_SER_ALIAS_ADDR << 1U)), 0x0},
+    {0x5E, ((UInt8) (SAT0088_OV10635_SENSOR_ADDR << 1U)), 0x0},
+    {0x66, ((UInt8) (SAT0088_OV10635_PORT_2_SENSOR_ALIAS_ADDR << 1U)), 0x0},
+    {0x7C, 0x81, 0x0},
+    {0x6e, 0x98, 0x0},
+    {0x70, 0x9E, 0x0},  /* VPS_ISS_CAL_CSI2_YUV422_8B */
+    {0x71, 0xAC, 0x0},
+    {0x6D, 0x7F, 0x0}, /* 0x7E RAW 12, 0x7F RAW 10 */
+
+    /* Port 3 */
+    {0x4C, 0x38, 0x0},
+    {0x58, 0x58, 0x0},
+    {0x5D, ((UInt8) (SAT0088_OV10635_SER_ADDR << 1U)), 0x0},
+    {0x65, ((UInt8) (SAT0088_OV10635_PORT_3_SER_ALIAS_ADDR << 1U)), 0x0},
+    {0x5E, ((UInt8) (SAT0088_OV10635_SENSOR_ADDR << 1U)), 0x0},
+    {0x66, ((UInt8) (SAT0088_OV10635_PORT_3_SENSOR_ALIAS_ADDR << 1U)), 0x0},
+    {0x7C, 0x81, 0x0},
+    {0x6e, 0x98, 0x0},
+    {0x70, 0xDE, 0x0},  /* VPS_ISS_CAL_CSI2_YUV422_8B */
+    {0x71, 0xEC, 0x0},
+    {0x6D, 0x7F, 0x0}, /* 0x7E RAW 12, 0x7F RAW 10 */
+
+    {0xB0, 0x1C, 0xFFF},
+    {0xB1, 0x13, 0xFFF},
+    {0xB2, 0x1F, 0xFFF},
+
+    {0x32, 0x01, 0x0},
+#ifdef STREAM_ON_2_LANES
+    {0x33, 0x21, 0x0},
+#else
+    {0x33, 0x01, 0x0},
+#endif /* STREAM_ON_2_LANES */
+
+    {0x20, 0x00, 0xFFF}
+};
+
+const CalUtils_SensorConfigParams gUb960Cfg_Ov1063xLvdsSensorsDefault[] =
+{
+/* Register configuration for full resolution : 1280x720 */
+    {0x103, 0x1, 0x0},    /** Software Reset */
+    {0x301b, 0xff, 0x0},  /** System Control Clock Reset #1 */
+    {0x301c, 0xff, 0x0},  /** System Control Clock Reset #2 */
+    {0x301a, 0xff, 0x0},  /** System Control Clock Reset #0 */
+    {0x300c, 0x61, 0x0},  /** Serial Camera Control Bus ID */
+    {0x300c, 0x61, 0x0},
+    {0x300c, 0x61, 0x0},
+    {0x300c, 0x61, 0x0},
+    {0x300c, 0x61, 0x0},
+    {0x300c, 0x61, 0x0},
+    {0x300c, 0x61, 0x0},
+    {0x300c, 0x61, 0x0},
+    {0x300c, 0x61, 0x0},
+    {0x300c, 0x61, 0x0},
+    {0x300c, 0x61, 0x0},
+    {0x300c, 0x61, 0x0},
+    {0x300c, 0x61, 0x0},
+    {0x300c, 0x61, 0x0},
+    {0x300c, 0x61, 0x0},
+    {0x300c, 0x61, 0x0},
+    {0x300c, 0x61, 0x0},
+    {0x300c, 0x61, 0x0},
+    {0x300c, 0x61, 0x0},
+    {0x300c, 0x61, 0x0},
+    {0x300c, 0x61, 0x0},
+    {0x300c, 0x61, 0x0},
+    {0x300c, 0x61, 0x0},
+    {0x3021, 0x3, 0x0},  /** System Control Misc */
+    {0x3011, 0x2, 0x0},
+    {0x6900, 0xc, 0x0},
+    {0x6901, 0x1, 0x0},
+    {0x3033, 0x8, 0x0},   /** System clock/4 */
+    {0x3503, 0x10, 0x0},  /** AEC Delay enabled */
+    {0x302d, 0x2f, 0x0},  /** Power Down Control */
+    {0x3025, 0x3, 0x0},  /** Debug Control enabled */
+    /*
+     * System clock is computed as:
+     * XVCLK       = 24MHz
+     * preDivide   = {/1,/1.5,/2,/3,/4,/5,/6,/7}
+     * decided based on (0x3004[6:4].
+     * numerator   = (0x3003[5:0] * XVCLK)/preDivide)
+     * denominator = (2 * (1+0x3004[2:0]))
+     * System clock = numerator/denominator.
+     */
+    {0x3003, 0x20, 0x0},    /* fps = 36fps */
+    {0x3004, 0x3, 0x0},
+    {0x3005, 0x20, 0x0},
+    {0x3006, 0x91, 0x0},
+    {0x3600, 0x74, 0x0},
+    {0x3601, 0x2b, 0x0},
+    {0x3612, 0x0, 0x0},
+    {0x3611, 0x67, 0x0},
+    {0x3633, 0xba, 0x0},
+    {0x3602, 0x2f, 0x0},
+    {0x3603, 0x0, 0x0},
+    {0x3630, 0xa8, 0x0},
+    {0x3631, 0x16, 0x0},
+    {0x3714, 0x10, 0x0},
+    {0x371d, 0x1, 0x0},
+    {0x4300, 0x3A, 0x0}, /* UYVY mode */
+    {0x3007, 0x1, 0x0},
+    /*
+     * RAW mode and Pixel CLK selct.
+     * 0x3024[0] = 1 :: System CLK (0x3003,0x3004)
+     * 0x3024[0] = 0 :: secondary CLK (0x3005,0x3006)
+     */
+    {0x3024, 0x1, 0x0},
+    {0x3020, 0xb, 0x0},
+    {0x3702, 0xd, 0x0},
+    {0x3703, 0x20, 0x0},
+    {0x3704, 0x15, 0x0},
+    {0x3709, 0x28, 0x0},
+    {0x370d, 0x0, 0x0},
+    {0x3712, 0x0, 0x0},
+    {0x3713, 0x20, 0x0},
+    {0x3715, 0x4, 0x0},
+    {0x381d, 0x40, 0x0},
+    {0x381c, 0x0, 0x0},
+    {0x3824, 0x10, 0x0},
+    {0x3815, 0x8c, 0x0},
+    {0x3804, 0x5, 0x0},
+    {0x3805, 0x1f, 0x0},
+    {0x3800, 0x0, 0x0},
+    {0x3801, 0x0, 0x0},
+    {0x3806, 0x3, 0x0},
+    {0x3807, 0x1, 0x0},
+    {0x3802, 0x0, 0x0},
+    {0x3803, 0x2e, 0x0},
+    {0x3808, 0x5, 0x0},
+    {0x3809, 0x0, 0x0},
+    {0x380a, 0x2, 0x0},
+    {0x380b, 0xd0, 0x0},
+    {0x380c, 0x6, 0x0},
+    {0x380d, 0xf6, 0x0}, /* 1280x720 */
+    {0x380e, 0x3, 0x0},
+    {0x380f, 0x80, 0x0}, /* 1280x720 */
+    {0x3811, 0x8, 0x0},
+    {0x381f, 0xc, 0x0},
+    {0x3621, 0x63, 0x0},
+    {0x5005, 0x8, 0x0},
+    {0x56d5, 0x0, 0x0},
+    {0x56d6, 0x80, 0x0},
+    {0x56d7, 0x0, 0x0},
+    {0x56d8, 0x0, 0x0},
+    {0x56d9, 0x0, 0x0},
+    {0x56da, 0x80, 0x0},
+    {0x56db, 0x0, 0x0},
+    {0x56dc, 0x0, 0x0},
+    {0x56e8, 0x0, 0x0},
+    {0x56e9, 0x7f, 0x0},
+    {0x56ea, 0x0, 0x0},
+    {0x56eb, 0x7f,0x0},
+    {0x5100, 0x0, 0x0},
+    {0x5101, 0x80, 0x0},
+    {0x5102, 0x0, 0x0},
+    {0x5103, 0x80, 0x0},
+    {0x5104, 0x0, 0x0},
+    {0x5105, 0x80, 0x0},
+    {0x5106, 0x0, 0x0},
+    {0x5107, 0x80, 0x0},
+    {0x5108, 0x0, 0x0},
+    {0x5109, 0x0, 0x0},
+    {0x510a, 0x0, 0x0},
+    {0x510b, 0x0, 0x0},
+    {0x510c, 0x0, 0x0},
+    {0x510d, 0x0, 0x0},
+    {0x510e, 0x0, 0x0},
+    {0x510f, 0x0, 0x0},
+    {0x5110, 0x0, 0x0},
+    {0x5111, 0x80, 0x0},
+    {0x5112, 0x0, 0x0},
+    {0x5113, 0x80, 0x0},
+    {0x5114, 0x0, 0x0},
+    {0x5115, 0x80, 0x0},
+    {0x5116, 0x0, 0x0},
+    {0x5117, 0x80, 0x0},
+    {0x5118, 0x0, 0x0},
+    {0x5119, 0x0, 0x0},
+    {0x511a, 0x0, 0x0},
+    {0x511b, 0x0, 0x0},
+    {0x511c, 0x0, 0x0},
+    {0x511d, 0x0, 0x0},
+    {0x511e, 0x0, 0x0},
+    {0x511f, 0x0, 0x0},
+    {0x56d0, 0x0, 0x0},
+    {0x5006, 0x24, 0x0},
+    {0x5608, 0x0, 0x0},
+    {0x52d7, 0x6, 0x0},
+    {0x528d, 0x8, 0x0},
+    {0x5293, 0x12, 0x0},
+    {0x52d3, 0x12, 0x0},
+    {0x5288, 0x6, 0x0},
+    {0x5289, 0x20, 0x0},
+    {0x52c8, 0x6, 0x0},
+    {0x52c9, 0x20, 0x0},
+    {0x52cd, 0x4, 0x0},
+    {0x5381, 0x0, 0x0},
+    {0x5382, 0xff, 0x0},
+    {0x5589, 0x76, 0x0},
+    {0x558a, 0x47, 0x0},
+    {0x558b, 0xef, 0x0},
+    {0x558c, 0xc9, 0x0},
+    {0x558d, 0x49, 0x0},
+    {0x558e, 0x30, 0x0},
+    {0x558f, 0x67, 0x0},
+    {0x5590, 0x3f, 0x0},
+    {0x5591, 0xf0, 0x0},
+    {0x5592, 0x10, 0x0},
+    {0x55a2, 0x6d, 0x0},
+    {0x55a3, 0x55, 0x0},
+    {0x55a4, 0xc3, 0x0},
+    {0x55a5, 0xb5, 0x0},
+    {0x55a6, 0x43, 0x0},
+    {0x55a7, 0x38, 0x0},
+    {0x55a8, 0x5f, 0x0},
+    {0x55a9, 0x4b, 0x0},
+    {0x55aa, 0xf0, 0x0},
+    {0x55ab, 0x10, 0x0},
+    {0x5581, 0x52, 0x0},
+    {0x5300, 0x1, 0x0},
+    {0x5301, 0x0, 0x0},
+    {0x5302, 0x0, 0x0},
+    {0x5303, 0xe, 0x0},
+    {0x5304, 0x0, 0x0},
+    {0x5305, 0xe, 0x0},
+    {0x5306, 0x0, 0x0},
+    {0x5307, 0x36, 0x0},
+    {0x5308, 0x0, 0x0},
+    {0x5309, 0xd9, 0x0},
+    {0x530a, 0x0, 0x0},
+    {0x530b, 0xf, 0x0},
+    {0x530c, 0x0, 0x0},
+    {0x530d, 0x2c, 0x0},
+    {0x530e, 0x0, 0x0},
+    {0x530f, 0x59, 0x0},
+    {0x5310, 0x0, 0x0},
+    {0x5311, 0x7b, 0x0},
+    {0x5312, 0x0, 0x0},
+    {0x5313, 0x22, 0x0},
+    {0x5314, 0x0, 0x0},
+    {0x5315, 0xd5, 0x0},
+    {0x5316, 0x0, 0x0},
+    {0x5317, 0x13, 0x0},
+    {0x5318, 0x0, 0x0},
+    {0x5319, 0x18, 0x0},
+    {0x531a, 0x0, 0x0},
+    {0x531b, 0x26, 0x0},
+    {0x531c, 0x0, 0x0},
+    {0x531d, 0xdc, 0x0},
+    {0x531e, 0x0, 0x0},
+    {0x531f, 0x2, 0x0},
+    {0x5320, 0x0, 0x0},
+    {0x5321, 0x24, 0x0},
+    {0x5322, 0x0, 0x0},
+    {0x5323, 0x56, 0x0},
+    {0x5324, 0x0, 0x0},
+    {0x5325, 0x85, 0x0},
+    {0x5326, 0x0, 0x0},
+    {0x5327, 0x20, 0x0},
+    {0x5609, 0x1, 0x0},
+    {0x560a, 0x40, 0x0},
+    {0x560b, 0x1, 0x0},
+    {0x560c, 0x40, 0x0},
+    {0x560d, 0x0, 0x0},
+    {0x560e, 0xfa, 0x0},
+    {0x560f, 0x0, 0x0},
+    {0x5610, 0xfa, 0x0},
+    {0x5611, 0x2, 0x0},
+    {0x5612, 0x80, 0x0},
+    {0x5613, 0x2, 0x0},
+    {0x5614, 0x80, 0x0},
+    {0x5615, 0x1, 0x0},
+    {0x5616, 0x2c, 0x0},
+    {0x5617, 0x1, 0x0},
+    {0x5618, 0x2c, 0x0},
+    {0x563b, 0x1, 0x0},
+    {0x563c, 0x1, 0x0},
+    {0x563d, 0x1, 0x0},
+    {0x563e, 0x1, 0x0},
+    {0x563f, 0x3, 0x0},
+    {0x5640, 0x3, 0x0},
+    {0x5641, 0x3, 0x0},
+    {0x5642, 0x5, 0x0},
+    {0x5643, 0x9, 0x0},
+    {0x5644, 0x5, 0x0},
+    {0x5645, 0x5, 0x0},
+    {0x5646, 0x5, 0x0},
+    {0x5647, 0x5, 0x0},
+    {0x5651, 0x0, 0x0},
+    {0x5652, 0x80, 0x0},
+    {0x521a, 0x1, 0x0},
+    {0x521b, 0x3, 0x0},
+    {0x521c, 0x6, 0x0},
+    {0x521d, 0xa, 0x0},
+    {0x521e, 0xe, 0x0},
+    {0x521f, 0x12, 0x0},
+    {0x5220, 0x16, 0x0},
+    {0x5223, 0x2, 0x0},
+    {0x5225, 0x4, 0x0},
+    {0x5227, 0x8, 0x0},
+    {0x5229, 0xc, 0x0},
+    {0x522b, 0x12, 0x0},
+    {0x522d, 0x18, 0x0},
+    {0x522f, 0x1e, 0x0},
+    {0x5241, 0x4, 0x0},
+    {0x5242, 0x1, 0x0},
+    {0x5243, 0x3, 0x0},
+    {0x5244, 0x6, 0x0},
+    {0x5245, 0xa, 0x0},
+    {0x5246, 0xe, 0x0},
+    {0x5247, 0x12, 0x0},
+    {0x5248, 0x16, 0x0},
+    {0x524a, 0x3, 0x0},
+    {0x524c, 0x4, 0x0},
+    {0x524e, 0x8, 0x0},
+    {0x5250, 0xc, 0x0},
+    {0x5252, 0x12, 0x0},
+    {0x5254, 0x18, 0x0},
+    {0x5256, 0x1e, 0x0},
+    {0x4605, 0x8, 0x0},  /* 8-bit YUV mode. */
+    {0x4606, 0x7, 0x0},
+    {0x4607, 0x71, 0x0},
+    {0x460a, 0x2, 0x0},
+    {0x460b, 0x70, 0x0},
+    {0x460c, 0x0, 0x0},
+    {0x4620, 0xe, 0x0},
+    {0x4700, 0x4, 0x0},
+
+    {0x4701, 0x01, 0x0},
+    {0x4702, 0x00, 0x0},
+    {0x4703, 0x00, 0x0},
+    {0x4704, 0x00, 0x0},
+    /* Non-overlapping HSYNC-VSYNC.
+     * Therefore do not set the VSYNC delay registers. */
+    {0x4705, 0x00, 0x0},    /* Vsync delay high byte */
+    {0x4706, 0x00, 0x0},    /* Vsync delay middle byte */
+    {0x4707, 0x00, 0x0},    /* Vsync delay low byte */
+    {0x4004, 0x8, 0x0},
+    {0x4005, 0x18, 0x0},
+    {0x4001, 0x4, 0x0},
+    {0x4050, 0x20, 0x0},
+    {0x4051, 0x22, 0x0},
+    {0x4057, 0x9c, 0x0},
+    {0x405a, 0x0, 0x0},
+    {0x4202, 0x2, 0x0},
+    {0x3023, 0x10, 0x0},
+    {0x100, 0x1, 0x0},
+    {0x100, 0x1, 0x0},
+    {0x6f0e, 0x0, 0x0},
+    {0x6f0f, 0x0, 0x0},
+    {0x460e, 0x8, 0x0},
+    {0x460f, 0x1, 0x0},
+    {0x4610, 0x0, 0x0},
+    {0x4611, 0x1, 0x0},
+    {0x4612, 0x0, 0x0},
+    {0x4613, 0x1, 0x0},
+    {0x4605, 0x8, 0x0},
+    {0x4608, 0x0, 0x0},
+    {0x4609, 0x8, 0x0},
+    {0x6804, 0x0, 0x0},
+    {0x6805, 0x6, 0x0},
+    {0x6806, 0x0, 0x0},
+    {0x5120, 0x0, 0x0},
+    {0x3510, 0x0, 0x0},
+    {0x3504, 0x0, 0x0},
+    {0x6800, 0x0, 0x0},
+    {0x6f0d, 0x0, 0x0},
+    {0x5000, 0xff, 0x0},
+    {0x5001, 0xbf, 0x0},
+    {0x5002, 0xfe, 0x0},
+    {0x503d, 0x0, 0x0},
+    {0xc450, 0x1, 0x0},
+    {0xc452, 0x4, 0x0},
+    {0xc453, 0x0, 0x0},
+    {0xc454, 0x0, 0x0},
+    {0xc455, 0x0, 0x0},
+    {0xc456, 0x0, 0x0},
+    {0xc457, 0x0, 0x0},
+    {0xc458, 0x0, 0x0},
+    {0xc459, 0x0, 0x0},
+    {0xc45b, 0x0, 0x0},
+    {0xc45c, 0x0, 0x0},
+    {0xc45d, 0x0, 0x0},
+    {0xc45e, 0x0, 0x0},
+    {0xc45f, 0x0, 0x0},
+    {0xc460, 0x0, 0x0},
+    {0xc461, 0x1, 0x0},
+    {0xc462, 0x1, 0x0},
+    {0xc464, 0x88, 0x0},
+    {0xc465, 0x0, 0x0},
+    {0xc466, 0x8a, 0x0},
+    {0xc467, 0x0, 0x0},
+    {0xc468, 0x86, 0x0},
+    {0xc469, 0x0, 0x0},
+    {0xc46a, 0x40, 0x0},
+    {0xc46b, 0x50, 0x0},
+    {0xc46c, 0x30, 0x0},
+    {0xc46d, 0x28, 0x0},
+    {0xc46e, 0x60, 0x0},
+    {0xc46f, 0x40, 0x0},
+    {0xc47c, 0x1, 0x0},
+    {0xc47d, 0x38, 0x0},
+    {0xc47e, 0x0, 0x0},
+    {0xc47f, 0x0, 0x0},
+    {0xc480, 0x0, 0x0},
+    {0xc481, 0xff, 0x0},
+    {0xc482, 0x0, 0x0},
+    {0xc483, 0x40, 0x0},
+    {0xc484, 0x0, 0x0},
+    {0xc485, 0x18, 0x0},
+    {0xc486, 0x0, 0x0},
+    {0xc487, 0x18, 0x0},
+    {0xc488, 0x2e, 0x0},
+    {0xc489, 0x80, 0x0},
+    {0xc48a, 0x2e, 0x0},
+    {0xc48b, 0x80, 0x0},
+    {0xc48c, 0x0, 0x0},
+    {0xc48d, 0x4, 0x0},
+    {0xc48e, 0x0, 0x0},
+    {0xc48f, 0x4, 0x0},
+    {0xc490, 0x7, 0x0},
+    {0xc492, 0x20, 0x0},
+    {0xc493, 0x8, 0x0},
+    {0xc498, 0x2, 0x0},
+    {0xc499, 0x0, 0x0},
+    {0xc49a, 0x2, 0x0},
+    {0xc49b, 0x0, 0x0},
+    {0xc49c, 0x2, 0x0},
+    {0xc49d, 0x0, 0x0},
+    {0xc49e, 0x2, 0x0},
+    {0xc49f, 0x60, 0x0},
+    {0xc4a0, 0x4, 0x0},
+    {0xc4a1, 0x0, 0x0},
+    {0xc4a2, 0x6, 0x0},
+    {0xc4a3, 0x0, 0x0},
+    {0xc4a4, 0x0, 0x0},
+    {0xc4a5, 0x10, 0x0},
+    {0xc4a6, 0x0, 0x0},
+    {0xc4a7, 0x40, 0x0},
+    {0xc4a8, 0x0, 0x0},
+    {0xc4a9, 0x80, 0x0},
+    {0xc4aa, 0xd, 0x0},
+    {0xc4ab, 0x0, 0x0},
+    {0xc4ac, 0xf, 0x0},
+    {0xc4ad, 0xc0, 0x0},
+    {0xc4b4, 0x1, 0x0},
+    {0xc4b5, 0x1, 0x0},
+    {0xc4b6, 0x0, 0x0},
+    {0xc4b7, 0x1, 0x0},
+    {0xc4b8, 0x0, 0x0},
+    {0xc4b9, 0x1, 0x0},
+    {0xc4ba, 0x1, 0x0},
+    {0xc4bb, 0x0, 0x0},
+    {0xc4be, 0x2, 0x0},
+    {0xc4bf, 0x33, 0x0},
+    {0xc4c8, 0x3, 0x0},
+    {0xc4c9, 0xd0, 0x0},
+    {0xc4ca, 0xe, 0x0},
+    {0xc4cb, 0x0, 0x0},
+    {0xc4cc, 0xe, 0x0},
+    {0xc4cd, 0x51, 0x0},
+    {0xc4ce, 0xe, 0x0},
+    {0xc4cf, 0x51, 0x0},
+    {0xc4d0, 0x4, 0x0},
+    {0xc4d1, 0x80, 0x0},
+    {0xc4e0, 0x4, 0x0},
+    {0xc4e1, 0x2, 0x0},
+    {0xc4e2, 0x1, 0x0},
+    {0xc4e4, 0x10, 0x0},
+    {0xc4e5, 0x20, 0x0},
+    {0xc4e6, 0x30, 0x0},
+    {0xc4e7, 0x40, 0x0},
+    {0xc4e8, 0x50, 0x0},
+    {0xc4e9, 0x60, 0x0},
+    {0xc4ea, 0x70, 0x0},
+    {0xc4eb, 0x80, 0x0},
+    {0xc4ec, 0x90, 0x0},
+    {0xc4ed, 0xa0, 0x0},
+    {0xc4ee, 0xb0, 0x0},
+    {0xc4ef, 0xc0, 0x0},
+    {0xc4f0, 0xd0, 0x0},
+    {0xc4f1, 0xe0, 0x0},
+    {0xc4f2, 0xf0, 0x0},
+    {0xc4f3, 0x80, 0x0},
+    {0xc4f4, 0x0, 0x0},
+    {0xc4f5, 0x20, 0x0},
+    {0xc4f6, 0x2, 0x0},
+    {0xc4f7, 0x0, 0x0},
+    {0xc4f8, 0x4, 0x0},
+    {0xc4f9, 0xb, 0x0},
+    {0xc4fa, 0x0, 0x0},
+    {0xc4fb, 0x1, 0x0},
+    {0xc4fc, 0x1, 0x0},
+    {0xc4fd, 0x1, 0x0},
+    {0xc4fe, 0x4, 0x0},
+    {0xc4ff, 0x2, 0x0},
+    {0xc500, 0x68, 0x0},
+    {0xc501, 0x74, 0x0},
+    {0xc502, 0x70, 0x0},
+    {0xc503, 0x80, 0x0},
+    {0xc504, 0x5, 0x0},
+    {0xc505, 0x80, 0x0},
+    {0xc506, 0x3, 0x0},
+    {0xc507, 0x80, 0x0},
+    {0xc508, 0x1, 0x0},
+    {0xc509, 0xc0, 0x0},
+    {0xc50a, 0x1, 0x0},
+    {0xc50b, 0xa0, 0x0},
+    {0xc50c, 0x1, 0x0},
+    {0xc50d, 0x2c, 0x0},
+    {0xc50e, 0x1, 0x0},
+    {0xc50f, 0xa, 0x0},
+    {0xc510, 0x0, 0x0},
+    {0xc511, 0x0, 0x0},
+    {0xc512, 0xe5, 0x0},
+    {0xc513, 0x14, 0x0},
+    {0xc514, 0x4, 0x0},
+    {0xc515, 0x0, 0x0},
+    {0xc518, 0x3, 0x0},
+    {0xc519, 0x48, 0x0},
+    {0xc51a, 0x7, 0x0},
+    {0xc51b, 0x70, 0x0},
+    {0xc2e0, 0x0, 0x0},
+    {0xc2e1, 0x51, 0x0},
+    {0xc2e2, 0x0, 0x0},
+    {0xc2e3, 0xd6, 0x0},
+    {0xc2e4, 0x1, 0x0},
+    {0xc2e5, 0x5e, 0x0},
+    {0xc2e9, 0x1, 0x0},
+    {0xc2ea, 0x7a, 0x0},
+    {0xc2eb, 0x90, 0x0},
+    {0xc2ed, 0x1, 0x0},
+    {0xc2ee, 0x7a, 0x0},
+    {0xc2ef, 0x64, 0x0},
+    {0xc308, 0x0, 0x0},
+    {0xc309, 0x0, 0x0},
+    {0xc30a, 0x0, 0x0},
+    {0xc30c, 0x0, 0x0},
+    {0xc30d, 0x1, 0x0},
+    {0xc30e, 0x0, 0x0},
+    {0xc30f, 0x0, 0x0},
+    {0xc310, 0x1, 0x0},
+    {0xc311, 0x60, 0x0},
+    {0xc312, 0xff, 0x0},
+    {0xc313, 0x8, 0x0},
+    {0xc314, 0x1, 0x0},
+    {0xc315, 0x7f, 0x0},
+    {0xc316, 0xff, 0x0},
+    {0xc317, 0xb, 0x0},
+    {0xc318, 0x0, 0x0},
+    {0xc319, 0xc, 0x0},
+    {0xc31a, 0x0, 0x0},
+    {0xc31b, 0xe0, 0x0},
+    {0xc31c, 0x0, 0x0},
+    {0xc31d, 0x14, 0x0},
+    {0xc31e, 0x0, 0x0},
+    {0xc31f, 0xc5, 0x0},
+    {0xc320, 0xff, 0x0},
+    {0xc321, 0x4b, 0x0},
+    {0xc322, 0xff, 0x0},
+    {0xc323, 0xf0, 0x0},
+    {0xc324, 0xff, 0x0},
+    {0xc325, 0xe8, 0x0},
+    {0xc326, 0x0, 0x0},
+    {0xc327, 0x46, 0x0},
+    {0xc328, 0xff, 0x0},
+    {0xc329, 0xd2, 0x0},
+    {0xc32a, 0xff, 0x0},
+    {0xc32b, 0xe4, 0x0},
+    {0xc32c, 0xff, 0x0},
+    {0xc32d, 0xbb, 0x0},
+    {0xc32e, 0x0, 0x0},
+    {0xc32f, 0x61, 0x0},
+    {0xc330, 0xff, 0x0},
+    {0xc331, 0xf9, 0x0},
+    {0xc332, 0x0, 0x0},
+    {0xc333, 0xd9, 0x0},
+    {0xc334, 0x0, 0x0},
+    {0xc335, 0x2e, 0x0},
+    {0xc336, 0x0, 0x0},
+    {0xc337, 0xb1, 0x0},
+    {0xc338, 0xff, 0x0},
+    {0xc339, 0x64, 0x0},
+    {0xc33a, 0xff, 0x0},
+    {0xc33b, 0xeb, 0x0},
+    {0xc33c, 0xff, 0x0},
+    {0xc33d, 0xe8, 0x0},
+    {0xc33e, 0x0, 0x0},
+    {0xc33f, 0x48, 0x0},
+    {0xc340, 0xff, 0x0},
+    {0xc341, 0xd0, 0x0},
+    {0xc342, 0xff, 0x0},
+    {0xc343, 0xed, 0x0},
+    {0xc344, 0xff, 0x0},
+    {0xc345, 0xad, 0x0},
+    {0xc346, 0x0, 0x0},
+    {0xc347, 0x66, 0x0},
+    {0xc348, 0x1, 0x0},
+    {0xc349, 0x0, 0x0},
+    {0x6700, 0x4, 0x0},
+    {0x6701, 0x7b, 0x0},
+    {0x6702, 0xfd, 0x0},
+    {0x6703, 0xf9, 0x0},
+    {0x6704, 0x3d, 0x0},
+    {0x6705, 0x71, 0x0},
+    /*
+     * 0x6706[3:0] :: XVCLK
+     * 0x6706[3:0] :: 0 = 6MHz
+     * 0x6706[3:0] :: 1 = 9MHz
+     * 0x6706[3:0] :: 8 = 24MHz
+     * 0x6706[3:0] :: 9 = 27MHz
+     */
+    {0x6706, 0x78, 0x0},
+    {0x6708, 0x5, 0x0},
+    {0x3822, 0x50, 0x0},
+    {0x6f06, 0x6f, 0x0},
+    {0x6f07, 0x0, 0x0},
+    {0x6f0a, 0x6f, 0x0},
+    {0x6f0b, 0x0, 0x0},
+    {0x6f00, 0x3, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x3042, 0xf0, 0x0},
+    {0x301b, 0xf0, 0x0},
+    {0x301c, 0xf0, 0x0},
+    {0x301a, 0xf0, 0x0},
+    {0x0100, 0x00, 0x0},
+    {0x4300, 0x38, 0x0},
+    {0x0100, 0x01, 0x0},
+};
+
+uint32_t gUb960Cfg_SAT0088_OV10635_size = sizeof(gUb960Cfg_SAT0088_OV10635) / sizeof(gUb960Cfg_SAT0088_OV10635[0]);
+
+uint32_t gUb960Cfg_Ov1063xLvdsSensorsDefault_size = sizeof(gUb960Cfg_Ov1063xLvdsSensorsDefault) / sizeof(gUb960Cfg_Ov1063xLvdsSensorsDefault[0]);
+
+/* ========================================================================== */
+/*                          Function Implementation                           */
+/* ========================================================================== */
diff --git a/packages/ti/drv/cal/examples/utils/src/V0/linker_cal_a53.lds b/packages/ti/drv/cal/examples/utils/src/V0/linker_cal_a53.lds
new file mode 100644 (file)
index 0000000..6b621c2
--- /dev/null
@@ -0,0 +1,176 @@
+/*     File: linker_a53.lds
+ *  Semihosting supported gcc Linker script for AM65XX A53 for QT
+ *     Purpose: single core A53 C app
+*/
+__STACK_SIZE = 0x10000;
+__TI_STACK_SIZE = __STACK_SIZE;
+
+MEMORY
+{
+    MCU_RESVD   : ORIGIN = 0x000041C00000, LENGTH = 0x00060000                         /* MCUSS-OCMC RAM RESERVED FOR MCUSS & SOC Boot  - 384KB        */
+    OCMCRAM     : ORIGIN = 0x000041C60000, LENGTH = 0x00020000                         /* MCUSS-OCMC RAM - 128KB                                       */
+    BOOTVECTOR  : ORIGIN = 0x000070000100, LENGTH = 0x00001000 - 0x100      /* MSMC RAM INIT CODE (4 KB)                               */
+    MSMC_SRAM   : ORIGIN = 0x000070001000, LENGTH = 0xEF000                            /* MSMC RAM GENERAL USE */
+    MSMC_DMSC   : ORIGIN = 0x700F0000, LENGTH = 0x10000                                /* Reserved for DMSC */
+    MSMC_SRAM_H : ORIGIN = 0x000070100000, LENGTH = 0xF2000                            /* MSMC RAM GENERAL USE - High memory */
+    MSMC_SRAM_H_NOCACHE : ORIGIN = 0x0000701F2000, LENGTH = 0x0000E000                         /* MSMC RAM no cache */
+
+    DDR_0      (RWX) : ORIGIN =  0x80000000, LENGTH = 0x10000000
+    DDR_1      (RWX) : ORIGIN =  0x90000000, LENGTH = 0x10000000
+    DDR_2      (RWX) : ORIGIN =  0xA0000000, LENGTH = 0x60000000
+}
+
+REGION_ALIAS("REGION_TEXT", MSMC_SRAM);
+REGION_ALIAS("REGION_BSS", MSMC_SRAM_H);
+REGION_ALIAS("REGION_DATA", MSMC_SRAM);
+REGION_ALIAS("REGION_STACK", MSMC_SRAM);
+REGION_ALIAS("REGION_HEAP", MSMC_SRAM);
+REGION_ALIAS("REGION_ARM_EXIDX", MSMC_SRAM);
+REGION_ALIAS("REGION_ARM_EXTAB", MSMC_SRAM);
+REGION_ALIAS("REGION_TEXT_STARTUP", MSMC_SRAM);
+REGION_ALIAS("REGION_DATA_BUFFER", MSMC_SRAM);
+
+SECTIONS {
+
+    .vecs : {
+        *(.vecs)
+    } > BOOTVECTOR AT> BOOTVECTOR
+
+    .text.csl_a53_startup : {
+        *(.text.csl_a53_startup)
+               *(.Entry)
+    } > REGION_TEXT_STARTUP AT> REGION_TEXT_STARTUP
+
+    .text : {
+        CREATE_OBJECT_SYMBOLS
+        *(.text)
+        *(.text.*)
+        . = ALIGN(0x8);
+        KEEP (*(.ctors))
+        . = ALIGN(0x4);
+        KEEP (*(.dtors))
+        . = ALIGN(0x8);
+        __init_array_start = .;
+        KEEP (*(.init_array*))
+        __init_array_end = .;
+        *(.init)
+        *(.fini*)
+    } > REGION_TEXT AT> REGION_TEXT
+
+    PROVIDE (__etext = .);
+    PROVIDE (_etext = .);
+    PROVIDE (etext = .);
+
+    .rodata : {
+        *(.rodata)
+        *(.rodata*)
+    } > REGION_TEXT AT> REGION_TEXT
+
+    .data_buffer : ALIGN (8) {
+        __data_buffer_load__ = LOADADDR (.data_buffer);
+        __data_buffer_start__ = .;
+        *(.data_buffer)
+        *(.data_buffer*)
+        . = ALIGN (8);
+        __data_buffer_end__ = .;
+    } > REGION_DATA_BUFFER AT> REGION_DATA_BUFFER
+
+    .data : ALIGN (8) {
+        __data_load__ = LOADADDR (.data);
+        __data_start__ = .;
+        *(.data)
+        *(.data*)
+        . = ALIGN (8);
+        __data_end__ = .;
+    } > REGION_DATA AT> REGION_TEXT
+
+    .ARM.exidx : {
+        __exidx_start = .;
+        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+        __exidx_end = .;
+    } > REGION_ARM_EXIDX AT> REGION_ARM_EXIDX
+
+    .ARM.extab : {
+        *(.ARM.extab* .gnu.linkonce.armextab.*)
+    } > REGION_ARM_EXTAB AT> REGION_ARM_EXTAB
+
+    /* usb application ramdisk buffer */
+    .bss:extMemCache:ramdisk (NOLOAD) : ALIGN (32) {
+    } > DDR_0
+
+    /* cal's application buffer */
+    .bss:frameBuffer (NOLOAD) : ALIGN (32) {
+    } > DDR_0
+
+    .bss : {
+        __bss_start__ = .;
+        *(.shbss)
+        *(.bss)
+        *(.bss.*)
+        . = ALIGN (8);
+        __bss_end__ = .;
+        . = ALIGN (8);
+        *(COMMON)
+    } > REGION_BSS AT> REGION_BSS
+
+    .heap : {
+        __heap_start__ = .;
+        end = __heap_start__;
+        _end = end;
+        __end = end;
+        KEEP(*(.heap))
+        __heap_end__ = .;
+        __HeapLimit = __heap_end__;
+    } > REGION_HEAP AT> REGION_HEAP
+
+    .stack (NOLOAD) : ALIGN(16) {
+        _stack = .;
+        __stack = .;
+        KEEP(*(.stack))
+    } > REGION_STACK AT> REGION_STACK
+
+       __TI_STACK_BASE = __stack;
+
+    /* Stabs debugging sections.  */
+    .stab          0 : { *(.stab) }
+    .stabstr       0 : { *(.stabstr) }
+    .stab.excl     0 : { *(.stab.excl) }
+    .stab.exclstr  0 : { *(.stab.exclstr) }
+    .stab.index    0 : { *(.stab.index) }
+    .stab.indexstr 0 : { *(.stab.indexstr) }
+    .comment       0 : { *(.comment) }
+    /*
+     * DWARF debug sections.
+     * Symbols in the DWARF debugging sections are relative to the beginning
+     * of the section so we begin them at 0.
+     */
+    /* DWARF 1 */
+    .debug         0 : { *(.debug) }
+    .line          0 : { *(.line) }
+    /* GNU DWARF 1 extensions */
+    .debug_srcinfo  0 : { *(.debug_srcinfo) }
+    .debug_sfnames  0 : { *(.debug_sfnames) }
+    /* DWARF 1.1 and DWARF 2 */
+    .debug_aranges  0 : { *(.debug_aranges) }
+    .debug_pubnames 0 : { *(.debug_pubnames) }
+    /* DWARF 2 */
+    .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
+    .debug_abbrev   0 : { *(.debug_abbrev) }
+    .debug_line     0 : { *(.debug_line .debug_line.* .debug_line_end ) }
+    .debug_frame    0 : { *(.debug_frame) }
+    .debug_str      0 : { *(.debug_str) }
+    .debug_loc      0 : { *(.debug_loc) }
+    .debug_macinfo  0 : { *(.debug_macinfo) }
+    /* SGI/MIPS DWARF 2 extensions */
+    .debug_weaknames 0 : { *(.debug_weaknames) }
+    .debug_funcnames 0 : { *(.debug_funcnames) }
+    .debug_typenames 0 : { *(.debug_typenames) }
+    .debug_varnames  0 : { *(.debug_varnames) }
+    /* DWARF 3 */
+    .debug_pubtypes 0 : { *(.debug_pubtypes) }
+    .debug_ranges   0 : { *(.debug_ranges) }
+    /* DWARF Extension.  */
+    .debug_macro    0 : { *(.debug_macro) }
+    .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
+    /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
+}
diff --git a/packages/ti/drv/cal/examples/utils/src/calutils_mem.c b/packages/ti/drv/cal/examples/utils/src/calutils_mem.c
new file mode 100755 (executable)
index 0000000..0955d23
--- /dev/null
@@ -0,0 +1,487 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2018
+ *
+ *  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 calutils_mem.c
+ *
+ *  \brief Frame buffer memory allocator API.
+ *
+ */
+
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+
+#include <string.h>
+#if defined (BARE_METAL)
+#include <stdlib.h>
+#else
+#include <xdc/std.h>
+#include <ti/sysbios/BIOS.h>
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/IHeap.h>
+#include <ti/sysbios/heaps/HeapMem.h>
+#endif
+#include <ti/osal/osal.h>
+#include <calutils.h>
+
+/* See calutils_mem.h for function documentation  */
+
+/* ========================================================================== */
+/*                           Macros & Typedefs                                */
+/* ========================================================================== */
+
+#if defined(BARE_METAL)
+/** \brief Typedef for Heap memory handle */
+typedef void* HeapMem_Handle;
+#endif
+
+/* ========================================================================== */
+/*                         Structure Declarations                             */
+/* ========================================================================== */
+
+/** \brief Maximum frame buffer memory pool size */
+#define CALUTILS_MEM_FRAME_HEAP_SIZE    (20U * MB)
+
+/* ========================================================================== */
+/*                          Function Declarations                             */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                            Global Variables                                */
+/* ========================================================================== */
+
+/* Memory pool handle */
+HeapMem_Handle gCalUtils_heapMemFrameHandle = NULL;
+#if !defined(BARE_METAL)
+HeapMem_Struct gCalUtils_heapMemFrameStruct;
+#endif
+
+/* Memory pool */
+/* Place the frame heap in frame buffer section. */
+uint32_t gCalUtils_heapMemFrame[(uint32_t) CALUTILS_MEM_FRAME_HEAP_SIZE /
+                              (uint32_t) sizeof (uint32_t)]
+                              __attribute__ ((section (".bss:frameBuffer")))
+                              __attribute__((aligned(CAL_BUFFER_ALIGNMENT_RECOMMENDED)));
+
+Bool           gCalUtils_memClearBuf;
+
+/* ========================================================================== */
+/*                          Function Definitions                              */
+/* ========================================================================== */
+int32_t CalUtils_memInit(void)
+{
+    uint32_t memSize;
+
+    memSize = sizeof (gCalUtils_heapMemFrame);
+
+    CalUtils_memInit_internal(gCalUtils_heapMemFrame, memSize);
+    return 0;
+}
+
+int32_t CalUtils_memInit_internal(uint32_t *pMemAddr, uint32_t memSize)
+{
+#if !defined (BARE_METAL)
+    HeapMem_Params heapMemPrm;
+
+    /* create memory pool heap  */
+    HeapMem_Params_init(&heapMemPrm);
+
+    heapMemPrm.buf  = pMemAddr;
+    heapMemPrm.size = memSize;
+
+    HeapMem_construct(&gCalUtils_heapMemFrameStruct, &heapMemPrm);
+    gCalUtils_heapMemFrameHandle = HeapMem_handle(&gCalUtils_heapMemFrameStruct);
+    GT_assert(CalUtilsTrace, gCalUtils_heapMemFrameHandle != NULL);
+#endif
+    gCalUtils_memClearBuf = (Bool) FALSE;
+
+    return (FVID2_SOK);
+}
+
+int32_t CalUtils_memDeInit(void)
+{
+    /* delete memory pool heap  */
+#if !defined (BARE_METAL)
+    HeapMem_destruct(&gCalUtils_heapMemFrameStruct);
+    gCalUtils_heapMemFrameHandle = NULL;
+#endif
+    return (FVID2_SOK);
+}
+
+int32_t CalUtils_memFrameGetSize(const Fvid2_Format *pFormat,
+                               uint32_t             *size,
+                               uint32_t             *cOffset)
+{
+    int32_t  status = FVID2_SOK;
+    uint32_t bufferHeight;
+
+    bufferHeight = pFormat->height;
+    switch (pFormat->dataFormat)
+    {
+        case FVID2_DF_RAW08:
+        case FVID2_DF_RAW16:
+        case FVID2_DF_RAW24:
+        case FVID2_DF_YUV422I_YUYV:
+        case FVID2_DF_YUV422I_YVYU:
+        case FVID2_DF_YUV422I_UYVY:
+        case FVID2_DF_YUV422I_VYUY:
+        case FVID2_DF_YUV444I:
+        case FVID2_DF_RGB24_888:
+        case FVID2_DF_BGR24_888:
+        case FVID2_DF_RAW_VBI:
+        case FVID2_DF_BGRX_4444:
+        case FVID2_DF_XBGR_4444:
+        case FVID2_DF_AGBR16_4444:
+        case FVID2_DF_RGBA16_4444:
+        case FVID2_DF_XGBR16_1555:
+        case FVID2_DF_AGBR16_1555:
+        case FVID2_DF_BGR16_565:
+        case FVID2_DF_XBGR24_8888:
+        case FVID2_DF_RGBX24_8888:
+        case FVID2_DF_ABGR32_8888:
+        case FVID2_DF_RGBA32_8888:
+        case FVID2_DF_BGRA32_8888:
+        case FVID2_DF_ARGB32_8888:
+        case FVID2_DF_BAYER_RAW:
+        case FVID2_DF_BAYER_GRBG:
+        case FVID2_DF_BAYER_RGGB:
+        case FVID2_DF_BAYER_BGGR:
+        case FVID2_DF_BAYER_GBRG:
+            /* for single plane data format's */
+            *size = pFormat->pitch[0] * bufferHeight;
+            break;
+
+        case FVID2_DF_YUV422SP_UV:
+        case FVID2_DF_YUV420SP_UV:
+            /* for Y plane  */
+            *size = pFormat->pitch[0] * bufferHeight;
+
+            /* cOffset is at end of Y plane  */
+            if (NULL != cOffset)
+            {
+                *cOffset = *size;
+            }
+            if (pFormat->dataFormat == FVID2_DF_YUV420SP_UV)
+            {
+                /* C plane height is 1/2 of Y plane */
+                bufferHeight = bufferHeight / 2U;
+            }
+
+            /* for C plane  */
+            *size += (pFormat->pitch[1] * bufferHeight);
+            break;
+
+        default:
+            /* illegal data format  */
+            status = FVID2_EFAIL;
+            break;
+    }
+
+    /* align size to minimum required frame buffer alignment  */
+    *size = CalUtils_align(*size, (uint32_t) CAL_BUFFER_ALIGNMENT_RECOMMENDED);
+
+    return (status);
+}
+
+int32_t CalUtils_memFrameAlloc(Fvid2_Format *pFormat,
+                             Fvid2_Frame  *pFrame,
+                             uint32_t        numFrames)
+{
+    int32_t  status;
+    uint32_t size, cOffset, frameId;
+    uint8_t *pBaseAddr;
+
+    /* align height to multiple of 2  */
+    pFormat->height = CalUtils_align(pFormat->height, (uint32_t) 2U);
+
+    /* get frame size for given pFormat */
+    status = CalUtils_memFrameGetSize(pFormat, &size, &cOffset);
+    if (status == FVID2_SOK)
+    {
+        /* allocate the memory for 'numFrames' */
+
+        /* for all 'numFrames' memory is contigously allocated  */
+        pBaseAddr = (uint8_t *) CalUtils_memAlloc(
+            (size * numFrames),
+            (uint32_t) CAL_BUFFER_ALIGNMENT_RECOMMENDED);
+        if (pBaseAddr == NULL)
+        {
+            status = FVID2_EALLOC;  /* Error in allocation, exit with error */
+        }
+    }
+
+    if (status == FVID2_SOK)
+    {
+        /* init memory pointer for 'numFrames'  */
+        for (frameId = 0; frameId < numFrames; frameId++)
+        {
+            /* init Fvid2_Frame to 0's  */
+            Fvid2Frame_init(pFrame);
+
+            /* copy chNum to Fvid2_Frame from Fvid2_Format */
+            pFrame->chNum      = pFormat->chNum;
+            pFrame->addr[0] = (uint64_t) pBaseAddr;
+
+            switch (pFormat->dataFormat)
+            {
+                case FVID2_DF_RAW08:
+                case FVID2_DF_RAW16:
+                case FVID2_DF_RAW24:
+                case FVID2_DF_RAW_VBI:
+                case FVID2_DF_YUV422I_UYVY:
+                case FVID2_DF_YUV422I_VYUY:
+                case FVID2_DF_YUV422I_YUYV:
+                case FVID2_DF_YUV422I_YVYU:
+                case FVID2_DF_YUV444I:
+                case FVID2_DF_RGB24_888:
+                case FVID2_DF_BGR24_888:
+                case FVID2_DF_BGRX_4444:
+                case FVID2_DF_XBGR_4444:
+                case FVID2_DF_AGBR16_4444:
+                case FVID2_DF_RGBA16_4444:
+                case FVID2_DF_XGBR16_1555:
+                case FVID2_DF_AGBR16_1555:
+                case FVID2_DF_BGR16_565:
+                case FVID2_DF_XBGR24_8888:
+                case FVID2_DF_RGBX24_8888:
+                case FVID2_DF_ARGB32_8888:
+                case FVID2_DF_ABGR32_8888:
+                case FVID2_DF_RGBA32_8888:
+                case FVID2_DF_BGRA32_8888:
+                case FVID2_DF_BAYER_RAW:
+                case FVID2_DF_BAYER_GRBG:
+                case FVID2_DF_BAYER_RGGB:
+                case FVID2_DF_BAYER_BGGR:
+                case FVID2_DF_BAYER_GBRG:
+                    break;
+                case FVID2_DF_YUV422SP_UV:
+                case FVID2_DF_YUV420SP_UV:
+                    /* assign pointer for C plane */
+                    pFrame->addr[3] = (uint64_t) pFrame->addr[0] + cOffset;
+                    break;
+                default:
+                    /* illegal data format  */
+                    status = FVID2_EFAIL;
+                    break;
+            }
+
+            /* go to next frame */
+            pFrame++;
+            /* increment base address */
+            pBaseAddr += size;
+        }
+    }
+
+    GT_assert(CalUtilsTrace, status == FVID2_SOK);
+
+    return (status);
+}
+
+int32_t CalUtils_memFrameFree(const Fvid2_Format *pFormat,
+                            Fvid2_Frame        *pFrame,
+                            uint32_t              numFrames)
+{
+    int32_t  status;
+    uint32_t size, cOffset;
+
+    /* get frame size for given 'pFormat' */
+    status = CalUtils_memFrameGetSize(pFormat, &size, &cOffset);
+    if (status == FVID2_SOK)
+    {
+        /* free the frame buffer memory */
+
+        /* for all 'numFrames' memory is allocated contiguously during alloc,
+         *  so first frame memory pointer points to the complete
+         *  memory block for all frames */
+        CalUtils_memFree((void *)pFrame->addr[0], (size * numFrames));
+    }
+
+    return (FVID2_SOK);
+}
+
+#if defined (BARE_METAL)
+uint8_t *fw_mem_start_phy = (uint8_t*)&gCalUtils_heapMemFrame[0];
+uint8_t *fw_mem_start = (uint8_t*)gCalUtils_heapMemFrame;
+static uint8_t *fw_mem_end = (uint8_t*)(&gCalUtils_heapMemFrame[((uint32_t) CALUTILS_MEM_FRAME_HEAP_SIZE /
+                                                                (uint32_t) sizeof (uint32_t)) - 1U]);
+static uint8_t *fw_mem_alloc_ptr = (uint8_t*)gCalUtils_heapMemFrame;
+/* Macro to align x to y */
+#define align(x,y)   ((x + y) & (~y))
+
+void * CalUtils_alignedMalloc(uint32_t    size,    uint32_t    alignment)
+{
+  uint8_t *alloc_ptr;
+  void *     p_block = (void *) NULL;
+
+  alloc_ptr = (uint8_t*)align((uint32_t)fw_mem_alloc_ptr, alignment);
+
+  if ((alloc_ptr + size) < fw_mem_end)    {
+    p_block =(void *)alloc_ptr;
+    fw_mem_alloc_ptr = alloc_ptr + size;
+  }
+
+    return p_block;
+}
+
+void CalUtils_alignedFree(void *p, uint32_t size )
+{
+  /* Nothing to be done here */
+}
+#endif
+
+void * CalUtils_memAlloc(uint32_t size, uint32_t align)
+{
+    void * addr;
+
+    /* allocate memory  */
+#if defined (BARE_METAL)
+    addr = CalUtils_alignedMalloc(size, align);
+#else
+    addr = HeapMem_alloc(gCalUtils_heapMemFrameHandle, size, align, NULL);
+#endif
+    if (((Bool) (addr != NULL)) && gCalUtils_memClearBuf)
+    {
+        memset(addr, 0x80U, size);
+        /* Flush and invalidate the CPU write */
+        CacheP_wbInv(addr, size);
+    }
+
+    return (addr);
+}
+
+int32_t CalUtils_memFree(void *addr, uint32_t size)
+{
+    /* free previously allocated memory  */
+#if defined (BARE_METAL)
+   CalUtils_alignedFree(addr, size);
+#else
+    HeapMem_free(gCalUtils_heapMemFrameHandle, addr, size);
+#endif
+    return (FVID2_SOK);
+}
+
+int32_t CalUtils_memClearOnAlloc(Bool enable)
+{
+    gCalUtils_memClearBuf = enable;
+
+    return (FVID2_SOK);
+}
+
+/**
+ *  CalUtils_memGetHeapStat
+ *  \brief Returns the current status (free size) of the various heaps used.
+ *
+ *  \param heapStat [OUT]   Status filled by the function.
+ *
+ */
+void CalUtils_memGetHeapStat(CalUtils_MemHeapStatus *heapStat)
+{
+    /* NULL pointer check */
+    GT_assert(CalUtilsTrace, NULL != heapStat);
+
+    heapStat->freeSysHeapSize  = CalUtils_memGetSystemHeapFreeSpace();
+    heapStat->freeBufHeapSize  = CalUtils_memGetBufferHeapFreeSpace();
+
+    return;
+}
+
+/**
+ *  CalUtils_memCheckHeapStat
+ *  \brief Checks the current status of each heap with the value passed.
+ *  This returns an error if the values of each of the heap doesn't match.
+ *
+ *  \param heapStat [IN]    Older status to be compared with the current status.
+ *
+ *  \return                 Returns 0 if the heap sizes match else return
+ *                          FVID2_EFAIL.
+ */
+int32_t CalUtils_memCheckHeapStat(const CalUtils_MemHeapStatus *heapStat)
+{
+    int32_t retVal = FVID2_SOK;
+    CalUtils_MemHeapStatus curStat;
+
+    /* NULL pointer check */
+    GT_assert(CalUtilsTrace, NULL != heapStat);
+
+    CalUtils_memGetHeapStat(&curStat);
+
+    if (heapStat->freeSysHeapSize != curStat.freeSysHeapSize)
+    {
+        GT_1trace(CalUtilsTrace, GT_CRIT,
+                  "Warning: Memory leak (%d bytes) in System Heap!!\r\n",
+                  (heapStat->freeSysHeapSize - curStat.freeSysHeapSize));
+        retVal = FVID2_EFAIL;
+    }
+    if (heapStat->freeBufHeapSize != curStat.freeBufHeapSize)
+    {
+        GT_1trace(CalUtilsTrace, GT_CRIT,
+                  "Warning: Memory leak (%d bytes) in Buffer Heap!!\r\n",
+                  (heapStat->freeBufHeapSize - curStat.freeBufHeapSize));
+        retVal = FVID2_EFAIL;
+    }
+
+    return (retVal);
+}
+
+uint32_t CalUtils_memGetSystemHeapFreeSpace(void)
+{
+#if   !defined (BARE_METAL)
+    Memory_Stats stats;
+    extern const IHeap_Handle Memory_defaultHeapInstance;
+
+    Memory_getStats(Memory_defaultHeapInstance, &stats);
+
+    return ((uint32_t) (stats.totalFreeSize));
+#else
+    return ((uint32_t) 1U);
+#endif
+}
+
+uint32_t CalUtils_memGetBufferHeapFreeSpace(void)
+{
+    uint32_t       totalFreeSize = 0U;
+#if   !defined (BARE_METAL)
+    Memory_Stats stats;
+
+    if (NULL != gCalUtils_heapMemFrameHandle)
+    {
+        HeapMem_getStats(gCalUtils_heapMemFrameHandle, &stats);
+        totalFreeSize = (uint32_t) stats.totalFreeSize;
+    }
+#endif
+    return (totalFreeSize);
+}
+
diff --git a/packages/ti/drv/cal/include/cal_cfg.h b/packages/ti/drv/cal/include/cal_cfg.h
new file mode 100755 (executable)
index 0000000..11e0ed8
--- /dev/null
@@ -0,0 +1,809 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2018
+ *
+ *  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 cal_cfg.h
+ *
+ *  \brief  Defines the structures / control operations that could be used to
+ *              configure / control CAL module
+ */
+
+/**
+ *  \ingroup CAL_DRV_COMMON_API
+ *  \addtogroup CAL_DRV_COMMON_CAPTURE_CAL - CAL Config API
+ *
+ *  @{
+ */
+
+#ifndef CAL_CFG_H_
+#define CAL_CFG_H_
+
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ========================================================================== */
+/*                                   Macros                                   */
+/* ========================================================================== */
+
+/** \brief Number of queue length per capture channel in capture driver */
+#define CAL_CAPT_QUEUE_LEN_PER_CH       (16U)
+
+/** \brief Defines the total number of complex IO available per CAL (1) */
+#if defined (SOC_AM65XX)
+#define CAL_CAPT_MAX_CMPLXIO_INST       (1U)
+#endif
+
+/** \brief Defines total number of pixel processing context available */
+#define CAL_CAPT_MAX_PIX_PROC_CONTEXT   (4U)
+
+/** \brief Defines the total number of DMA writes that are possible per CAL
+**/
+#define CAL_CAPT_MAX_STREAMS            (8U)
+
+/** \brief Defines the total number error interrupts
+**/
+#define CAL_CAPT_MAX_ERROR_INTERRUPTS   (20U)
+
+/** \brief Defines the total number of VC, for which a callback can be issued
+ *          on reception of X lines.
+**/
+#define CAL_CAPT_MAX_X_LINE_MONITOR_CNT (1U)
+
+/** \brief Log enable for CAL modules. */
+#define CalTrace                        (GT_INFO | GT_TraceState_Enable)
+
+/**
+ *  struct Cal_CaptInstId
+ *  \brief Different instances of capture. As name suggests, each instance is
+ *          associated with a particular method of capture. Multiple instances
+ *          can co-exist, provided co-existence is supported in the h/w.
+ *
+ *  \warning Deviation from naming convention: To enable backward compatibility
+ *
+ */
+typedef enum Cal_CaptInstId
+{
+    CAL_CAPT_INST_ID_A_ID = 0U,
+    /**< Capture CSI2 streams via CAL. Requires to be first enum.
+     *      This is requires to start with 0x0. Used an index internally in
+     *      core */
+    CAL_CAPT_INST_ID_A_CPI = 1U,
+    /**< Capture From CPI - Via VPORT of IPIPEIF. Essentially via Parallel OR
+     *      LVDS input which are interfaced to CPI port. */
+    CAL_CAPT_INST_ID_MAX = 2U,
+    /**< Enum end marker */
+    CAL_CAPT_INST_ID_FORCE_INT = 0x7FFFFFFF
+                        /**< This will ensure enum is not packed,
+                         *      will always be contained in int */
+} Cal_CaptInstId_t;   /**< Cal_CaptInstId_t */
+
+
+/**
+ *  enum Cal_CaptSubModuleId
+ *  \brief Different sub-modules with in the CAL block.
+ *
+ *  \warning Deviation from naming convention: To enable backward compatibility
+ *
+ */
+typedef enum Cal_CaptSubModuleId
+{
+    CAL_CAPT_INST_ID_SUB_MIN_ID = 0x000,
+    /**< Begin marker */
+    CAL_CAPT_INST_ID_SUB_PPI_ID_0 = 0x001,
+    /**< PPI Interface, one per instance  */
+    CAL_CAPT_INST_ID_SUB_PIX_EXTRACT_ID = 0x002,
+    /**< Pixel extract */
+    CAL_CAPT_INST_ID_SUB_DPCM_DEC_ID = 0x004,
+    /**< DPCM Decode */
+    CAL_CAPT_INST_ID_SUB_DPCM_ENC_ID = 0x008,
+    /**< DPCM Encode */
+    CAL_CAPT_INST_ID_SUB_PIX_PACK_ID = 0x010,
+    /**< Pixel packing */
+    CAL_CAPT_INST_ID_SUB_BYS_OUT_ID = 0x020,
+    /**< BYS Out */
+    CAL_CAPT_INST_ID_SUB_BYS_IN_ID = 0x040,
+    /**< BYS IN */
+    CAL_CAPT_INST_ID_SUB_VPORT_ID = 0x080,
+    /**< BYS IN */
+    CAL_CAPT_INST_ID_SUB_DMA_RD_ID = 0x100,
+    /**< DMA Read */
+    CAL_CAPT_INST_ID_SUB_DMA_WR_ID = 0x200,
+    /**< DMA Write */
+    CAL_CAPT_INST_ID_SUB_CSI2_ID = 0x400,
+    /**< cport ID */
+    CAL_CAPT_INST_ID_SUB_CPORT_ID = 0x800,
+    /**< cport ID */
+    CAL_CAPT_INST_ID_SUB_LVDS_ID = 0x1000,
+    /**< LVDS Port ID */
+    CAL_CAPT_INST_ID_SUB_CPI_ID = 0x2000,
+    /**< CPI / Parallel interface */
+    CAL_CAPT_INST_ID_SUB_PPI_ID_1 = 0x3000,
+    /**< PPI Interface, one per instance  */
+    CAL_CAPT_INST_ID_SUB_MAX = 0x3001,
+    /**< Enum end marker */
+    CAL_CAPT_INST_ID_SUB_FORCE_INT = 0x7FFFFFFF
+                                /**< This will ensure enum is not packed,
+                                 *      will always be contained in int */
+} Cal_CaptSubModuleId_t;   /**< Cal_CaptSubModuleId_t */
+
+/**
+ *  enum Cal_Csi2DataFormat
+ *  \brief CSI2 Data types.
+ *
+ */
+typedef enum
+{
+    CAL_CSI2_YUV420_8B = 0x18,
+    /**< YUV 4:2:0 with 8bit for each Y/U/V */
+    CAL_CSI2_YUV420_10B = 0x19,
+    /**< YUV 4:2:0 with 10bit for each Y/U/V */
+    CAL_CSI2_YUV420_8B_LEGACY = 0x1A,
+    /**< YUV 4:2:0 with 8bit for each Y/U/V */
+    CAL_CSI2_YUV420_8B_CHROMA_SHIFT = 0x1C,
+    /**< YUV 4:2:0 with 8bit for each Y/U/V with
+     *   with phase shifted chroma */
+    CAL_CSI2_YUV420_10B_CHROMA_SHIFT = 0x1D,
+    /**< YUV 4:2:0 with 10bit for each Y/U/V with
+     *   with phase shifted chroma */
+    CAL_CSI2_YUV422_8B = 0x1E,
+    /**< YUV 4:2:2 with 8bit for each Y/U/V */
+    CAL_CSI2_YUV422_10B = 0x1F,
+    /**< YUV 4:2:2 with 10bit for each Y/U/V */
+    CAL_CSI2_RGB444 = 0x20,
+    /**< RGB888 - 4-bits B, 4-bits G, 4-bits R */
+    CAL_CSI2_RGB555 = 0x21,
+    /**< RGB888 - 5-bits B, 5-bits G, 5-bits R */
+    CAL_CSI2_RGB565 = 0x22,
+    /**< RGB888 - 5-bits B, 6-bits G, 5-bits R */
+    CAL_CSI2_RGB666 = 0x23,
+    /**< RGB888 - 6-bits B, 6-bits G, 6-bits R */
+    CAL_CSI2_RGB888 = 0x24,
+    /**< RGB888 - 8-bits B, 8-bits G, 8-bits R */
+    CAL_CSI2_RAW6 = 0x28,
+    /**< 6 bit raw-data. */
+    CAL_CSI2_RAW7 = 0x29,
+    /**< 7 bit raw-data. */
+    CAL_CSI2_RAW8 = 0x2A,
+    /**< 8 bit raw-data. */
+    CAL_CSI2_RAW10 = 0x2B,
+    /**< 10 bit raw-data. */
+    CAL_CSI2_RAW12 = 0x2C,
+    /**< 12 bit raw-data. */
+    CAL_CSI2_RAW14 = 0x2D,
+    /**< 14 bit raw-data. */
+    CAL_CSI2_ANY = 0x01,
+    /**< Allow any data type for capture */
+    CAL_CSI2_DISABLE_CONTEXT = 0x00
+    /**< Disable capture. */
+} Cal_Csi2DataFormat;
+
+/**
+ *  enum Cal_PixExtract
+ *  \brief Valid pixel extraction supported, control extraction of "word" from
+ *          byte stream.
+ *
+ */
+typedef enum Cal_PixExtract
+{
+    CAL_PIX_EXRCT_MIN = 0,
+    /**< Begin Marker */
+    CAL_PIX_EXRCT_B6,
+    /**< 6 bits represent a word */
+    CAL_PIX_EXRCT_B7,
+    /**< 7 bits represent a word */
+    CAL_PIX_EXRCT_B8,
+    /**< 8 bits represent a word */
+    CAL_PIX_EXRCT_B10_LINEAR,
+    /**< 10 bits represent a word */
+    CAL_PIX_EXRCT_B10_MIPI,
+    /**< 10 bits represent a word */
+    CAL_PIX_EXRCT_B12_LINEAR,
+    /**< 12 bits represent a word */
+    CAL_PIX_EXRCT_B12_MIPI,
+    /**< 12 bits represent a word */
+    CAL_PIX_EXRCT_B14_LINEAR,
+    /**< 14 bits represent a word */
+    CAL_PIX_EXRCT_B14_MIPI,
+    /**< 14 bits represent a word */
+    CAL_PIX_EXRCT_B16_BE,
+    /**< 16 bits represent a word, big endian */
+    CAL_PIX_EXRCT_B16_LE,
+    /**< BYPASS - Extraction / 16 bits represent a word, little endian */
+    CAL_PIX_EXRCT_MAX
+    /**< End Marker */
+} Cal_PixExtract_t; /**< Cal_PixExtract_t */
+
+/**
+ *  enum Cal_PixDpcmDecoder
+ *  \brief Valid de-compression methods supported.
+ *
+ */
+typedef enum Cal_PixDpcmDecoder
+{
+    CAL_DPCM_DEC_BYPASS = 0x0U,
+    /**< BY PASS mode */
+    CAL_DPCM_DEC_10_8_10_1 = 0x2U,
+    /**< 10_8_10_1 decode */
+    CAL_DPCM_DEC_10_7_10_1 = 0x4U,
+    /**< 10_7_10_1 */
+    CAL_DPCM_DEC_10_7_10_2 = 0x5U,
+    /**< 10_7_10_1 decode */
+    CAL_DPCM_DEC_10_6_10_1 = 0x6U,
+    /**< 10_6_10_1 decode */
+    CAL_DPCM_DEC_10_6_10_2 = 0x7U,
+    /**< 10_6_10_2 decode */
+    CAL_DPCM_DEC_12_8_12_1 = 0x8U,
+    /**< 12_8_12_1, decode */
+    CAL_DPCM_DEC_12_7_12_1 = 0xAU,
+    /**< 12_7_12_1, decode */
+    CAL_DPCM_DEC_12_6_12_1 = 0xCU,
+    /**< 12_6_12_1 decode */
+    CAL_DPCM_DEC_14_10_14 = 0xEU,
+    /**< 14_10_14 decode */
+    CAL_DPCM_DEC_14_8_14_1 = 0x10U,
+    /**< 14_8_14_1 decode */
+    CAL_DPCM_DEC_16_12_16_1 = 0x12U,
+    /**< 16_12_16_1 decode */
+    CAL_DPCM_DEC_16_10_16_1 = 0x14U,
+    /**< 16_10_16_1 decode */
+    CAL_DPCM_DEC_16_8_16_1 = 0x16U,
+    /**< 16_8_16_1 decode */
+    CAL_DPCM_DEC_MAX = 0x17U
+    /**< End marker */
+} Cal_PixDpcmDecoder_t;    /**< Cal_PixDpcmDecoder_t */
+
+/**
+ *  enum Cal_PixDpcmEncoder
+ *  \brief Valid compression methods supported.
+ *
+ */
+typedef enum Cal_PixDpcmEncoder
+{
+    CAL_DPCM_ENC_BYPASS = 0,
+    /**< Encoder bypassed */
+    CAL_DPCM_ENC_10_8_10_1 = 0x02U,
+    /**< 10-8-10 Predictor 1 */
+    CAL_DPCM_ENC_12_8_12_1 = 0x08U,
+    /**< 12-8-12 Predictor 1 */
+    CAL_DPCM_ENC_14_10_14 = 0x0EU,
+    /**< 14-10-14 Predictor 1 */
+    CAL_DPCM_ENC_14_8_14_1 = 0x10U,
+    /**< 14-8-14 Predictor 1 */
+    CAL_DPCM_ENC_16_12_16_1 = 0x12U,
+    /**< 16-12-16 Predictor 1 */
+    CAL_DPCM_ENC_16_10_16_1 = 0x14U,
+    /**< 16-10-16 Predictor 1 */
+    CAL_DPCM_ENC_16_8_16_1 = 0x16U,
+    /**< 16-8-16 Predictor 1 */
+    CAL_DPCM_ENC_MAX = 0x17U
+    /**< End marker */
+} Cal_PixDpcmEncoder_t;    /**< Cal_PixDpcmEncoder_t */
+
+/**
+ *  enum Cal_PixPack
+ *  \brief Valid pixel packing supported.
+ *
+ */
+typedef enum Cal_PixPack
+{
+    CAL_PIX_PACK_B8 = 0,
+    /**< 8 bit packing */
+    CAL_PIX_PACK_B10_MIPI = 0x2U,
+    /**< 10 bit mipi packing */
+    CAL_PIX_PACK_B12 = 0x3U,
+    /**< 12 bit packing */
+    CAL_PIX_PACK_B12_MIPI = 0x4U,
+    /**< 12 bit mipi packing */
+    CAL_PIX_PACK_B16 = 0x5U,
+    /**< 16 bit packing */
+    CAL_PIX_PACK_ARGB = 0x6U,
+    /**< ARGB packing, 8 x 3 packing, followed by 8 bit padding */
+    CAL_PIX_PACK_MAX = 0x7U
+    /**< End Marker */
+} Cal_PixPack_t;   /**< Cal_PixPack_t */
+
+/**
+ *  enum Cal_StreamType
+ *  \brief Identifies different types streams.
+ *
+ */
+typedef enum Cal_StreamType
+{
+    CAL_TAG_ATT_HDR = 0,
+    /**< Attribute packet headers */
+    CAL_TAG_ATT_DATA,
+    /**< Attribute data */
+    CAL_TAG_CTRL,
+    /**< Control packets */
+    CAL_TAG_PIX_HDR,
+    /**< Pixel packet data headers */
+    CAL_TAG_PIX_DATA,
+    /**< Pixel Data */
+    CAL_TAG_MAX
+    /**< End marker */
+} Cal_StreamType_t; /**< Cal_StreamType_t */
+
+/**
+ *  \brief Lists the possible error source in CAL reception. Applications
+ *          could enable any of these and attach a function to be called on
+ *          error (s)
+ *          When enabled, the frame would marked with appropriate error code
+ *          to indicate an issue.
+ *
+ *  \warning If any elements are added/deleted from this structure, ensure to
+ *              update CAL_CAPT_MAX_ERROR_INTERRUPTS
+ */
+typedef enum Cal_ErrorSource
+{
+    /* Following events correspond to IEM_CAL_EVENT_PPIO */
+    CAL_CSI2_PPI_CMPLXIO_ERRSOTHS1 = 0,
+    /**< Not supported for now ! */
+    CAL_CSI2_PPI_CMPLXIO_FIFO_OVR = 27,
+    /**< Event triggered when CAL un able to process the received data.
+            Typically down stream modules (including write DMA) is unable to
+            keep up with the speed of reception of data. */
+    CAL_CSI2_PPI_CMPLXIO_ECC_NO_CORRECTION = 30,
+    /**< ECC module was unable to correct, as there were more than 1 bit errors.
+            Applicable for all virtual channels */
+    CAL_CSI2_PPI_CMPLXIO_RSERVED_31 = 31,
+    /**< Reserved event, will be used for boundary checks */
+
+    /* Following events correspond to IEM_CAL_EVENT_PPIO_VC */
+    CAL_CSI2_PPI_VC_SOF1 = 128 + 0,
+    /**< Not an error, Will be used for boundary checks / debug. */
+    CAL_CSI2_PPI_VC_CRC_MISMATCH_VC1 = 128 + 4,
+    /**< CRC did not match, the frame could be BAD */
+    CAL_CSI2_PPI_VC_ECC_CORRECTION_VC1 = 128 + 5,
+    /**< ECC module was able to correct 1 bit error */
+    CAL_CSI2_PPI_VC_SOF2 = 128 + 8,
+    /**< Not an error, Will be used for boundary checks / debug. */
+    CAL_CSI2_PPI_VC_CRC_MISMATCH_VC2 = 128 + 12,
+    /**< CRC did not match, the frame could be BAD */
+    CAL_CSI2_PPI_VC_ECC_CORRECTION_VC2 = 128 + 13,
+    /**< ECC module was able to correct 1 bit error */
+    CAL_CSI2_PPI_VC_SOF3 = 128 + 16,
+    /**< Not an error, Will be used for boundary checks / debug. */
+    CAL_CSI2_PPI_VC_CRC_MISMATCH_VC3 = 128 + 20,
+    /**< CRC did not match, the frame could be BAD */
+    CAL_CSI2_PPI_VC_ECC_CORRECTION_VC3 = 128 + 21,
+    /**< ECC module was able to correct 1 bit error */
+    CAL_CSI2_PPI_VC_SOF4 = 128 + 24,
+    /**< Not an error, Will be used for boundary checks / debug. */
+    CAL_CSI2_PPI_VC_CRC_MISMATCH_VC4 = 128 + 28,
+    /**< CRC did not match, the frame could be BAD */
+    CAL_CSI2_PPI_VC_ECC_CORRECTION_VC4 = 128 + 29,
+    /**< ECC module was able to correct 1 bit error */
+    CAL_CSI2_PPI_VC_RESERVED_31 = 128 + 31,
+    /**< Reserved event, will be used for boundary checks */
+
+    CAL_BYSIN_OVR = CAL_CSI2_PPI_VC_RESERVED_31 + 1,
+    /**< When CAL is used to receive via BYS IN (Parallel input) and the down
+            stream modules could not keep up with the incoming data rate, the
+            BYS IN port could overflow. */
+    CAL_CSI2_FORCE_INT = 0x7FFFFFFF
+    /**< This will ensure enum is not packed,
+     *      will always be contained in int
+     */
+} Cal_ErrorSource_t; /**< Cal_ErrorSource_t */
+
+/* ========================================================================== */
+/*                                 Function Types                             */
+/* ========================================================================== */
+/**
+ *  \brief Defines expected function type that could be called by drivers on
+ *          error conditions. Please refer driver specific header files on
+ *          methods to attach callbacks on errors.
+ *
+ *  \param  event       Pointer to an array that holds event (s) that have
+ *                          occurred. The numEvents determine the number of
+ *                          elements that could accessed.
+ *  \param  numEvents   Number of events (error conditions) that were detected.
+ *  \param  arg         Argument provided while configuring the error parameters
+ */
+typedef void (*Cal_ErrorCallBack)(const uint32_t *event,
+                                  uint32_t        numEvents,
+                                  void           *arg);
+
+/* ========================================================================== */
+/*                         Structure Declarations                             */
+/* ========================================================================== */
+
+/**
+ *  \brief Resources allocated instances. 0xFFFFFFFF in case not allocated.
+ *          Otherwise valid instance number
+ *
+ *  \warning Deviation from naming convention: To enable backward compatibility
+ *
+ */
+typedef struct Cal_CaptBlocks
+{
+    uint32_t ppi0Inst;
+    /**< PPI interface instance,  0xFFFFFFFF in case not allocated. Otherwise
+     *      valid instance number */
+    uint32_t ppi1Inst;
+    /**< PPI Instace 1 */
+    uint32_t pixExtract;
+    /**< Pixel Extract instance */
+    uint32_t dpmDecode;
+    /**< DPM Decode instance */
+    uint32_t dpmEncode;
+    /**< DPM Encode instance */
+    uint32_t pixPack;
+    /**< Pixel Pack instance */
+    uint32_t bysOut;
+    /**< BYS Out instance */
+    uint32_t bysIn;
+    /**< BYS IN instance */
+    uint32_t vPort;
+    /**< VPORT IN instance */
+    uint32_t rdDma;
+    /**< RD Dma instance */
+    uint32_t wrDma;
+    /**< WR Dma instance */
+    uint32_t csi2Ctx;
+    /**< CSI2 processing context */
+    uint32_t cport;
+    /**< CPort ID */
+    uint32_t lvds;
+    /**< LVDS port */
+    uint32_t cpi;
+    /**< Parallel / CPI port */
+} Cal_CaptBlocks_t;
+
+/**
+ *  struct Cal_CmplxIoLaneCfg
+ *  \brief Configure the position and order of lane for the complex IO.
+ *
+ */
+typedef struct Cal_CmplxIoLaneCfg
+{
+    uint32_t pol;
+    /**< TRUE configures for - / + order of differential signal.
+     + / - order otherwise */
+    uint32_t position;
+    /**< Specify if this lane is to be used, if so, on which position.
+     *  0x0 - Not used / disabled lane
+     *  0x1 - Position 1
+     *  0x2 - Position 2
+     *  0x3 - Position 3
+     *  0x4 - Position 4
+     *  0x5 - Position 5 */
+} Cal_CmplxIoLaneCfg_t;
+
+/**
+ *  struct Cal_CmplxIoCfg
+ *  \brief Configure complex IO.
+ *
+ */
+typedef struct Cal_CmplxIoCfg
+{
+    uint32_t             enable;
+    /**< FALSE disables, otherwise indicates the instance to be used. Valid
+     *  values are 1 and 2 */
+    Cal_CmplxIoLaneCfg_t clockLane;
+    /**< Configure position and order of differential signal */
+    Cal_CmplxIoLaneCfg_t data1Lane;
+    /**< Configure position and order of differential signal */
+    Cal_CmplxIoLaneCfg_t data2Lane;
+    /**< Configure position and order of differential signal */
+    Cal_CmplxIoLaneCfg_t data3Lane;
+    /**< Configure position and order of differential signal */
+    Cal_CmplxIoLaneCfg_t data4Lane;
+    /**< Configure position and order of differential signal */
+    uint32_t             pwrAuto;
+    /**< Auto power control mode of complex IO. TRUE configures it to enable
+     *  auto power mode (in which power switches to ON / OFF based on ULP / ULPM
+     *  commands from the sensor.
+     *  Always powered on otherwise */
+} Cal_CmplxIoCfg_t;
+
+/**
+ *  struct Cal_PixProc
+ *  \brief CAL Pixel Processing configuration control.
+ */
+typedef struct Cal_PixProc
+{
+    Cal_PixExtract_t     extract;
+    /**< Configure bit extraction */
+    Cal_PixDpcmDecoder_t decCodec;
+    /**< Decoder required */
+    uint32_t             enableDpcmInitContext;
+    /**< TRUE configure DPCM Decode to loaded from a specific memory location*/
+    uint32_t             addr;
+    /**< Address of word describing DPCM init context. Should be 16 bytes
+     *      aligned */
+    uint32_t             offSet;
+    /**< Address offset for UV data, when data type if YUV420 */
+
+    Cal_PixDpcmEncoder_t encCodec;
+    /**< Encoder required */
+    Cal_PixPack_t        pack;
+    /**< Packing required */
+
+    uint32_t             contextToBeUsed;
+    /**< RESERVED - Internal to driver. Value specified here is ignored.
+     *      Context of pixel processing to be used. */
+} Cal_PixProc_t;
+
+/**
+ *  struct Cal_BysOut
+ *  \brief CAL BYS Out configuration control.
+ */
+typedef struct Cal_BysOut
+{
+    uint32_t enable;
+    /**< TRUE, enables stream on BYS Out */
+    uint32_t pixClock;
+    /**< Configure the pixel clock required. A non zero value will ensure that
+     *      BYS ports pixel clock will be gated when idle. */
+    uint32_t yBlk;
+    /**< Configure the Y Blank to be inserted at end of frame */
+    uint32_t xBlk;
+    /**< Configures the X blank to be inserted at end of line */
+    uint32_t copyStreamToEncode;
+    /**< TRUE configures, streams sent out on BYS out to be copied into encode*/
+    uint32_t freeRun;
+    /**< TRUE configures Bys out in Free running mode, False gated in idle */
+} Cal_BysOut_t;
+
+/**
+ *  struct Cal_VPort
+ *  \brief CAL Video Port configuration control.
+ */
+typedef struct Cal_VPort
+{
+    uint32_t enable;
+    /**< TRUE, enables stream on Video Port input */
+    uint32_t pixClock;
+    /**< Configure the pixel clock required.
+     *      When disabled pixlClock will be 0x0. */
+    uint32_t width;
+    /**< 0, indicates 1 pixel / clock cycle. Else 2 pixels / clock cycle */
+    uint32_t yBlk;
+    /**< Configure the Y Blank to be inserted at end of frame */
+    uint32_t xBlk;
+    /**< Configures the X blank to be inserted at end of line */
+    uint32_t rdyThr;
+    /**< Configure the initial threashold value, before the first pixel is
+     *  recevied and passed for furthure proessing */
+    uint32_t fsReset;
+    /**< TRUE ReSet the timing generator FSM on every end of frame received,
+     *      otherwise data processed normally */
+    uint32_t freeRun;
+    /**< TRUE enables the pixel clock during idle period. FALSE gates the same.
+     */
+} Cal_VPort_t;
+
+/**
+ *  struct Cal_Cfg
+ *  \brief CAL config, used to control all the sub-modules of CAL.
+ *
+ *  \attention  Ensure to allocate before trying to configure.
+ *              There is only one instance of BYSOUT, BYSIN and VPORT and hence
+ *                  can support only 1 channel. When these are used for
+ *                  multiple channels, the last config is valid
+ *
+ *  \attention When non-CSI2 streams are being captured, following members
+ *              are not applicable, stream, csi2VirtualChanNo, pixProcCfg &
+ *              bysOutCfg.
+ */
+typedef struct Cal_Cfg
+{
+    uint32_t numStream;
+    /**< Specify the number of streams that requires to be configured. Minimum
+     *      should be 1 and maximum could be CAL_CAPT_MAX_STREAMS */
+    uint32_t            streamId[CAL_CAPT_MAX_STREAMS];
+    /**< Specify the stream ID, that requires to be configured.
+     *      e.g. If first stream requires to be configured
+     *      \code numStream = 1U;
+     *            streamId[0] = 0U;
+     *            inFmt[0].width = 1280U;
+     *            inFmt[0].width = 800U;
+     *      etc...
+     *      e.g. if there are 3 streams and require to configure 2 of them, say
+     *              stream 2 and 0
+     *            numStream = 2U;
+     *            streamId[0] = 0U;
+     *            inFmt[0].width = 1280U;
+     *            inFmt[0].width = 800U;
+     *            streamId[1] = 2U;
+     *            inFmt[1].width = 1280U;
+     *            inFmt[1].width = 720U; \endcode */
+    Fvid2_Format        inFmt[CAL_CAPT_MAX_STREAMS];
+    /**< Specify the characteristics of streams that has to be received.
+     *      Valid member of this structure are
+     *      .width  - specify the width if known, else 0x0.
+     *                  WARNING - Sufficient buffer should be allocated to
+     *                      accommodate max line length.
+     *      .height - expected number of lines, 0x0 for unknown
+     *                  WARNING - Sufficient buffer should be allocated to
+     *                      accommodate max lines.
+     *      .pitch  - pitch
+     *      .bpp    - Bits per pixel #Fvid2_BitsPerPixel
+     *      .dataFormat - dataformat as per #Fvid2_DataFormat
+     *                      \attention In case of CSI2 streams, this is not
+     *                      valid. Please use #csi2DataFormat */
+    Cal_StreamType_t    streamType[CAL_CAPT_MAX_STREAMS];
+    /**< Applicable when capturing via CSI2 interface only.
+     *      Specify the streams that required to be captured */
+    Cal_Csi2DataFormat  csi2DataFormat[CAL_CAPT_MAX_STREAMS];
+    /**< Applicable when capturing via CSI2 interface only.
+     *      Specify the streams data format */
+    uint32_t            csi2VirtualChanNo[CAL_CAPT_MAX_STREAMS];
+    /**< Applicable when capturing via CSI2 interface only.
+     *      Specify the virtual channel number to be used. Valid rage 0 - 3 */
+    uint32_t            isPixProcCfgValid[CAL_CAPT_MAX_STREAMS];
+    /**< TRUE indicates valid pixel processing config, otherwise invalid config
+     *      not used. */
+    Cal_PixProc_t       pixProcCfg[CAL_CAPT_MAX_STREAMS];
+    /**< Configure pixel processing contexts. There are 4 pixel processing
+     *      contexts available. */
+
+    /* NOTE there is one instance of BYS Out, BYS In and Video Port.
+     *  At any point only one configuration should be valid, otherwise, the last
+     *  config would be active. */
+    uint32_t            isBysOutCfgValid[CAL_CAPT_MAX_STREAMS];
+    /**< TRUE indicates valid BYS Out config, otherwise invalid config
+     *        not used. */
+    Cal_BysOut_t        bysOutCfg[CAL_CAPT_MAX_STREAMS];
+    /**< Configure BYS Out */
+
+    uint32_t            bysInEnable[CAL_CAPT_MAX_STREAMS];
+    /**< Configure BYS In. */
+
+    uint32_t            isVportCfgValid[CAL_CAPT_MAX_STREAMS];
+    /**< TRUE indicates valid Video Port In config, otherwise invalid config
+     *        not used. */
+    Cal_VPort_t         vportCfg[CAL_CAPT_MAX_STREAMS];
+    /**< Configure Video Port */
+
+    uint32_t            writeToMem[CAL_CAPT_MAX_STREAMS];
+    /**< TRUE indicates that the captured stream should be written to memory.
+     *      \attention Note that a stream could not be duplicated, e.g. if
+     *          you require to send out a stream via VPORT and also to write
+     *          into memory, its not possible. */
+
+    uint32_t            cmplxIoId[CAL_CAPT_MAX_STREAMS];
+    /**< PPI Instance to be used for this stream,
+         Must be less than CAL_CAPT_MAX_CMPLXIO_INST&