rl_protocol.h
1 /****************************************************************************************
2  * FileName : rl_protocol.h
3  *
4  * Description : This file defines the functions required for Communication Protocol
5  *
6  ****************************************************************************************
7  * (C) Copyright 2014, Texas Instruments Incorporated. - TI web address www.ti.com
8  *---------------------------------------------------------------------------------------
9  *
10  * Redistribution and use in source and binary forms, with or without modification,
11  * are permitted provided that the following conditions are met:
12  *
13  * Redistributions of source code must retain the above copyright notice,
14  * this list of conditions and the following disclaimer.
15  *
16  * Redistributions in binary form must reproduce the above copyright notice,
17  * this list of conditions and the following disclaimer in the documentation
18  * and/or other materials provided with the distribution.
19  *
20  * Neither the name of Texas Instruments Incorporated nor the names of its
21  * contributors may be used to endorse or promote products derived from this
22  * software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
26  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
28  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  */
36 /****************************************************************************************
37  * FILE INCLUSION PROTECTION
38  ****************************************************************************************
39  */
40 #ifndef RL_PROTOCOL_H
41 #define RL_PROTOCOL_H
42 
43 /******************************************************************************
44  * INCLUDE FILES
45  ******************************************************************************
46  */
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 /* RHCP Length Constants*/
53 #define SYNC_PATTERN_LEN (4U)
54 #define RHCP_HEADER_LEN (12U)
55 #define RL_CRC_LEN_MAX (8U) /* RHCP CRC max Length in bytes */
56 
58 #define RL_CMD_PL_LEN_MAX ((RL_MAX_SIZE_MSG - (SYNC_PATTERN_LEN \
59  + RHCP_HEADER_LEN + RL_CRC_LEN_MAX)))
60 
64 typedef rlUInt16_t rlSysNRespType_t;
65 
69 typedef struct rlErrorResp
70 {
74  rlSysNRespType_t errorType;
78  rlUInt16_t sbcID;
80 
81 
85 typedef struct rlSyncPattern
86 {
87  rlUInt16_t sync1;
88  rlUInt16_t sync2;
90 
98 #ifndef MMWL_BIG_ENDIAN
99 typedef struct rlOpcode
100 {
104  rlUInt16_t b4Direction : 4;
108  rlUInt16_t b2MsgType : 2;
112  rlUInt16_t b10MsgId : 10;
113 
114 }rlOpcode_t;
115 #else
116 typedef struct rlOpcode
117 {
121  rlUInt16_t b10MsgId : 10;
125  rlUInt16_t b2MsgType : 2;
129  rlUInt16_t b4Direction : 4;
130 }rlOpcode_t;
131 #endif
132 
139 #ifndef MMWL_BIG_ENDIAN
140 typedef struct rlHdrFlags
141 {
145  rlUInt16_t b2RetryFlag : 2;
149  rlUInt16_t b2AckFlag : 2;
153  rlUInt16_t b4Version : 4;
157  rlUInt16_t b2Crc : 2;
165  rlUInt16_t b2CrcLen : 2;
169  rlUInt16_t b4SeqNum : 4;
170 }rlHdrFlags_t;
171 #else
172 typedef struct rlHdrFlags
173 {
177  rlUInt16_t b4SeqNum : 4;
185  rlUInt16_t b2CrcLen : 2;
189  rlUInt16_t b2Crc : 2;
193  rlUInt16_t b4Version : 4;
197  rlUInt16_t b2AckFlag : 2;
201  rlUInt16_t b2RetryFlag : 2;
202 }rlHdrFlags_t;
203 
204 #endif
205 
209 typedef struct rlProtHeader
210 {
215  rlUInt16_t len;
216  rlHdrFlags_t flags;
217  rlUInt16_t remChunks;
218  rlUInt16_t nsbc;
219  rlUInt16_t chksum;
221 
225 typedef struct rlRhcpMsg
226 {
227  rlSyncPattern_t syncPattern;
228  rlProtHeader_t hdr;
229  rlUInt8_t payload[RL_CMD_PL_LEN_MAX + RL_CRC_LEN_MAX];
230 }rlRhcpMsg_t;
231 
232 
233 #ifdef __cplusplus
234 }
235 #endif
236 
237 #endif
238 /*
239  * END OF RL_PROTOCOL_H FILE
240  */
rlOpcode_t opcode
rlUInt16_t, rlApiActionType,rlApiGetSetType
Definition: rl_protocol.h:214
Command op-code ID contains 4 fields (16 bits) Bit 10-15: Reserved Bit 8-9: Operation - Set/Get...
Definition: rl_protocol.h:140
Command op-code ID contains 4 fields (16 bits) Bit 10-15: Reserved Bit 8-9: Operation - Set/Get...
Definition: rl_protocol.h:99
RHCP protocol header structure.
Definition: rl_protocol.h:209
rlUInt16_t sbcID
Definition: rl_protocol.h:78
rlSysNRespType_t errorType
Definition: rl_protocol.h:74
RHCP message structure.
Definition: rl_protocol.h:225
mmWaveLink API Error Sub block structure
Definition: rl_protocol.h:69
RHCP SYNC Pattern Structure.
Definition: rl_protocol.h:85

Copyright 2018, Texas Instruments Incorporated