1    /* 
     2     * Copyright (c) 2010, 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     *  ======== GateHWSem.xdc ========
    34     *
    35     */
    36    
    37    package ti.sdo.ipc.gates;
    38    
    39    import xdc.runtime.Error;
    40    import xdc.runtime.Assert;
    41    import xdc.runtime.IGateProvider;
    42    import xdc.runtime.Diags;
    43    import xdc.runtime.Log;
    44    
    45    import ti.sdo.ipc.interfaces.IGateMPSupport;
    46    
    47    /*!
    48     *  ======== GateHWSem ========
    49     *  Multiprocessor gate that utilizes a hardware semaphore
    50     */
    51    @ModuleStartup
    52    @InstanceInitError
    53    @InstanceFinalize
    54    
    55    module GateHWSem inherits IGateMPSupport
    56    {
    57        /*! @_nodoc */
    58        metaonly struct BasicView {
    59            Ptr     semNum;
    60            UInt    nested;
    61            String  enteredBy;      /* Which core has entered the hw sem */
    62        }
    63    
    64        /*!
    65         *  ======== rovViewInfo ========
    66         *  @_nodoc
    67         */
    68        @Facet
    69        metaonly config xdc.rov.ViewInfo.Instance rovViewInfo = 
    70            xdc.rov.ViewInfo.create({
    71                viewMap: [
    72                    ['Basic', 
    73                        {
    74                            type: xdc.rov.ViewInfo.INSTANCE,
    75                            viewInitFxn: 'viewInitBasic',
    76                            structName: 'BasicView'
    77                        }
    78                    ],
    79                ]
    80            });
    81    
    82        /*!
    83         *  ======== A_invalidParams ========
    84         *  Asserted when insufficient information is passed to {@link #open}
    85         */
    86        config Assert.Id A_invalidParams  = {
    87            msg: "A_invalidParams: Need to supply either a name or a semaphore Number"
    88        };
    89        
    90        /*!
    91         *  ======== A_invProtectionLevel ========
    92         *  Asserted when an invalid protection level is encountered
    93         */
    94        config Assert.Id A_invProtectionLevel  = {
    95            msg: "A_invProtectionLevel: Unknown level of local protection"
    96        };
    97        
    98        /*!
    99         *  ======== A_invSemNum ========
   100         *  Asserted when supplied semNum is invalid for the relevant device
   101         */
   102        config Assert.Id A_invSemNum  = {
   103            msg: "A_invSemNum: Invalid hardware semaphore number"
   104        };
   105    
   106    instance:    
   107    
   108    internal:
   109    
   110        /*! Initialize the hardware semaphore when the creator is created */
   111        Void postInit(Object *obj); 
   112    
   113        /*! Device-specific base address for HW Semaphore subsystem */
   114        config Ptr baseAddr;
   115        
   116        /*! Device-specific query offset for HW Semaphore subsystem (for ROV) */
   117        config Ptr queryAddr;
   118        
   119        /*! Device-specific number of semphores in the HW Semaphore subsystem */
   120        config UInt numSems;
   121    
   122        struct Instance_State {
   123            UInt                     semNum;    /* The sem number being used */
   124            UInt                     nested;    /* For nesting */        
   125            IGateProvider.Handle     localGate;
   126        };
   127    }
   128    /*
   129     *  @(#) ti.sdo.ipc.gates; 1, 0, 0, 0,189; 8-10-2010 17:49:21; /db/vtree/library/trees/ipc/ipc-e23x/src/
   130     */
   131