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     *  ======== GateAAMonitor.xdc ========
    12     *
    13     *! Revision History
    14     *! ================
    15     *! 04-Feb-2010 skp     obj->objType not needed; removed
    16     *! 22-Dec-2009 skp     Removed @InstanceFinalize
    17     *! 17-Nov-2009 skp     Added assert to ensure SL2 RAM being used
    18     *! 28-Sep-2009 skp     GateMP compatbility changes
    19     *! 21-Jul-2009 skp     created from GateHWSem
    20     */
    21     
    22    package ti.sdo.ipc.gates;
    23    
    24    import xdc.runtime.Error;
    25    import xdc.runtime.Assert;
    26    import xdc.runtime.IGateProvider;
    27    import xdc.runtime.Diags;
    28    import xdc.runtime.Log;
    29    
    30    import ti.sdo.ipc.Ipc;
    31    
    32    import ti.sdo.ipc.interfaces.IGateMPSupport;
    33    
    34    /*!
    35     *  ======== GateAAMonitor ========
    36     *  Multiprocessor gate that utilizes an atomic access monitor (AAM)
    37     */
    38    @InstanceInitError
    39    
    40    module GateAAMonitor inherits IGateMPSupport
    41    {
    42        /*! @_nodoc */
    43        metaonly struct BasicView {
    44            Ptr     sharedAddr;
    45            UInt    nested;
    46            String  enteredBy;     /* Entered or free */
    47        }
    48    
    49        /*!
    50         *  ======== rovViewInfo ========
    51         *  @_nodoc
    52         */
    53        @Facet
    54        metaonly config xdc.rov.ViewInfo.Instance rovViewInfo =
    55            xdc.rov.ViewInfo.create({
    56                viewMap: [
    57                    ['Basic',
    58                        {
    59                            type: xdc.rov.ViewInfo.INSTANCE,
    60                            viewInitFxn: 'viewInitBasic',
    61                            structName: 'BasicView'
    62                        }
    63                    ],
    64                ]
    65            });
    66            
    67        /*!
    68         *  ======== A_invSharedAddr ========
    69         *  Assert raised when supplied sharedAddr is invalid
    70         *
    71         *  C6472 requires that shared region 0 be placed in SL2 memory and that
    72         *  all GateMP instances be allocated from region 0.  The gate itself may
    73         *  be used to protect the contents of any shared region.
    74         */
    75        config Assert.Id A_invSharedAddr  = {
    76            msg: "A_invSharedAddr: Address must be in shared L2 address space"
    77        };
    78        
    79        /*!
    80         *  ======== numInstances ========
    81         *  Maximum number of instances supported by the GateAAMonitor module
    82         */
    83        config UInt numInstances = 32;
    84    
    85    instance:
    86    
    87    
    88    internal:
    89    
    90        /*! Get the lock */
    91        @DirectCall
    92        UInt getLock(Ptr sharedAddr);
    93        
    94        /*! Initialize monitor */
    95        Void postInit(Object *obj); 
    96        
    97        /*! L1D cache line size is 64 */
    98        const UInt CACHELINE_SIZE = 64;
    99    
   100        /*!
   101         *  Range of SL2 RAM on TMS320TCI6486. Used for ensuring sharedAddr is
   102         *  valid
   103         */
   104        const Ptr SL2_RANGE_BASE = 0x00200000;
   105        const Ptr SL2_RANGE_MAX  = 0x002bffff;
   106        
   107        struct Instance_State {
   108            volatile UInt32*    sharedAddr;
   109            UInt                nested;    /* For nesting */       
   110            IGateProvider.Handle localGate;
   111        };
   112    }