TI J721E Imaging User Guide
network_ctrl_api.h
Go to the documentation of this file.
1 /******************************************************************************
2 Copyright (c) [2012 - 2017] Texas Instruments Incorporated
3 
4 All rights reserved not granted herein.
5 
6 Limited License.
7 
8  Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
9  license under copyrights and patents it now or hereafter owns or controls to
10  make, have made, use, import, offer to sell and sell ("Utilize") this software
11  subject to the terms herein. With respect to the foregoing patent license,
12  such license is granted solely to the extent that any such patent is necessary
13  to Utilize the software alone. The patent license shall not apply to any
14  combinations which include this software, other than combinations with devices
15  manufactured by or for TI ("TI Devices"). No hardware patent is licensed
16  hereunder.
17 
18  Redistributions must preserve existing copyright notices and reproduce this
19  license (including the above copyright notice and the disclaimer and
20  (if applicable) source code license limitations below) in the documentation
21  and/or other materials provided with the distribution
22 
23  Redistribution and use in binary form, without modification, are permitted
24  provided that the following conditions are met:
25 
26  * No reverse engineering, decompilation, or disassembly of this software
27  is permitted with respect to any software provided in binary form.
28 
29  * Any redistribution and use are licensed by TI for use only with TI Devices.
30 
31  * Nothing shall obligate TI to provide you with source code for the software
32  licensed and provided to you in object code.
33 
34  If software source code is provided to you, modification and redistribution of
35  the source code are permitted provided that the following conditions are met:
36 
37  * Any redistribution and use of the source code, including any resulting
38  derivative works, are licensed by TI for use only with TI Devices.
39 
40  * Any redistribution and use of any object code compiled from the source code
41  and any resulting derivative works, are licensed by TI for use only with TI
42  Devices.
43 
44  Neither the name of Texas Instruments Incorporated nor the names of its
45  suppliers may be used to endorse or promote products derived from this software
46  without specific prior written permission.
47 
48  DISCLAIMER.
49 
50  THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS OR
51  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
52  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
53  IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
54  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
55  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
56  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
57  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
58  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
59  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60 ******************************************************************************/
61 
79 #ifndef _NETWORK_CTRL_API_H_
80 #define _NETWORK_CTRL_API_H_
81 
82 #ifdef __cplusplus
83 extern "C" {
84 #endif
85 
86 
87 //#include <networkCtrl_api.h>
88 #include <network_api.h>
89 
90 
91 #define NETWORK_CTRL_MAX_CMDS (64U)
92 #define NETWORK_CTRL_CMD_STRLEN_MAX (64U)
93 #define NETWORK_CTRL_MAX_PARAMS (32U)
94 
95 /*******************************************************************************
96  * \brief Flag that is set in the 'flags' field of the header to indicate
97  * this packet is a ACK packet for a previously send command
98  *******************************************************************************
99  */
100 #define NETWORK_CTRL_FLAG_ACK (0x00000001U)
101 
102 
103 /*******************************************************************************
104  * \brief Function callback to handle command received over network
105  *
106  * The Network command handler should call
107  * NetworkCtrl_readParams() to read parameters into user supplied buffer
108  * if prmSize > 0
109  *
110  * The Network command handler should call
111  * NetworkCtrl_writeParams() to send ACK and parameters, if any,
112  * to the sender.
113  *
114  * If there are no return parameters, if should still call
115  * NetworkCtrl_writeParams(NULL, 0, 0) to send ACK to the sender
116  *
117  * \param cmd [IN] The command that is received
118  * \param prmSize [IN] Size of the parameters for the received command
119  *
120  *******************************************************************************
121  */
122 typedef void (*NetworkCtrl_Handler)(char *cmd, uint32_t prmSize);
123 
124 
125 
126 /*******************************************************************************
127  * Data structure's
128  *******************************************************************************
129  */
130 /*
131  * Note: These structures are shared between PC and EVM so dont use any platform
132  * dependent types. Also disable struct padding to avoid potential size
133  * mismatch between client and server
134  */
135 
136 typedef struct {
137 
138  uint32_t header;
144  uint32_t returnValue;
147  uint32_t flags;
150  uint32_t prmSize;
156 
157 
158 
159 typedef struct {
160 
163 
165 
166 
167 typedef struct {
168 
169  pthread_t thrHndl;
170 
174  uint16_t serverPort;
184 
186 
187 
188 #ifdef __cplusplus
189 }
190 #endif /* __cplusplus */
191 
192 #endif //_NETWORK_CTRL_API_H_
193 
194 /* @} */
195 
196 
Definition: network_api.h:110
#define NETWORK_CTRL_MAX_CMDS
Definition: network_ctrl_api.h:91
uint32_t header
Definition: network_ctrl_api.h:138
Definition: network_ctrl_api.h:167
NetworkCtrl_Handler handler
Definition: network_ctrl_api.h:162
uint32_t flags
Definition: network_ctrl_api.h:147
uint32_t prmSize
Definition: network_ctrl_api.h:150
Definition: network_ctrl_api.h:159
pthread_t thrHndl
Definition: network_ctrl_api.h:169
uint16_t serverPort
Definition: network_ctrl_api.h:174
Bool tskExit
Definition: network_ctrl_api.h:171
uint32_t returnValue
Definition: network_ctrl_api.h:144
#define NETWORK_CTRL_CMD_STRLEN_MAX
Definition: network_ctrl_api.h:92
int Bool
Definition: network_api.h:105
Definition: network_ctrl_api.h:136
Network_SockObj sockObj
Definition: network_ctrl_api.h:180
NetworkCtrl_CmdHeader cmdBuf
Definition: network_ctrl_api.h:177
void(* NetworkCtrl_Handler)(char *cmd, uint32_t prmSize)
Definition: network_ctrl_api.h:122