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     *  ======== GateHWSem.xdc ========
    12     *
    13     *! Revision History
    14     *! ================
    15     *! 28-Jun-2009 skp     Delegates collapsed into frontend
    16     *! 17-Jun-2009 skp     ROV views added
    17     *! 22-Apr-2009 skp     code review changes
    18     *! 16-Mar-2009 skp     Removed sharedCreate-static open not possible anymore
    19     *! 10-Feb-2009 skp     open(), NameServer, and interface changes
    20     *! 27-Jan-2009 skp     created
    21     */
    22    
    23    package ti.sdo.ipc.gates;
    24    
    25    import xdc.runtime.Error;
    26    import xdc.runtime.Assert;
    27    import xdc.runtime.IGateProvider;
    28    import xdc.runtime.Diags;
    29    import xdc.runtime.Log;
    30    
    31    import ti.sdo.ipc.interfaces.IGateMPSupport;
    32    
    33    /*!
    34     *  ======== GateHWSem ========
    35     *  Multiprocessor gate that utilizes a hardware semaphore
    36     */
    37    @ModuleStartup
    38    @InstanceInitError
    39    @InstanceFinalize
    40    
    41    module GateHWSem inherits IGateMPSupport
    42    {
    43        /*! @_nodoc */
    44        metaonly struct BasicView {
    45            Ptr     semNum;
    46            UInt    nested;
    47            String  enteredBy;      /* Which core has entered the hw sem */
    48        }
    49    
    50        /*!
    51         *  ======== rovViewInfo ========
    52         *  @_nodoc
    53         */
    54        @Facet
    55        metaonly config xdc.rov.ViewInfo.Instance rovViewInfo = 
    56            xdc.rov.ViewInfo.create({
    57                viewMap: [
    58                    ['Basic', 
    59                        {
    60                            type: xdc.rov.ViewInfo.INSTANCE,
    61                            viewInitFxn: 'viewInitBasic',
    62                            structName: 'BasicView'
    63                        }
    64                    ],
    65                ]
    66            });
    67    
    68        /*!
    69         *  ======== A_invalidParams ========
    70         *  Asserted when insufficient information is passed to {@link #open}
    71         */
    72        config Assert.Id A_invalidParams  = {
    73            msg: "A_invalidParams: Need to supply either a name or a semaphore Number"
    74        };
    75        
    76        /*!
    77         *  ======== A_invProtectionLevel ========
    78         *  Asserted when an invalid protection level is encountered
    79         */
    80        config Assert.Id A_invProtectionLevel  = {
    81            msg: "A_invProtectionLevel: Unknown level of local protection"
    82        };
    83        
    84        /*!
    85         *  ======== A_invSemNum ========
    86         *  Asserted when supplied semNum is invalid for the relevant device
    87         */
    88        config Assert.Id A_invSemNum  = {
    89            msg: "A_invSemNum: Invalid hardware semaphore number"
    90        };
    91    
    92    instance:    
    93    
    94    internal:
    95    
    96        /*! Initialize the hardware semaphore when the creator is created */
    97        Void postInit(Object *obj); 
    98    
    99        /*! Device-specific base address for HW Semaphore subsystem */
   100        config Ptr baseAddr;
   101        
   102        /*! Device-specific query offset for HW Semaphore subsystem (for ROV) */
   103        config Ptr queryAddr;
   104        
   105        /*! Device-specific number of semphores in the HW Semaphore subsystem */
   106        config UInt numSems;
   107    
   108        struct Instance_State {
   109            UInt                     semNum;    /* The sem number being used */
   110            UInt                     nested;    /* For nesting */        
   111            IGateProvider.Handle     localGate;
   112        };
   113    }