1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
|
/*
* Video On Demand Samples
*
* Copyright (C) 2015 Microchip Technology Germany II GmbH & Co. KG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* You may also obtain this software under a propriety license from Microchip.
* Please contact Microchip for further information.
*
*/
/*----------------------------------------------------------*/
/*! \file
* \brief This file contains the CVodXml, CChannelConfiguration and the CSocketConfiguration classes.
*/
/*----------------------------------------------------------*/
#ifndef _VODXML_H_
#define _VODXML_H_
#include <stdint.h>
#include <stdbool.h>
#include <Types.h>
#include "Xml.h"
typedef enum SocketPort_tag
{
PORT_UNKNOWN,
PORT_I2C,
PORT_I2S,
PORT_PCIE,
PORT_MLB,
PORT_MOST,
PORT_TSI,
PORT_USB
} SocketPort_t;
/*----------------------------------------------------------*/
/*!
* \brief Storage class to store I2S related informations
*/
/*----------------------------------------------------------*/
class CI2SConfiguration
{
public:
///I2S Clock drive mode
V1I2SPortClkDriveMode_t portClkDriveModeV1;
///I2S Streaming port mode
V1I2SStreamingPortMode_t portOptionV1;
///I2S Streaming data format
V1I2SStreamingDataFormat_t streamingDataFormatV1;
///I2S Stream Pin ID
V1I2SPin_t pinV1;
///I2S Port option
V3I2SPortOption_t portOption;
///I2S Clock mode
V3I2SClockMode_t clockMode;
///I2S Delay option
V3I2SDelayMode_t delayMode;
///I2S Port speed in mulitple of MOST base clock (FS)
V3I2SPortSpeed_t portSpeed;
///I2S Data Alignment
V3I2SAlignment_t alignment;
///I2S Stream Pin ID
V3I2SPin_t pin;
CI2SConfiguration() : portClkDriveModeV1( V1I2sClockModeUnknown ),
streamingDataFormatV1( V1I2sDataFormatUnknown ), pinV1( V1I2sInvalidPin ),
portOption( V3I2SOptionUnknown ), clockMode( V3I2SClockModeUnknown ),
delayMode( V3I2SDelayUnknown ), portSpeed( V3I2SSpeedUnknown ),
alignment( V3I2SAlignUnknown ), pin( V3I2SInvalidPin )
{
}
};
/*----------------------------------------------------------*/
/*!
* \brief Storage class to store TSI related informations (only available on OS81110)
*/
/*----------------------------------------------------------*/
class CTsiConfigurationV1
{
public:
///TSI port instance
V1TsiPortInstance_t tsiPortInstance;
///I2S Streaming port mode
V1TsiPortMode tsiPortMode;
CTsiConfigurationV1() : tsiPortInstance(V1TsiPortInstanceNotSet), tsiPortMode(V1TsiPortModeNotSet)
{
}
};
/*----------------------------------------------------------*/
/*!
* \brief Storage class to store all socket related informations. This class will be used inside
* the CChannelConfiguration class.
*/
/*----------------------------------------------------------*/
class CSocketConfiguration
{
public:
///Determines the type of used Application Interface Module (Linux Driver API)
AimType_t aimType;
/// Determines the used INIC port
SocketPort_t port;
/// Determines the used MOST data type
EPDataType_t type;
/// Determines the offset of current socket is splitted in case of usage of Splitter or Combiner
/// The value in case Splitter or Combiner are not used, this value is 0xFFFFFFFF.
uint32_t splittedOffset;
/// Determines the used amount of bytes used for this configuration
uint32_t blockWidth;
/// Determines the used address. This value is generic and has to be interpreted for the used INIC port.
uint32_t address;
/// (optional) Determines the amount of buffers used in the driver.
uint32_t amountOfBuffers;
/// (optional) Determines the size of a single buffer used in the driver.
uint32_t bufferSize;
/// (optional) Determines the amount of transmitted packets inside of one USB frame.
uint32_t packetsPerTransaction;
/// (optional) Determines the width of a subbuffer.
uint32_t subbufferSize;
/// (optional) In case of I2C port, this class holds the corresponding informations
CI2SConfiguration i2sConfig;
/// (optional) In case of TSI port, this class holds the corresponding informations
CTsiConfigurationV1 tsiConfig;
CSocketConfiguration() : aimType( AIM_UNKNOWN ), port( PORT_UNKNOWN ), type( EP_Unknown ),
splittedOffset( 0xFFFFFFFF ), blockWidth( 0xFFFFFFFF ), address( 0xFFFFFFFF ),
amountOfBuffers( 32 ), bufferSize( 8192 ), packetsPerTransaction( 2 ),
subbufferSize( 188 )
{
}
};
/*----------------------------------------------------------*/
/*!
* \brief Storage class to store all channel related informations. This class will be returned by
* the CVodXml class.
*/
/*----------------------------------------------------------*/
class CChannelConfiguration
{
public:
/// Determines the device type as specified in the configuration XML file and found in the group address configuration.
uint32_t deviceType;
/// Determines the used channel id, as specified in the configuration XML file.
uint32_t channelId;
/// Points to the input socket configuration, which will be represented by the CSocketConfiguration class.
CSocketConfiguration inSocket;
/// Points to the output socket configuration, which will be represented by the CSocketConfiguration class.
CSocketConfiguration outSocket;
/// Points to an external scripting file, to perform additional configuration actions. May be NULL.
char *externalScipt;
CChannelConfiguration() : deviceType( 0xFFFFFFFF ), channelId( 0xFFFFFFFF ), externalScipt( NULL )
{
}
~CChannelConfiguration()
{
if( NULL != externalScipt )
{
free( externalScipt );
externalScipt = NULL;
}
}
};
/*----------------------------------------------------------*/
/*!
* \brief Storage class for channel related informations. This class will be returned by
* the CVodXml class.
*/
/*----------------------------------------------------------*/
class CRouteTerminal
{
public:
/// Determines the device type as specified in the configuration XML file and found in the group address configuration.
uint32_t deviceType;
/// instance number of the device found in the network
uint32_t instance;
/// Determines the used channel id, as specified in the configuration XML file.
uint32_t channelId;
};
/*----------------------------------------------------------*/
/*!
* \brief Class to read XML for the Video On Demand use case.
*/
/*----------------------------------------------------------*/
class CVodXml : public CXml
{
private:
/*----------------------------------------------------------*/
/*! \brief Retrieves the control channel addresses used by the sever
*
* \param rxEndpoint RX address will be written to this address (1 Byte)
* \param txEndpoint TX address will be written to this address (1 Byte)
* \return true, if successful
*/
/*----------------------------------------------------------*/
bool GetLocalInicConfigurations( uint8_t *rxEndpoint, uint8_t *txEndpoint );
/*----------------------------------------------------------*/
/*! \brief Retrieves the used physical interface used by the server for the MOST control channel.
*
* \return Enumeration holding the physical interface.
*/
/*----------------------------------------------------------*/
SocketPort_t GetServerHardwareInterface();
/*----------------------------------------------------------*/
/*! \brief Retrieves the Port Message Protocol Version used by the server INIC.
*
* \return 1 for INIC API V1, 2 for INIC API V2.
*/
/*----------------------------------------------------------*/
uint32_t GetServerDeviceApi();
/*----------------------------------------------------------*/
/*! \brief Retrieves the MOST parameters for the server attached INIC
*
* \param isTimingMaster true will be written to this address, when INIC shall act as timing master. false, otherwise.
* \param asyncBandwidth The amount of bytes usable for asynchronous data will be written to this address.
* \return true, if successful
*/
/*----------------------------------------------------------*/
bool GetNetworkConfiguration( bool *isTimingMaster, uint32_t *asyncBandwidth );
public:
/*----------------------------------------------------------*/
/*! \brief Constructor of CVodXml.
*
* \param szFile Path to configuration XML file.
*/
/*----------------------------------------------------------*/
CVodXml( const char *szFile );
/*----------------------------------------------------------*/
/*! \brief Retrieves all instances of the control channel addresses used by the sever
*
* \param rxEndpoint RX address array will be written to this address (1 Byte)
* \param txEndpoint TX address array will be written to this address (1 Byte)
* \param serverNum The amount of found configurations will be written to this address.
* \note The user has to free the arrays rxEndpoint and txEndpoint after usage.
* \return true, if successful
*/
/*----------------------------------------------------------*/
bool GetLocalInicConfigurations( uint8_t *rxEndpoint[], uint8_t *txEndpoint[], uint32_t *apiVersion[],
SocketPort_t *hwPort[], bool *isTimingMaster[], uint32_t *asyncBandwidth[], uint8_t *serverNum );
bool GetMostParameters(bool *isTimingMaster, uint32_t *asyncBandwidth);
/*----------------------------------------------------------*/
/*! \brief Retrieves the Port Message Protocol Version used by the given device type.
*
* \return 1 for INIC API V1, 2 for INIC API V2.
*/
/*----------------------------------------------------------*/
uint32_t GetDeviceApi( uint32_t deviceType );
/*----------------------------------------------------------*/
/*! \brief Retrieves the used MLB Port speed, if used.
*
* \return The configured MLB port speed.
*/
/*----------------------------------------------------------*/
MlbPortSpeed_t GetDeviceMlbPortSpeed( uint32_t deviceType );
/*----------------------------------------------------------*/
/*! \brief Retrieves the MOST channel configurations for the given device type.
*
* \param deviceType The device type to search for.
* \param allChannels A list with all channel configurations will be written into the given vector.
* \return true, if successful
*/
/*----------------------------------------------------------*/
bool GetChannelConfigurations( uint32_t deviceType, CSafeVector<CChannelConfiguration *> &allChannels );
/*----------------------------------------------------------*/
/*! \brief Retrieves the counter route terminals found in routes
*
* \param routeTerminal - Route terminal, a counter terminal is searched for
* \return true, if successful
*/
/*----------------------------------------------------------*/
bool GetRouteTerminals( CRouteTerminal *routeTerminal, CSafeVector<CRouteTerminal *> &allRouteTerminals );
};
#endif //_VODXML_H_
|