Adding TCI6498 support in RM sample init lib
[keystone-rtos/edma3_lld.git] / packages / ti / sdo / edma3 / rm / sample / bios6_edma3_rm_sample.h
old mode 100644 (file)
new mode 100755 (executable)
index 3ffcfe4..6d9e15d
@@ -1,46 +1,40 @@
-/*******************************************************************************
-**+--------------------------------------------------------------------------+**
-**|                            ****                                          |**
-**|                            ****                                          |**
-**|                            ******o***                                    |**
-**|                      ********_///_****                                   |**
-**|                      ***** /_//_/ ****                                   |**
-**|                       ** ** (__/ ****                                    |**
-**|                           *********                                      |**
-**|                            ****                                          |**
-**|                            ***                                           |**
-**|                                                                          |**
-**|         Copyright (c) 1998-2006 Texas Instruments Incorporated           |**
-**|                        ALL RIGHTS RESERVED                               |**
-**|                                                                          |**
-**| Permission is hereby granted to licensees of Texas Instruments           |**
-**| Incorporated (TI) products to use this computer program for the sole     |**
-**| purpose of implementing a licensee product based on TI products.         |**
-**| No other rights to reproduce, use, or disseminate this computer          |**
-**| program, whether in part or in whole, are granted.                       |**
-**|                                                                          |**
-**| TI makes no representation or warranties with respect to the             |**
-**| performance of this computer program, and specifically disclaims         |**
-**| any responsibility for any damages, special or consequential,            |**
-**| connected with the use of this program.                                  |**
-**|                                                                          |**
-**+--------------------------------------------------------------------------+**
-*******************************************************************************/
-
-/** \file   bios6_edma3_rm_sample.h
-
-    \brief Header file for the Demo application for the EDMA3 Resource Manager.
-
-    (C) Copyright 2006, Texas Instruments, Inc
-
-    \version    1.0   Anuj Aggarwal         - Created
-                1.1   Anuj Aggarwal         - Made the sample app generic
-                                            - Removed redundant arguments
-                                              from Cache-related APIs
-                                            - Added new function for Poll mode
-                                              testing
-
- */
+/*
+ * bios6_edma3_rm_sample.h
+ *
+ * Header file for the Demo application for the EDMA3 Resource Manager.
+ *
+ * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  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.
+ *
+*/
 
 #ifndef _BIOS6_EDMA3_RM_SAMPLE_H_
 #define _BIOS6_EDMA3_RM_SAMPLE_H_
@@ -62,21 +56,52 @@ extern "C" {
 #endif /* EDMA3_DEBUG_PRINT */
 
 /**
- * \brief SoC specific TC related information. Specified in the sample
- * configuration file (bios_edma3_sample_cfg.c).
+ * Cache line size on the underlying SoC. It needs to be modified
+ * for different cache line sizes, if the Cache is Enabled.
  */
-extern unsigned int numEdma3Tc;
-extern unsigned int ccXferCompInt;
-extern unsigned int ccErrorInt;
-extern unsigned int tcErrorInt[8];
+#define EDMA3_CACHE_LINE_SIZE_IN_BYTES      (128u)
+
+/* Error returned in case of buffers are not aligned on the cache boundary */
+#define EDMA3_NON_ALIGNED_BUFFERS_ERROR     (-1)
 
-extern unsigned int hwIntXferComp;
-extern unsigned int hwIntCcErr;
-extern unsigned int hwIntTcErr;
+/* Error returned in case of data mismatch */
+#define EDMA3_DATA_MISMATCH_ERROR           (-2)
 
-EDMA3_RM_Result edma3init();
-EDMA3_RM_Result edma3deinit();
+/**
+ * \brief   EDMA3 Initialization
+ *
+ * This function initializes the EDMA3 Resource Manager for the given EDMA3 controller
+ * and opens a EDMA3 RM instance. It internally calls EDMA3_RM_create() and
+ * EDMA3_RM_open(), in that order.
+ *
+ * It also registers interrupt handlers for various EDMA3 interrupts like 
+ * transfer completion or error interrupts.
+ *
+ *  \param  edma3Id    [IN]            EDMA3 Controller Instance Id (Hardware
+ *                                                                     instance id, starting from 0)
+ *  \param  errorCode  [IN/OUT]        Error code while opening RM instance
+ *  \return EDMA3_RM_Handle: If successfully opened, the API will return the
+ *                            associated RM's instance handle.
+ */
+EDMA3_RM_Handle edma3init (unsigned int edma3Id, EDMA3_RM_Result *errorCode);
 
+/**
+ * \brief   EDMA3 De-initialization
+ *
+ * This function de-initializes the EDMA3 RM for the given EDMA3 controller
+ * and closes the previously opened EDMA3 RM instance. It internally calls 
+ * EDMA3_RM_close and EDMA3_RM_delete(), in that order.
+ *
+ * It also un-registers the previously registered interrupt handlers for various 
+ * EDMA3 interrupts.
+ *
+ *  \param  edma3Id    [IN]            EDMA3 Controller Instance Id (Hardware
+ *                                                                     instance id, starting from 0)
+ *  \param  hEdma              [IN]            EDMA3 RM handle, returned while using
+ *                                                                     edma3init().
+ *  \return  EDMA3_RM_SOK if success, else error code
+ */
+EDMA3_RM_Result edma3deinit (unsigned int edma3Id, EDMA3_RM_Handle hEdma);
 
 /**
  * Counting Semaphore related functions (OS dependent) should be
@@ -101,8 +126,6 @@ EDMA3_RM_Result edma3OsSemCreate(int initVal,
                                                        const Semaphore_Params *semParams,
                                EDMA3_OS_Sem_Handle *hSem);
 
-
-
 /**
  * \brief   EDMA3 OS Semaphore Delete
  *