1    /*
     2     *  Copyright 2013 by Texas Instruments Incorporated.
     3     *
     4     */
     5    
     6    /*
     7     * Copyright (c) 2012 - 2013, Texas Instruments Incorporated
     8     * All rights reserved.
     9     *
    10     * Redistribution and use in source and binary forms, with or without
    11     * modification, are permitted provided that the following conditions
    12     * are met:
    13     *
    14     * *  Redistributions of source code must retain the above copyright
    15     *    notice, this list of conditions and the following disclaimer.
    16     *
    17     * *  Redistributions in binary form must reproduce the above copyright
    18     *    notice, this list of conditions and the following disclaimer in the
    19     *    documentation and/or other materials provided with the distribution.
    20     *
    21     * *  Neither the name of Texas Instruments Incorporated nor the names of
    22     *    its contributors may be used to endorse or promote products derived
    23     *    from this software without specific prior written permission.
    24     *
    25     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    26     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    27     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    28     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    29     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    30     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    31     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    32     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    33     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    34     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    35     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    36     *
    37     */
    38    /*!
    39     *  ======== HDVICP2 ========
    40     *  HDVICP2-specific IRES Resman and Protocol Implementation
    41     *
    42     */
    43    @Template("./HDVICP2.xdt")
    44    
    45    metaonly module HDVICP2 inherits ti.sdo.fc.ires.IRESMAN {
    46    
    47        const Int MAXRESOURCES = 10;  /*! Maximum number of HDVICP2 resources
    48                                          this module can manage. */
    49        /*!
    50         *  ======= memoryBaseAddress =======
    51         *
    52         */
    53        config UInt memoryBaseAddress[MAXRESOURCES];
    54    
    55        /*!
    56         *  ======= resetControlAddress =======
    57         *
    58         */
    59        config UInt resetControlAddress[MAXRESOURCES];
    60    
    61    
    62        /*!
    63         *  =======  registerBaseAddress =======
    64         *  Base-address of the IVA-HD register space
    65         *
    66         */
    67        config UInt registerBaseAddress[MAXRESOURCES];
    68    
    69        /*!
    70         *  ======= configureFxn =======
    71         *  Function to configure the interrupt associated with the IVAHD and
    72         *  register a callback function.
    73         *
    74         *  Function signature of callback is:
    75         *  @p(code)
    76         *  Void _cbFunction(Void * cbArgs);
    77         *
    78         *  Function signature of configure is:
    79         *  @p(code)
    80         *  XDAS_Void _configure(IALG_Handle algHandle,
    81         *          IRES_HDVICP2_Obj * hdvicpHandle,
    82         *          IRES_HDVICP2_CallbackFxn cbFunctionPtr, XDAS_Void * cbArgs);
    83         */
    84        config String configureFxn;
    85    
    86        /*!
    87         *  ======= waitFxn =======
    88         *  Function to wait on the interrupt associated with the IVAHD to fire
    89         *
    90         *  Function signature is:
    91         *  @p(code)
    92         *  XDAS_UInt32 _wait(IALG_Handle algHandle,
    93         *          IRES_HDVICP2_Obj * hdvicpHandle,
    94         *          IRES_YieldContext * yieldContext);
    95         */
    96        config String waitFxn;
    97    
    98        /*!
    99         *  ======= doneFxn =======
   100         *  Function indicating "done".
   101         *
   102         *  This is the function called from the ISR interrupt associated with
   103         *  the IVAHD to  unblock the {@link #waitFxn}.
   104         *
   105         *  Function signature is:
   106         *  @p(code)
   107         *  XDAS_Void _done(IALG_Handle algHandle, IRES_HDVICP2_Obj * hdvicpHandle);
   108         */
   109        config String doneFxn;
   110    
   111        /*!
   112         *  ======= resetFxn =======
   113         *  Function to reset the IVAHD.
   114         *
   115         *  This is a callback function implemented by the framework and called by
   116         *  the codec.
   117         *
   118         *  Function signature is:
   119         *  @p(code)
   120         *  XDAS_UInt32 _reset(IALG_Handle algHandle,
   121         *          IRES_HDVICP2_Obj * hdvicpHandle);
   122         */
   123        config String resetFxn;
   124    
   125    
   126        /*!
   127         *  ======= clearPRCMRegister =======
   128         *  Boolean value that indicates whether the PRCM register needs to be
   129         *  cleared in the default implementation of the "reset" function
   130         */
   131        config Bool clearPRCMRegister;
   132    
   133        /*!
   134         *  ======= timeout =======
   135         *  Timeout value representing "Wait forever" to be used to configure the
   136         *  {@link #timeout} configuration below.
   137         */
   138        const UInt FOREVER = -1;
   139    
   140        /*!
   141         *  ======= timeout =======
   142         * Timeout setting in microseconds, used by the "waitFxn" while waiting for      * a configured IVAHD's interrupt to fire.
   143         */
   144        config UInt timeout;
   145    
   146        /*!
   147         *  ======= delegate =======
   148         *  Package name that implements the above configure, wait, done, reset
   149         *  functions for the IVA-HD.
   150         */
   151        config String delegate;
   152    
   153        /*!
   154         *  ======== semCreateFxn ========
   155         * Function to create semaphores used by the resource manager
   156         *
   157         *  Function signature is:
   158         *  @p(code)
   159         * Void * _semCreate(Int key, Int count);
   160         */
   161        config String semCreateFxn = null;
   162    
   163        /*!
   164         *  ======== semDeleteFxn ========
   165         * Function to delete semaphores used by the resource manager
   166         *
   167         *  Function signature is:
   168         *  @p(code)
   169         *  Void _semDelete(Void * sem);
   170         */
   171        config String semDeleteFxn = null;
   172    
   173        /*!
   174         *  ======== semPendFxn ========
   175         * Function to pend on semaphores used by the resource manager
   176         *
   177         *  Function signature is:
   178         *  @p(code)
   179         *  Int _semPend(Void * sem, unsigned int timeout);
   180         */
   181        config String semPendFxn = null;
   182    
   183        /*!
   184         *  ======== semPostFxn ========
   185         * Function to post on Semaphores used by the resource manager
   186         *
   187         *  Function signature is:
   188         *  @p(code)
   189         * Void _semPost(Void * sem);
   190         */
   191        config String semPostFxn = null;
   192    
   193        /*!
   194         *  ======== ipcKeyBase ========
   195         *  Base value of keys of Linux IPC objects used by HDVICP2.
   196         *
   197         *  This applies only to Linux-based environments. The IPC objects
   198         *  created by HDVICP2 will use keys starting at this
   199         *  value, and incrementing with each new object. There are currently
   200         *  three IPC objects, so keys in the range of ipcKeyBase to ipcKeyBase + 2
   201         *  will be reserved for HDVICP. The default value of ipcKeyBase is
   202         *  ascii code for "2VDH".
   203         *
   204         *  WARNING: This value should only be changed if it conflicts with
   205         *  another IPC key in the system that cannot be changed. If this value
   206         *  is changed, all programs using HDVICP that will be run simultaneously
   207         *  must have the ipcKeyBase configured to the new value.
   208         *  @_nodoc
   209         */
   210        config UInt ipcKeyBase = 0x32564448;
   211    
   212        /*  @_nodoc */
   213        override config Bool autoRegister = true;
   214    
   215        /*
   216         *  ======== getHDVICP2Fxn ========
   217         *  Optional plug-in function that returns an IVAHD instance. If not
   218         *  provided, the default scheduler will be used
   219         *  IRES_Status (*getHDVICP2) (Int *Id, IALG_Handle alg,
   220         *          IRES_HDVICP2_Handle h);
   221         *  Note:- This API is currently experimental
   222         */
   223        /* @_nodoc */
   224        config String getHDVICP2Fxn;
   225    
   226        /*
   227         *  ======== freeHDVICP2Fxn ========
   228         *  Optional plug-in function that frees up the IVAHD instance requested.
   229         *  Is required if a non-NULL getHDVICP2Fxn is provided.
   230         *  IRES_Status (*freeHDVICP2) (Int Id, IALG_Handle alg,
   231         *          IRES_HDVICP2_Handle h);
   232         *  Note:- This API is currently experimental
   233         */
   234        /* @_nodoc */
   235        config String freeHDVICP2Fxn;
   236    
   237        /*!
   238         *  ======== yieldReleaseFxn ========
   239         */
   240        config String yieldReleaseFxn;
   241    
   242        /*!
   243         *  ======== yieldAcquireFxn ========
   244         */
   245        config String yieldAcquireFxn;
   246    
   247        /*!
   248         *  ======== getYieldArgsFxn ========
   249         */
   250        config String getYieldArgsFxn;
   251    
   252        /*!
   253         *  ======== maxHdvicp2ResetDelay ========
   254         * Maximum number of cycles to wait for HDVICP2 to reset, after a call is
   255         * issued.
   256         */
   257        config UInt maxHdvicp2ResetDelay = 1000;
   258    
   259        /*!
   260         *  ======= numHdvicp2 =======
   261         *  If catalog part does not declare peripheral information, it can be
   262         *  configured here. Number of IVAHD or HDVICP2s on this part
   263         *  @_nodoc
   264         */
   265        config UInt numHdvicp2;
   266    
   267        /*
   268         *  ======== intArray ========
   269         *  If catalog part does not declare peripheral information, it can be
   270         *  configured here. Array of length {@link #numHdvicp2}, that declares
   271         *  the interrupt numbers for each IVAHD.
   272         *  @_nodoc
   273         */
   274        config UInt intArray[8];
   275    }
   276    /*
   277     *  @(#) ti.sdo.fc.ires.hdvicp; 1, 0, 1,3; 7-23-2013 14:11:25; /db/atree/library/trees/fc/fc-t12/src/ xlibrary
   278    
   279     */
   280