IPC API  3.40.00.06
RcmTypes.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2013, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 
34 /*
35  * ======== RcmTypes.h ========
36  *
37  */
44 #ifndef ti_grcm_RcmTypes_h
45 #define ti_grcm_RcmTypes_h
46 
47 /*
48  * Force use of the RPMessage instead of MessageQ API for SysLink 3 IPC.
49  * This is temporary to get a protoype working.
50  * Ideally, RPMessage should not be needed.
51  */
52 #define USE_RPMESSAGE 1
53 
54 #if USE_RPMESSAGE
55 #include <ti/ipc/rpmsg/RPMessage.h>
56 #else
57 #include <ti/ipc/MessageQ.h>
58 #endif
59 
60 #include <ti/grcm/RcmClient.h>
61 
62 
63 /*
64  * ======== RcmClient_Packet ========
65  *
66  * RcmClient_Packet.desc: the package descriptor field. Note that the
67  * format is different for out-bound and in-bound messages.
68  *
69  * out-bound message descriptor
70  *
71  * Bits Description
72  * --------------------------------------------------------------------
73  * [15:12] reserved
74  * [11:8] message type
75  * [7:0] client protocol version
76  *
77  *
78  * in-bound message descriptor
79  *
80  * Bits Description
81  * --------------------------------------------------------------------
82  * [15:12] reserved
83  * [11:8] server status code
84  * [7:0] server protocol version
85  */
86 
87 /* message type values */
88 #define RcmClient_Desc_RCM_MSG 0x1 /* client exec message*/
89 #define RcmClient_Desc_DPC 0x2 /* deferred procedure call*/
90 #define RcmClient_Desc_SYM_ADD 0x3 /* symbol add message*/
91 #define RcmClient_Desc_SYM_IDX 0x4 /* query symbox index*/
92 #define RcmClient_Desc_CMD 0x5 /* cmd message (one-way)*/
93 #define RcmClient_Desc_JOB_ACQ 0x6 /* acquire a job id*/
94 #define RcmClient_Desc_JOB_REL 0x7 /* release a job id*/
95 #define RcmClient_Desc_TYPE_MASK 0x0F00 /* field mask*/
96 #define RcmClient_Desc_TYPE_SHIFT 8 /* field shift width*/
97 
98 /* server status codes must be 0 - 15, it has to fit in a 4-bit field */
99 #define RcmServer_Status_SUCCESS ((UInt16)0) /* success*/
100 #define RcmServer_Status_INVALID_FXN ((UInt16)1) /* invalid fxn index*/
101 #define RcmServer_Status_SYMBOL_NOT_FOUND ((UInt16)2) /* symbol not found*/
102 #define RcmServer_Status_INVALID_MSG_TYPE ((UInt16)3) /* invalid msg type*/
103 #define RcmServer_Status_MSG_FXN_ERR ((UInt16)4) /* msg function error*/
104 #define RcmServer_Status_Error ((UInt16)5) /* general failure*/
105 #define RcmServer_Status_Unprocessed ((UInt16)6) /* unprocessed message*/
106 #define RcmServer_Status_JobNotFound ((UInt16)7) /* job id not found*/
107 #define RcmServer_Status_PoolNotFound ((UInt16)8) /* pool id not found*/
108 
109 /* the packet structure (actual message send to server) */
110 
111 #if USE_RPMESSAGE
112 /* Need to deal with this structure, as Linux side rpmsg_omx driver needs it: */
114  UInt32 type;
115  UInt32 len;
116 };
117 
118 /*
119  * Warning: This packet cannot be placed on RCMServer job queues, so can't use
120  * that capability for now.
121  */
122 typedef struct {
123  Bits32 reserved0; /* reserved for List.elem->next */
124  Bits32 reserved1; /* reserved for List.elem->prev */
125  struct rpmsg_omx_hdr hdr;
126  UInt16 desc; /* protocol, descriptor, status */
127  UInt16 msgId; /* message id */
128  RcmClient_Message message; /* client message body (5 words + payload) */
130 
131 /*
132  * Defined to equal packed structure size received on the host.
133  * Strips off the first two ListElem fields and the .data[1] field in .message
134  */
135 #define PACKET_HDR_SIZE (sizeof(RcmClient_Packet) - 3 * sizeof(UInt32))
136 #define PACKET_DATA_SIZE (PACKET_HDR_SIZE - sizeof(struct rpmsg_omx_hdr))
137 
138 /* To test on BIOS side only, uncomment and rebuild anything that
139  * calls RPMessage()
140  */
141 /* #define BIOS_ONLY_TEST */
142 
143 #else
144 typedef struct {
145  MessageQ_MsgHeader msgqHeader; /* MessageQ header (8 words)*/
146  UInt16 desc; /* protocol, descriptor, status*/
147  UInt16 msgId; /* message id*/
148  RcmClient_Message message; /* client message body (5 words + payload)*/
150 
151 #endif
152 
153 /* string functions */
154 Void *_memset(Void *s, Int c, Int n);
155 Int _strcmp(Char *s, Char *t);
156 Void _strcpy(Char *s, Char *t);
157 Int _strlen(const Char *s);
158 
159 #endif /* ti_grcm_RcmTypes_h */
UInt16 msgId
Definition: RcmTypes.h:127
MessageQ Manager.
Bits32 reserved1
Definition: RcmTypes.h:124
Definition: RcmTypes.h:113
Bits32 reserved0
Definition: RcmTypes.h:123
Definition: RcmTypes.h:122
UInt32 type
Definition: RcmTypes.h:114
Required first field in every message.
Definition: MessageQ.h:601
Remote Command Message Client Module. An RcmClient is used for sending messages to an RcmServer for p...
Remote Command Message structure.
Definition: RcmClient.h:441
Int _strcmp(Char *s, Char *t)
UInt32 len
Definition: RcmTypes.h:115
Void * _memset(Void *s, Int c, Int n)
RcmClient_Message message
Definition: RcmTypes.h:128
Void _strcpy(Char *s, Char *t)
Int _strlen(const Char *s)
UInt16 desc
Definition: RcmTypes.h:126
Copyright 2015, Texas Instruments Incorporated