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     *  ======== GateHWSpinlock.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     *  ======== GateHWSpinlock ========
    49     *  Multiprocessor gate that utilizes a hardware spinlock
    50     */
    51    @InstanceInitError
    52    @ModuleStartup
    53    
    54    module GateHWSpinlock inherits IGateMPSupport
    55    {
    56        /*!
    57         *  ======== BasicView ========
    58         *  @_nodoc
    59         */
    60        metaonly struct BasicView {
    61            UInt    lockNum;
    62            UInt    nested;        
    63        }
    64    
    65        /*!
    66         *  ======== rovViewInfo ========
    67         *  @_nodoc
    68         */
    69        @Facet
    70        metaonly config xdc.rov.ViewInfo.Instance rovViewInfo = 
    71            xdc.rov.ViewInfo.create({
    72                viewMap: [
    73                    ['Basic', 
    74                        {
    75                            type: xdc.rov.ViewInfo.INSTANCE,
    76                            viewInitFxn: 'viewInitBasic',
    77                            structName: 'BasicView'
    78                        }
    79                    ],
    80                ]
    81            });
    82    
    83        /*!
    84         *  ======== LM_enter ========
    85         *  Logged on gate enter
    86         */
    87        config Log.Event LM_enter = {
    88            mask: Diags.USER1,
    89            msg: "LM_enter: Gate (lockNum = %d) entered, returning key = %d"
    90        };
    91    
    92        /*!
    93         *  ======== LM_leave ========
    94         *  Logged on gate leave
    95         */
    96        config Log.Event LM_leave = {
    97            mask: Diags.USER1,
    98            msg: "LM_leave: Gate (lockNum = %d) left using key = %d"
    99        };
   100    
   101        /*!
   102         *  ======== LM_create ========
   103         *  Logged on gate create
   104         */
   105        config Log.Event LM_create = {
   106            mask: Diags.USER1,
   107            msg: "LM_create: Gate (lockNum = %d) created"
   108        };
   109    
   110        /*!
   111         *  ======== LM_open ========
   112         *  Logged on gate open
   113         */
   114        config Log.Event LM_open = {
   115            mask: Diags.USER1,
   116            msg: "LM_open: Remote gate (lockNum = %d) opened"
   117        };
   118    
   119        /*!
   120         *  ======== LM_delete ========
   121         *  Logged on gate deletion
   122         */
   123        config Log.Event LM_delete = {
   124            mask: Diags.USER1,
   125            msg: "LM_delete: Gate (lockNum = %d) deleted"
   126        };
   127    
   128        /*!
   129         *  ======== LM_close ========
   130         *  Logged on gate close
   131         */
   132        config Log.Event LM_close = {
   133            mask: Diags.USER1,
   134            msg: "LM_close: Gate (lockNum = %d) closed"
   135        };
   136    
   137        /*!
   138         *  ======== A_invalidParams ========
   139         *  Asserted when insufficient information is passed to {@link #open}
   140         */
   141        config Assert.Id A_invalidParams  = {
   142            msg: "A_invalidParams: Need to supply either a name or a spinlock Number"
   143        };
   144        
   145        /*!
   146         *  ======== A_invProtectionLevel ========
   147         *  Asserted when an invalid protection level is encountered
   148         */
   149        config Assert.Id A_invProtectionLevel  = {
   150            msg: "A_invProtectionLevel: Unknown level of local protection"
   151        };
   152        
   153        /*!
   154         *  ======== A_invSpinLockNum ========
   155         *  Assert raised when provided lockNum is invalid for the relevant device
   156         */
   157        config Assert.Id A_invSpinLockNum  = {
   158            msg: "A_invSpinLockNum: Invalid hardware spinlock number"
   159        };
   160        
   161        /*! Device-specific base address for HW Semaphore subsystem */
   162        config Ptr baseAddr = null;
   163    
   164    instance:    
   165    
   166    internal:
   167       
   168        /*! Device-specific number of semphores in the HW Semaphore subsystem */
   169        config UInt numLocks;
   170    
   171        struct Instance_State {
   172            UInt            lockNum;   /* The lock number being used */
   173            UInt            nested;    /* For nesting */
   174            IGateProvider.Handle     localGate;
   175        };
   176    }
   177    /*
   178     *  @(#) ti.sdo.ipc.gates; 1, 0, 0, 0,189; 8-10-2010 17:49:21; /db/vtree/library/trees/ipc/ipc-e23x/src/
   179     */
   180