]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blobdiff - packages/ti/sdo/ipc/MessageQ.xdc
MessageQ: Update MesssageQ header for 64 bit addresses
[ipc/ipcdev.git] / packages / ti / sdo / ipc / MessageQ.xdc
index 0b8e105844067fcc4b8de4dd18dd8d35d23ffece..d7df795535beaf09ba55a5b2d785d24379a5c461 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -46,6 +46,7 @@ import xdc.runtime.knl.ISync;
 
 import ti.sysbios.syncs.SyncSem;
 
+import ti.sdo.ipc.interfaces.ITransport;
 import ti.sdo.ipc.interfaces.IMessageQTransport;
 import ti.sdo.utils.NameServer;
 import ti.sdo.utils.List;
@@ -153,7 +154,18 @@ import xdc.rov.ViewInfo;
  *  any two processors. The IMessageQTransport instances are created via the
  *  {@link #SetupTransportProxy}. The instances are responsible for
  *  registering themselves with MessageQ. This is accomplished via the
- * {@link #registerTransport} function.
+ *  {@link #registerTransport} function.
+ *
+ *  @a(Note)
+ *  This modules reflects upon the {@link ti.sdo.utils.MultiProc#procAddrMode}
+ *  configuration parameter. Some internal data structure allocations are
+ *  optimized for the given processor address mode. For example, when using
+ *  {@link ti.sdo.utils.MultiProc#ProcAddrMode_Global}, a message can be
+ *  addressed to any processor using only the destination queueId. However,
+ *  when using {@link ti.sdo.utils.MultiProc#ProcAddrMode_Cluster}, only
+ *  the processors within your cluster can be addressed using only the
+ *  destination queueId. For processors outside the cluster, you must also
+ *  specify the Transport ID.
  */
 
 @ModuleStartup
@@ -169,6 +181,7 @@ module MessageQ
     metaonly struct QueuesView {
         String  name;
         UInt    queueId;
+        Bool    reserved;
     }
 
     /*!
@@ -196,6 +209,7 @@ module MessageQ
         String               heaps[];
         String               gate;
         UInt16               nextSeqNum;
+        String               freeHookFxn[];
     }
 
     /*!
@@ -334,6 +348,24 @@ module MessageQ
         msg: "LM_get: Message 0x%x (seqNum = %d, srcProc = %d) was received by queue 0x%x"
     };
 
+    /*!
+     *  ======== FreeHookFxn ========
+     *  Function prototype for the MessageQ_free callback
+     *
+     *  @param(Bits16)  heapId of message that was freed
+     *  @param(Bits16)  msgId of message that was freed
+     */
+    typedef Void (*FreeHookFxn)(Bits16, Bits16);
+
+    /*!
+     *  ======== PutHookFxn ========
+     *  Function prototype for the MessageQ_put callback
+     *
+     *  @param(Bits32)  queueId of the destination message queue
+     *  @param(Ptr)     pointer to a message header structure
+     */
+    typedef Void (*PutHookFxn)(Bits32, Ptr);
+
     /*! MessageQ ID */
     typedef UInt32 QueueId;
 
@@ -352,6 +384,15 @@ module MessageQ
     const UInt RESERVEDPRI = 2;
     const UInt URGENTPRI   = 3;
 
+    /*!
+     *  Denotes any queueId is acceptable
+     *
+     *  This constant is the default for the {@link #queueId} parameter.
+     *  This value must match ti/ipc/MessageQ.h but is needed to initialize
+     *  queueId.
+     */
+    const Bits16 ANY = ~(0);
+
     /*!
      *  Assert raised when calling API with wrong handle
      *
@@ -451,6 +492,13 @@ module MessageQ
         msg: "E_nameFailed: '%s' name failed to be added to NameServer"
     };
 
+    /*!
+     *  Error raised if the requested queueIndex is not available
+     */
+    config Error.Id E_indexNotAvailable  = {
+        msg: "E_indexNotAvailable: queueIndex %d not available"
+    };
+
     /*!
      *  Trace setting
      *
@@ -475,6 +523,20 @@ module MessageQ
      */
     config UInt maxRuntimeEntries = NameServer.ALLOWGROWTH;
 
+    /*!
+     *  Number of reserved MessageQ indexes
+     *
+     *  An application can request the first N message queue indexes be
+     *  reserved to be used by MessageQ_create2. MessageQ_create will
+     *  not use these slots. The application can use any index less than
+     *  the value of numReservedEntries for the queueIndex field in the
+     *  MessageQ_Params2 structure.
+     *
+     *  numReservedEntries must be equal or less than
+     *  {@link #maxRuntimeEntries}.
+     */
+    config UInt numReservedEntries = 0;
+
     /*!
      *  Gate used to make the name table thread safe
      *
@@ -502,6 +564,18 @@ module MessageQ
      */
     metaonly config String tableSection = null;
 
+    /*!
+     *  ======== freeHookFxn ========
+     *  Free function in MessageQ_free after message was freed back to the heap
+     */
+    config FreeHookFxn freeHookFxn = null;
+
+    /*!
+     *  ======== putHookFxn ========
+     *  Put function hook
+     */
+    config PutHookFxn putHookFxn = null;
+
     /*!
      *  ======== registerHeapMeta ========
      *  Statically register a heap with MessageQ
@@ -524,7 +598,8 @@ module MessageQ
      *  @param(procId)      procId that transport communicaties with
      *  @param(priority)    priority of transport
      */
-     metaonly Void registerTransportMeta(IMessageQTransport.Handle transport, UInt16 procId, UInt priority);
+     metaonly Void registerTransportMeta(IMessageQTransport.Handle transport,
+             UInt16 procId, UInt priority);
 
     /*!
      *  ======== registerTransport ========
@@ -563,6 +638,20 @@ instance:
      */
     config ISync.Handle synchronizer = null;
 
+    /*!
+     *  Requested MessageQ_QueueIndex
+     *
+     *  This parameter allows an application to specify the queueIndex to
+     *  be used for a message queue. To use this functionality, the
+     *  MessageQ.numReservedEntries static configuration parameter must be
+     *  set to a specific value.
+     *
+     *  The default is {@link #ANY}. This means do that you are not asking for
+     *  an explicit index. MessageQ will find the first available one which is
+     *  equal or greater than MessageQ.numReservedEntries.
+     */
+    config UInt16 queueIndex = ANY;
+
     /*! @_nodoc
      *  ======== create ========
      *  Create a message queue
@@ -575,13 +664,15 @@ internal:
     /*
      *  The following describes the usage of the flag field
      *  ---------------------------------
-     *  |V V V|T|     reserved      |P P|
+     *  |V V V|T|  reserved   |t t t|P P|
      *  ---------------------------------
-     *   E D C B A 0 9 8 7 6 5 4 3 2 1 0
+     *   F E D C B A 9 8 7 6 5 4 3 2 1 0
      *
-     *  V = version
-     *  P = priority
-     *  T = trace flag
+     *  [15:13] V = version
+     *  [12]    T = trace flag
+     *  [11:5]  reserved
+     *  [4:2]   t = transport Id, zero = default
+     *  [1:0]   P = priority
      */
 
     /*! Mask to extract version setting */
@@ -617,16 +708,16 @@ internal:
 
     /*! Required first field in every message */
     @Opaque struct MsgHeader {
-        Bits32       reserved0;         /* reserved for List.elem->next */
-        Bits32       reserved1;         /* reserved for List.elem->prev */
+        Bits64       reserved0;         /* reserved for List.elem->next */
+        Bits64       reserved1;         /* reserved for List.elem->prev */
         Bits32       msgSize;           /* message size                 */
         Bits16       flags;             /* bitmask of different flags   */
         Bits16       msgId;             /* message id                   */
-        Bits16       dstId;             /* destination processor id     */
-        Bits16       dstProc;           /* destination processor        */
-        Bits16       replyId;           /* reply id                     */
-        Bits16       replyProc;         /* reply processor              */
-        Bits16       srcProc;           /* source processor             */
+        Bits16       dstId;             /* destination queue id         */
+        Bits16       dstProc;           /* destination processor id     */
+        Bits16       replyId;           /* reply queue id               */
+        Bits16       replyProc;         /* reply processor id           */
+        Bits16       srcProc;           /* proc who initialized the msg */
         Bits16       heapId;            /* heap id                      */
         Bits16       seqNum;            /* sequence number              */
         Bits16       reserved;          /* reserved                     */
@@ -642,6 +733,17 @@ internal:
         UInt16             procId;
     };
 
+    enum TransportType {
+        TransportType_IMessageQTransport,
+        TransportType_INetworkTransport,
+        TransportType_Invalid
+    };
+
+    struct RegisteredTransport {
+        ITransport.Handle transport;
+        TransportType type;
+    };
+
     /*!
      *  ======== nameSrvPrms ========
      *  This Params object is used for temporary storage of the
@@ -681,14 +783,17 @@ internal:
     };
 
     struct Module_State {
-        IMessageQTransport.Handle transports[][2];
+        IMessageQTransport.Handle transports[length][2];
         Handle               queues[];
         IHeap.Handle         heaps[];
         IGateProvider.Handle gate;
         UInt16               numQueues;
         UInt16               numHeaps;
         NameServer.Handle    nameServer;
+        FreeHookFxn          freeHookFxn;
+        PutHookFxn           putHookFxn;
         Bool                 canFreeQueues;
         UInt16               seqNum;
+        RegisteredTransport  regTrans[8];
     };
 }