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