Init basesystem source codes.
[staging/basesystem.git] / nsframework / framework_unified / client / include / native_service / ns_msgs.h
1 /*
2  * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 //////////////////////////////////////////////////////////////////////////////////////////////////
18 /// \ingroup tag_NSMessageCenter
19 /// \brief
20 ///
21 /// Header defines the messaging IF header that will be at the start of each message.
22 ///
23 //////////////////////////////////////////////////////////////////////////////////////////////////
24
25 #ifndef FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MSGS_H_
26 #define FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MSGS_H_
27
28 #include <native_service/frameworkunified_types.h>
29 #include <native_service/ns_shared_mem_if.h>
30
31 #define MC_EMSGT_VALID_TOKEN (0xC8 << 24)
32 #define MC_EMSGT_VALID_MASK (0xFF << 24)
33 #define MC_EMSGT_VALID(t) ((t & MC_EMSGT_VALID_MASK) == MC_EMSGT_VALID_TOKEN)  // NOLINT  (readability/nolint)
34
35 #define MC_EMSGT_SHM_MASK (0x1 << 0)
36 #define MC_EMSGT_IS_SHM(t) (t & MC_EMSGT_SHM_MASK)  // NOLINT  (readability/nolint)
37
38 #define MC_EMSGT_SYNC_MASK (0x1 << 1)
39 #define MC_EMSGT_IS_SYNC(t) (t & MC_EMSGT_SYNC_MASK)  // NOLINT  (readability/nolint)
40
41 #define MC_EMSGT_SYSINFO_MASK (0x1 << 2)
42 #define MC_EMSGT_HAS_SYSINFO(t) (t & MC_EMSGT_SYSINFO_MASK)  // NOLINT  (readability/nolint)
43
44 #pragma pack(1)
45 /// \brief brief description of Messages Header that's pass via Message Center.
46 /// Note: Don't remove #paragma pack(1) this is required for the
47 /// ARM processor, forces data structures to be on a byte boundary
48 /// all messages should be place in between  #pragma pack(1) and #pragma pack()
49 typedef struct tSysMsgHeader {
50   UI_32   eType;      // The type of the message
51   TMemID    memId;      // Unique MemID of the data stored in shared memory,
52   // this is only valid if eType == IPC_MSG_SHM_TYPE
53   struct {
54     CHAR    source[MAX_QUEUE_NAME_SIZE];  // Task that's sending the message.
55     UI_32   command;            // The command id of the message
56     UI_32   length;             // The length of the complete message in contiguous memory
57     // including the header and data block
58     UI_32   sessionid;
59   } info;
60 } SSystemMsgHeader, *PSSystemMsgHeader;
61
62 #pragma pack()
63
64 #endif  // FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MSGS_H_