1    /* --COPYRIGHT--,TI
     2     * Copyright (c) $(CPYYEAR)
     3     * Texas Instruments
     4     *
     5     *  All rights reserved.  Property of Texas Instruments
     6     *  Restricted rights to use, duplicate or disclose this code are
     7     *  granted through contract.
     8     * 
     9     * --/COPYRIGHT--*/
    10    /*
    11     *  ======== GateHWSpinlock.xdc ========
    12     *
    13     *! Revision History
    14     *! ================
    15     *! 28-Jun-2009 skp     Delegates collapsed into frontend
    16     *! 17-Jun-2009 skp     ROV views added
    17     *! 06-May-2009 skp     created from GateHWSem
    18     */
    19    
    20    package ti.sdo.ipc.gates;
    21    
    22    import xdc.runtime.Error;
    23    import xdc.runtime.Assert;
    24    import xdc.runtime.IGateProvider;
    25    import xdc.runtime.Diags;
    26    import xdc.runtime.Log;
    27    
    28    import ti.sdo.ipc.interfaces.IGateMPSupport;
    29    
    30    /*!
    31     *  ======== GateHWSpinlock ========
    32     *  Multiprocessor gate that utilizes a hardware spinlock
    33     */
    34    @InstanceInitError
    35    
    36    module GateHWSpinlock inherits IGateMPSupport
    37    {
    38        /*!
    39         *  ======== BasicView ========
    40         *  @_nodoc
    41         */
    42        metaonly struct BasicView {
    43            UInt    lockNum;
    44            UInt    nested;        
    45        }
    46    
    47        /*!
    48         *  ======== rovViewInfo ========
    49         *  @_nodoc
    50         */
    51        @Facet
    52        metaonly config xdc.rov.ViewInfo.Instance rovViewInfo = 
    53            xdc.rov.ViewInfo.create({
    54                viewMap: [
    55                    ['Basic', 
    56                        {
    57                            type: xdc.rov.ViewInfo.INSTANCE,
    58                            viewInitFxn: 'viewInitBasic',
    59                            structName: 'BasicView'
    60                        }
    61                    ],
    62                ]
    63            });
    64    
    65        /*!
    66         *  ======== LM_enter ========
    67         *  Logged on gate enter
    68         */
    69        config Log.Event LM_enter = {
    70            mask: Diags.USER1,
    71            msg: "LM_enter: Gate (lockNum = %d) entered, returning key = %d"
    72        };
    73    
    74        /*!
    75         *  ======== LM_leave ========
    76         *  Logged on gate leave
    77         */
    78        config Log.Event LM_leave = {
    79            mask: Diags.USER1,
    80            msg: "LM_leave: Gate (lockNum = %d) left using key = %d"
    81        };
    82    
    83        /*!
    84         *  ======== LM_create ========
    85         *  Logged on gate create
    86         */
    87        config Log.Event LM_create = {
    88            mask: Diags.USER1,
    89            msg: "LM_create: Gate (lockNum = %d) created"
    90        };
    91    
    92        /*!
    93         *  ======== LM_open ========
    94         *  Logged on gate open
    95         */
    96        config Log.Event LM_open = {
    97            mask: Diags.USER1,
    98            msg: "LM_open: Remote gate (lockNum = %d) opened"
    99        };
   100    
   101        /*!
   102         *  ======== LM_delete ========
   103         *  Logged on gate deletion
   104         */
   105        config Log.Event LM_delete = {
   106            mask: Diags.USER1,
   107            msg: "LM_delete: Gate (lockNum = %d) deleted"
   108        };
   109    
   110        /*!
   111         *  ======== LM_close ========
   112         *  Logged on gate close
   113         */
   114        config Log.Event LM_close = {
   115            mask: Diags.USER1,
   116            msg: "LM_close: Gate (lockNum = %d) closed"
   117        };
   118    
   119        /*!
   120         *  ======== A_invalidParams ========
   121         *  Asserted when insufficient information is passed to {@link #open}
   122         */
   123        config Assert.Id A_invalidParams  = {
   124            msg: "A_invalidParams: Need to supply either a name or a spinlock Number"
   125        };
   126        
   127        /*!
   128         *  ======== A_invProtectionLevel ========
   129         *  Asserted when an invalid protection level is encountered
   130         */
   131        config Assert.Id A_invProtectionLevel  = {
   132            msg: "A_invProtectionLevel: Unknown level of local protection"
   133        };
   134        
   135        /*!
   136         *  ======== A_invSpinLockNum ========
   137         *  Assert raised when provided lockNum is invalid for the relevant device
   138         */
   139        config Assert.Id A_invSpinLockNum  = {
   140            msg: "A_invSpinLockNum: Invalid hardware spinlock number"
   141        };
   142        
   143        /*! Device-specific base address for HW Semaphore subsystem */
   144        config Ptr baseAddr = null;
   145    
   146    instance:    
   147    
   148    internal:
   149       
   150        /*! Device-specific number of semphores in the HW Semaphore subsystem */
   151        config UInt numLocks;
   152    
   153        struct Instance_State {
   154            UInt            lockNum;   /* The lock number being used */
   155            UInt            nested;    /* For nesting */
   156            IGateProvider.Handle     localGate;
   157        };
   158    }