source: svn/newcon3bcm2_21bu/nexus/modules/transport/7552/include/nexus_message.h

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 26.2 KB
Line 
1/***************************************************************************
2 *     (c)2007-2011 Broadcom Corporation
3 *
4 *  This program is the proprietary software of Broadcom Corporation and/or its licensors,
5 *  and may only be used, duplicated, modified or distributed pursuant to the terms and
6 *  conditions of a separate, written license agreement executed between you and Broadcom
7 *  (an "Authorized License").  Except as set forth in an Authorized License, Broadcom grants
8 *  no license (express or implied), right to use, or waiver of any kind with respect to the
9 *  Software, and Broadcom expressly reserves all rights in and to the Software and all
10 *  intellectual property rights therein.  IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU
11 *  HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY
12 *  NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE.
13 *
14 *  Except as expressly set forth in the Authorized License,
15 *
16 *  1.     This program, including its structure, sequence and organization, constitutes the valuable trade
17 *  secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof,
18 *  and to use this information only in connection with your use of Broadcom integrated circuit products.
19 *
20 *  2.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
21 *  AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR
22 *  WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
23 *  THE SOFTWARE.  BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES
24 *  OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE,
25 *  LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION
26 *  OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF
27 *  USE OR PERFORMANCE OF THE SOFTWARE.
28 *
29 *  3.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS
30 *  LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR
31 *  EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR
32 *  USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF
33 *  THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT
34 *  ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE
35 *  LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF
36 *  ANY LIMITED REMEDY.
37 *
38 * $brcm_Workfile: nexus_message.h $
39 * $brcm_Revision: 39 $
40 * $brcm_Date: 12/20/11 4:36p $
41 *
42 * Module Description:
43 *
44 * Revision History:
45 *
46 * $brcm_Log: /nexus/modules/transport/7400/include/nexus_message.h $
47 *
48 * 39   12/20/11 4:36p gmullen
49 * SW7425-1868: Added filter offset support
50 *
51 * SW7425-1868/1   12/20/11 4:32p gmullen
52 * SW7425-1868: Added filter offset support
53 *
54 * 38   6/2/11 4:22p erickson
55 * SWDEPRECATED-2425: add comment about filtering on integer ranges
56 *
57 * 37   12/16/10 10:33a erickson
58 * SW7422-151: add NEXUS_MessageStartSettings.useRPipe
59 *
60 * 36   12/14/10 4:37p erickson
61 * SW7420-1285: add null_allowed attribute
62 *
63 * 35   10/15/10 1:38p erickson
64 * SWDEPRECATED-2425: clarify TS and PES capture
65 *
66 * 34   9/8/10 4:42p erickson
67 * SW3548-3073: NEXUS_Message_GetBuffer should not re-enable the interrupt
68 *  if returned size is non-zero. This is correct backward compatibility
69 *  with MSGlib.
70 *
71 * 33   9/3/10 11:56a erickson
72 * SW35230-1172: add NEXUS_Message_GetBufferWithWrap
73 *
74 * 32   9/1/10 3:42p erickson
75 * SW7420-996: add NEXUS_MessageStatus.moreDataAvailable
76 *
77 * 31   7/14/10 1:43p erickson
78 * SW7405-4561: clarify NEXUS_MessageFilter comments
79 *
80 * 30   7/12/10 4:49p erickson
81 * SW7405-4561: add support for 32 byte filters using export
82 *  BXPT_FILTER_32=y
83 *
84 * 29   5/12/10 5:35p erickson
85 * SW7420-624: update comments on NEXUS_MessageStartSettings.filterGroup
86 *
87 * 28   4/19/10 2:52p erickson
88 * SW7420-624: add NEXUS_Message_UpdateFilter
89 *
90 * 27   4/19/10 1:59p erickson
91 * SW7420-624: add NEXUS_Message_AddFilter and NEXUS_Message_RemoveFilter
92 *  to enable filter groups with pid2buf
93 *
94 * 26   2/11/10 2:20p erickson
95 * SWDEPRECATED-2425: update comments
96 *
97 * 25   12/11/09 3:32p erickson
98 * SW7550-112: merge 7550 code. add support for sw message filtering.
99 *  allow for no HW message filtering using standard XPT define.
100 *
101 * 24   11/6/09 1:57p erickson
102 * SW7400-2559: added NEXUS_Message_SetDssCapPattern
103 *
104 * 23   10/20/09 2:24p erickson
105 * SW7400-2559: add DSS message support
106 *
107 * 22   10/8/09 1:23p erickson
108 * SWDEPRECATED-3717: revise comments based on switch to pid2buf
109 *
110 * 21   7/8/09 2:56p erickson
111 * PR53768: deprecated NEXUS_MessageBufferMode. it was never implemented
112 *  and has no use.
113 *
114 * 20   6/12/09 12:38p erickson
115 * PR35457: update comments on NEXUS_MessageSettings.dataReady callback
116 *
117 * 19   3/24/09 10:01a erickson
118 * PR53516: added NEXUS_Message_GetStatus
119 *
120 * 18   11/26/08 3:06p erickson
121 * PR35457: update comments
122 *
123 * 17   11/11/08 2:54a erickson
124 * PR 48847: added NEXUS_Message_SetSettings
125 *
126 * 16   9/11/08 3:13p erickson
127 * PR46646: added crcError, pesLengthError, pesStartCodeError
128 *
129 * 14   8/6/08 3:01p erickson
130 * PR45472: update comments
131 *
132 * 13   5/9/08 1:29p erickson
133 * PR42456: added NEXUS_MessageFormat_ePesSaveAll. clarified that
134 *  maxContiguousMessageSize only applies for PSI messages.
135 *
136 * 12   5/6/08 4:43p erickson
137 * PR34925: clarify comment
138 *
139 * 11   4/14/08 1:17p erickson
140 * PR41730: move user buffer override from Open time to Start time to give
141 *  maximum flexibility
142 *
143 * 10   3/24/08 10:19a erickson
144 * PR40813: added bank param
145 *
146 * 9   3/11/08 4:26p erickson
147 * PR39836: clarify comment
148 *
149 * 8   3/10/08 1:28p erickson
150 * PR39836: enforce memory allocation rules for group masters. If the
151 *  group master Closes, all other sessions in the group must be Stopped.
152 *  Don't allow the group master to restart if there are other sessions
153 *  still active in the group.
154 *
155 * 7   3/4/08 3:31p erickson
156 * PR40080: add transport error callbacks
157 *
158 * 6   2/26/08 10:30p erickson
159 * PR39781: allow maxContiguousMessageSize == 0 for no data copy on wrap
160 *  around
161 *
162 * 5   2/26/08 9:53p erickson
163 * PR39836: update comments
164 *
165 * 4   2/4/08 10:07a erickson
166 * PR34925: remove unsupported enums
167 *
168 * 3   2/1/08 5:05p vsilyaev
169 * PR 38682: Added attributes to mark destructor and shutdown functions
170 *
171 * 2   1/30/08 6:16p vsilyaev
172 * PR 38682: Added attributes for memory translation
173 *
174 * 1   1/18/08 2:15p jgarrett
175 * PR 38808: Merging to main branch
176 *
177 * Nexus_Devel/12   1/8/08 9:27a erickson
178 * PR34925: update comments
179 *
180 * Nexus_Devel/11   11/29/07 2:24p erickson
181 * PR35457: doc update for 0.5 release
182 *
183 **************************************************************************/
184#ifndef NEXUS_MESSAGE_H__
185#define NEXUS_MESSAGE_H__
186
187#include "nexus_types.h"
188#include "nexus_pid_channel.h"
189
190#ifdef __cplusplus
191extern "C" {
192#endif
193
194/*
195Summary:
196Handle which represents one message filter on a PID.
197
198Description:
199The transport message filter HW is able to filter for PSI messages as well as capture (not filter) PES and TS data.
200NEXUS_Message cannot use a filter when capturing PES and TS packets. It captures all data on a pid. You can also use NEXUS_Recpump to do the same type of PES and TS capture.
201
202See nexus/examples/transport/message.c for an example application.
203*/
204typedef struct NEXUS_Message *NEXUS_MessageHandle;
205
206/*
207Summary:
208Settings needed for opening a message filter.
209
210Description:
211Note that some settings cannot be changed after NEXUS_Message_Open.
212*/
213typedef struct NEXUS_MessageSettings
214{
215    /* The following settings can only be set at NEXUS_Message_Open */
216    unsigned bufferSize; /* Size in bytes. Only certain buffer sizes may be supported by HW. This size will be rounded down to the nearest supported value.
217                            If you want to control the allocation and use of memory, set this to zero; then set NEXUS_MessageStartSettings.buffer. */
218    unsigned maxContiguousMessageSize; /* The maximum size PSI message that is guaranteed to be returned as a whole message from NEXUS_Message_GetBuffer.
219                                          For high bitrate message capture, set this to zero. This will ensure no data copy and GetBuffer will not
220                                          guarantee to return whole messages.
221                                          This does not apply to PES/TS capture. */
222   unsigned recpumpIndex; /* Only required for RAVE-based software message filtering. Enabled with NEXUS_USE_SW_FILTER=y compilation option.
223       Indicates which recpump to use for the RAVE record. Recpump is opened internally. Application needs to make sure not to re-use this recpump for anything else.
224       Filters on the same stream, of the same format, can share a recpump. But filters of different formats need to use different recpumps.
225       ie use a different recpump for each format ie PSI, TS & PES.  */
226
227
228    /* The following settings can be changed with NEXUS_Message_SetSettings */
229    NEXUS_CallbackDesc dataReady; /* Callback fires when data is in the buffer. After you receive a callback, call NEXUS_Message_GetBuffer to determine how much data is present.
230                                     If NEXUS_Message_GetBuffer returns non-zero, you must call NEXUS_Message_ReadComplete to re-enable the callback.
231                                     Even if you don't want to consume any data, you can call NEXUS_Message_ReadComplete with 0, but you will likely receive another callback immediately.
232                                     If NEXUS_Message_GetBuffer returns zero, dataReady will be re-enabled immediately by NEXUS_Message_GetBuffer. */
233    NEXUS_CallbackDesc overflow;  /* Callback fires when a buffer overflow occurs. No response required. */
234
235    NEXUS_CallbackDesc psiLengthError; /* Callback fires if there is an unexpected start of a PSI section in the middle of a current PSI section. The message will be dropped. */
236    NEXUS_CallbackDesc crcError;       /* Callback fires if there is a CRC error in the PSI section. The message will be dropped. */
237    NEXUS_CallbackDesc pesLengthError; /* Callback fires if a PUSI bit is detected in the middle of a PES packet. */
238    NEXUS_CallbackDesc pesStartCodeError; /* Callback fires if a packet with the PUSI set does not begin with 00 00 01. */
239} NEXUS_MessageSettings;
240
241/*
242Summary:
243The type of data being captured by the filter.
244*/
245typedef enum NEXUS_MessageFormat
246{
247    NEXUS_MessageFormat_ePsi,       /* Filter for Program Specific Information (PSI) from an MPEG2 Transport stream */
248    NEXUS_MessageFormat_ePes,       /* PES data capture. Captures PES packets with respect to PES packet length. */
249    NEXUS_MessageFormat_ePesSaveAll,/* PES data capture. Captures entire payload without respect to PES packet length. */
250    NEXUS_MessageFormat_eTs,        /* MPEG2 Transport data capture */
251    NEXUS_MessageFormat_eMax
252} NEXUS_MessageFormat;
253
254/*
255Summary:
256Deprecated: The number of messages being captured in the buffer.
257*/
258typedef enum NEXUS_MessageBufferMode
259{
260    NEXUS_MessageBufferMode_eOneMessage, /* captures only one message then stops */
261    NEXUS_MessageBufferMode_eOneBuffer,  /* captures as many messages as possible in one buffer, without wrapping, then stops */
262    NEXUS_MessageBufferMode_eContinuous, /* captures messages with wrapping and does not stop until requested by the user */
263    NEXUS_MessageBufferMode_eMax
264} NEXUS_MessageBufferMode;
265
266/*
267Summary:
268DSS message types
269*/
270typedef enum NEXUS_DssMessageType
271{
272    NEXUS_DssMessageType_eAuxOnlyPackets,
273    NEXUS_DssMessageType_eMpt,
274    NEXUS_DssMessageType_eRegular,
275
276    /* Regular messages with CAP filtering. Set pattern using NEXUS_Message_SetDssCapPattern. */
277    NEXUS_DssMessageType_eRegularCapFilter0,
278    NEXUS_DssMessageType_eRegularCapFilter1,
279    NEXUS_DssMessageType_eRegularCapFilter2,
280    NEXUS_DssMessageType_eRegularCapFilter3,
281    NEXUS_DssMessageType_eRegularCapFilter4,
282
283    NEXUS_DssMessageType_eMax
284} NEXUS_DssMessageType;
285
286
287/**
288Summary:
289Number of bytes in each filter.
290
291Description:
292This can be reconfigured to 32 bytes by building with export BXPT_FILTER_32=y.
293
294The message filter hardware block is composed of 512 filters, 4 bytes each.
295They are arranged as 16 columns (i.e. banks) and 32 rows (i.e. # of filters in a bank).
296The banks can be combined to support larger filters and fewer banks.
297
298The Magnum XPT software support two configurations:
299
300a) 16 byte filters in 4 banks, 32 filters per bank (verify: 16/4 * 4 * 32 = 512)
301b) 32 byte filters in 2 banks, 32 filters per bank (verify: 32/4 * 2 * 32 = 512)
302
303Magnum XPT software does not support 4, 8 or 64 byte filter configurations.
304**/
305#ifndef NEXUS_MESSAGE_FILTER_SIZE
306#define NEXUS_MESSAGE_FILTER_SIZE 16
307#endif
308
309/**
310Summary:
311Filter used to capture specific PSI messages muxed together on the same PID
312
313Description:
314This does not apply to PES or TS capture.
315
316All filtering is done using bit by bit comparisons.
317There are two types of masks that are used in conjuntion with the coefficient[] array.
318
319inclusion mask (mask) - for all inclusion mask bits that are unmasked
320    (set to 0) ALL of the corresponding bits in the
321    message must match the bits specified by the coefficient in order to
322    be included. If one bit differs, it will be excluded.
323
324exclusion mask (exclusion) - for all exclusion mask bits that are unmasked
325    (set to 0) at least one of the corresponding bits
326    in the message must NOT match the bits specified
327    by the coefficient in order to be included. If all of the bits
328    match, it will be excluded.
329
330Results from both comparisons are AND'd together to form the final pass/fail decision.
331
332Setting all bits in both inclusion mask and exclusion mask to 1's will result in the
333coefficent bits being ignored.
334
335Special note: By default, the filter skips over the 3rd byte
336    (i.e. the message length field). So:
337    NEXUS_MessageFilter.mask[0] filters on message_byte[0]
338    NEXUS_MessageFilter.mask[1] filters on message_byte[1]
339    NEXUS_MessageFilter.mask[2] filters on message_byte[3]
340    NEXUS_MessageFilter.mask[3] filters on message_byte[4] etc.
341 
342    The 3rd byte will be included if includeThirdFilterByte in
343the NEXUS_MessageStartSettings struct is set to true. The
344default value is false. 
345 
346The hardware allows the filtering to start at bytes other than
347the first byte in the message data. The filterOffset member of
348the NEXUS_MessageStartSettings struct sets a zero-based offset
349into the message data. This offset is applied after
350skipping/including the third byte (above). For example, if the
351filterOffset is 3 and the 3rd byte is not included, the above
352comparison becomes:
353 
354    NEXUS_MessageFilter.mask[0] filters on message_byte[4]
355    NEXUS_MessageFilter.mask[1] filters on message_byte[5]
356    NEXUS_MessageFilter.mask[2] filters on message_byte[6]
357    NEXUS_MessageFilter.mask[3] filters on message_byte[7] etc.
358 
359Although message filtering only does bitwise comparisons, it is
360possible to filter on certain integer ranges. You can test for
361byte values <= an upper bound, > a lower bound, or both. The
362bounds values must be 2^N-1. That is, the only bounds are FF,
363    7F, 3F, 1F, 0F, 07, 03, 01 and 00. The formulas are: data[x]
364    <= UPPER         : coef[x]=00; mask[x]=UPPER;
365    exclusion[x]=FF data[x] > LOWER          : coef[x]=00;
366    mask[x]=FF;    exclusion[x]=LOWER UPPER >= data[x] > LOWER :
367    coef[x]=00; mask[x]=UPPER; exclusion[x]=LOWER
368If you want to filter on ranges other than 2^N-1, you must first do HW filtering on a wider 2^N-1 range,
369then do more narrow SW filtering within those results.
370**/
371typedef struct NEXUS_MessageFilter
372{
373    uint8_t mask[NEXUS_MESSAGE_FILTER_SIZE];        /* inclusion mask for coefficient[]. See Description. */
374    uint8_t coefficient[NEXUS_MESSAGE_FILTER_SIZE]; /* bits to be included or excluded, depending on mask[] and exclusion[]. See Description. */
375    uint8_t exclusion[NEXUS_MESSAGE_FILTER_SIZE];   /* exclusion mask for coefficient[]. See Description. */
376} NEXUS_MessageFilter;
377
378/*
379Summary:
380Get default settings for the structure.
381
382Description:
383This is required in order to make application code resilient to the addition of new structure members in the future.
384*/
385void NEXUS_Message_GetDefaultSettings(
386    NEXUS_MessageSettings *pSettings /* [out] */
387    );
388
389/*
390Summary:
391Open a filter for capturing messages.
392
393Description:
394By default, a message buffer will be allocated per filter.
395This buffer can be reused for multiple Start/Stop sessions without having to be reallocated. This reduces memory fragmentation in the system.
396*/
397NEXUS_MessageHandle NEXUS_Message_Open( /* attr{destructor=NEXUS_Message_Close} */
398    const NEXUS_MessageSettings *pSettings /* attr{null_allowed=y} */
399    );
400
401/*
402Summary:
403Close the filter.
404*/
405void NEXUS_Message_Close(
406    NEXUS_MessageHandle handle
407    );
408
409/*
410Summary:
411Get settings which were set at NEXUS_Message_Open or the last call to NEXUS_Message_SetSettings.
412*/
413void NEXUS_Message_GetSettings(
414    NEXUS_MessageHandle handle,
415    NEXUS_MessageSettings *pSettings /* [out] */
416    );
417
418/*
419Summary:
420Set new settings
421
422Description:
423Read the comments in NEXUS_MessageSettings to see which individual settings will be updated by this function.
424*/
425NEXUS_Error NEXUS_Message_SetSettings(
426    NEXUS_MessageHandle handle,
427    const NEXUS_MessageSettings *pSettings
428    );
429
430/*
431Summary:
432Settings needed to start a message filter.
433*/
434
435typedef struct NEXUS_MessageStartSettings
436{
437    NEXUS_PidChannelHandle pidChannel;  /* Input to message filter */
438
439    NEXUS_MessageFormat format;         /* Type of data to capture. Defaults to ePsi. */
440    NEXUS_MessageBufferMode bufferMode; /* Deprecated */
441    int bank; /* Select filter bank 0..3. If -1, Nexus will automatically select the bank. Default is -1. */
442
443    NEXUS_MessageFilter filter;         /* See structure for documentation. */
444    bool filterGroup;                   /* Filter group support allows multiple filters to multiplex their messages into a single buffer.
445                                           For older silicon, this was required for multiple filters on the same pid. See NEXUS_USE_MSGLIB in transport.inc
446                                           and Nexus_Usage.pdf for this legacy support.
447                                           For newer silicon, it can optionally be turned on, but must be used with NEXUS_Message_AddFilter and Nexus will not
448                                           do any automatic demuxing of the messages. The application will need to demux the messages. */
449    bool psiCrcDisabled;                /* Disable CRC checks on PSI information */
450    bool psfCrcDisabled;                /* Disable CRC checks on short form private sections */
451
452    void *buffer;        /* attr{memory=cached} Optional user-supplied memory buffer which is bufferSize in length.
453                            You must allocate this buffer with NEXUS_Memory_Allocate. Must be 1K aligned.
454                            If NULL, Nexus will use the buffer allocated with NEXUS_MessageSettings.bufferSize.
455                            See NEXUS_Message_Open for usage modes. */
456    unsigned bufferSize; /* Size in bytes. Only certain buffer sizes may be supported by HW. The actual size used will be rounded down to the nearest supported value. */
457
458    NEXUS_DssMessageType dssMessageType;
459    bool useRPipe;
460
461    unsigned filterOffset;       /* offset all filters by this number of bytes */
462    bool includeThirdFilterByte; /* default to false. if filterOffset is non-zero, you will likely want to set this to true. */
463} NEXUS_MessageStartSettings;
464
465/*
466Summary:
467Get default settings for the structure.
468
469Description:
470This is required in order to make application code resilient to the addition of new structure members in the future.
471
472Default settings will result in all PSI data being returned for a given PID.
473*/
474void NEXUS_Message_GetDefaultStartSettings(
475    NEXUS_MessageHandle handle,
476    NEXUS_MessageStartSettings *pStartSettings /* [out] */
477    );
478
479/*
480Summary:
481Start capturing data with this filter.
482*/
483NEXUS_Error NEXUS_Message_Start(
484    NEXUS_MessageHandle handle,
485    const NEXUS_MessageStartSettings *pStartSettings
486    );
487
488/*
489Summary:
490Get a default filter before calling NEXUS_Message_AddFilter.
491*/
492void NEXUS_Message_GetDefaultFilter(
493    NEXUS_MessageFilter *pFilter
494    );
495
496/*
497Summary:
498Add an additional filter to an already-started message filter session
499
500Description:
501Any messages captured by this additional filter will be multiplexed into the
502NEXUS_MessageHandle's single buffer. It is the application's responsibility to
503demux those messages.
504
505NEXUS_Message_AddFilter must be called after NEXUS_Message_Start.
506The additional filter will be applied on the same pid channel, bank, etc.
507*/
508NEXUS_Error NEXUS_Message_AddFilter(
509    NEXUS_MessageHandle handle,
510    const NEXUS_MessageFilter *pFilter,
511    unsigned *pFilterNum /* [out] */
512    );
513
514/*
515Summary:
516Remove a filter added with NEXUS_Message_AddFilter
517
518Description:
519If you call NEXUS_Message_Stop, all filters added with NEXUS_Message_AddFilter are automatically
520removed. NEXUS_Message_RemoveFilter is only needed when you want to remove a single filter
521from a message filter session which must continue running.
522*/
523NEXUS_Error NEXUS_Message_RemoveFilter(
524    NEXUS_MessageHandle handle,
525    unsigned filterNum
526    );
527
528#define NEXUS_MESSAGE_MAIN_FILTER_NUM ((unsigned)-1)
529
530/*
531Summary:
532Update a filter that's already been started
533*/
534NEXUS_Error NEXUS_Message_UpdateFilter(
535    NEXUS_MessageHandle handle,
536    unsigned filterNum, /* use NEXUS_MESSAGE_MAIN_FILTER_NUM to update the filter set with NEXUS_MessageStartSettings.filter.
537                           else, use the filterNum returned by NEXUS_Message_AddFilter. */
538    const NEXUS_MessageFilter *pFilter
539    );
540
541/*
542Summary:
543Stop capturing messages with this filter.
544
545Description:
546You can restart this filter with different MessageStartSettings.
547You cannot call NEXUS_Message_GetBuffer or NEXUS_Message_ReadComplete after calling NEXUS_Message_Stop.
548*/
549void NEXUS_Message_Stop(
550    NEXUS_MessageHandle handle
551    );
552
553/**
554Summary:
555Get a pointer to a message captured for this filter.
556
557Description:
558Nexus will always return whole PSI messages if maxContiguousMessageSize is >= the largest PSI message and if the application always
559calls NEXUS_Message_ReadComplete on whole messages (including the pad). If you call NEXUS_Message_ReadComplete with partial message length, then NEXUS_Message_GetBuffer will return the partial amount remaining in the buffer.
560
561You can call NEXUS_Message_GetBuffer multiple times without changing Message state. It is not destructive.
562You cannot call NEXUS_Message_GetBuffer after calling NEXUS_Message_Stop.
563
564One call to NEXUS_Message_GetBuffer may retrieve zero, one or more messages.
565**/
566NEXUS_Error NEXUS_Message_GetBuffer(
567    NEXUS_MessageHandle handle,
568    const void **pBuffer, /* [out] attr{memory=cached} Pointer to cached memory where the next message to be processed by the caller is stored.
569        Note that this may not come from MessageSettings.buffer. It may come from an internal buffer if maxContiguousMessageSize > 0,
570        or may come from a group buffer (another filter in the same filter group).
571        Returns NULL if no data is available. */
572    size_t *pLength /* [out] Number of bytes pointed to by pBuffer. Returns 0 if no data is available. */
573    );
574
575/**
576Summary:
577Get two pointers to a message captured for this filter, both before and after the wrap around.
578
579Description:
580See NEXUS_Message_GetBuffer for general usage.
581
582NEXUS_Message_GetBufferWithWrap requires maxContiguousMessageSize=0.
583
584If NEXUS_Message_GetBufferWithWrap returns non-zero sizes for pLength and pLength2, you may call NEXUS_Message_ReadComplete with any number <= their sum.
585**/
586NEXUS_Error NEXUS_Message_GetBufferWithWrap(
587    NEXUS_MessageHandle handle,
588    const void **pBuffer, /* [out] attr{memory=cached} data before wrap. Returns NULL if no data is available. */
589    size_t *pLength, /* [out] Number of bytes pointed to by pBuffer. Returns 0 if no data is available. */
590    const void **pBuffer2, /* [out] attr{memory=cached} data after wrap. Returns NULL if no data is available. */
591    size_t *pLength2 /* [out] Number of bytes pointed to by pBuffer2. Returns 0 if no data is available. */
592    );
593
594/*
595Summary:
596Report back how much data was consumed from the last NEXUS_Message_GetBuffer call.
597
598Description:
599It must be <= the length returned by NEXUS_Message_GetBuffer.
600If < length, you must call NEXUS_Message_GetBuffer again to reobtain the pointer to the buffer.
601That is, you cannot call NEXUS_Message_ReadComplete more than once after each NEXUS_Message_GetBuffer.
602You cannot call NEXUS_Message_ReadComplete after calling NEXUS_Message_Stop.
603
604You can call NEXUS_Message_ReadComplete with amountConsumed == 0.
605
606NEXUS_Message_ReadComplete must be called to re-enable the dataReady callback if you received a callback and NEXUS_Message_GetBuffer returns a non-zero value.
607
608The transport message filtering hardware ensure 4 byte alignment by adding up to 3 padding bytes as needed.
609The length returned by NEXUS_Message_GetBuffer includes this pad.
610However, when you parse the length field from the PSI section data, it will not include this pad.
611If your message length is not 4 byte aligned and if you call ReadComplete based on message size, then
612you need to factor in this pad to your amountConsumed. For example:
613
614    if (message_size % 4) {
615        message_size = message_size - (message_size % 4) + 4;
616    }
617    NEXUS_Message_ReadComplete(msg, message_size)
618
619*/
620NEXUS_Error NEXUS_Message_ReadComplete(
621    NEXUS_MessageHandle handle,
622    size_t amountConsumed /* number of bytes the caller has processed. Must be <= the length returned by last call to NEXUS_Message_GetBuffer. */
623    );
624
625/*
626Summary:
627Status information
628*/
629typedef struct NEXUS_MessageStatus
630{
631    unsigned groupMembers; /* total number of filters in the filter group, including this session */
632    bool isGroupMaster; /* true if this session is the group master */
633    bool moreDataAvailable; /* set to true if the last NEXUS_Message_GetBuffer call detected that more data is available on a wrap around */
634} NEXUS_MessageStatus;
635
636/*
637Summary:
638Get status information about the session
639*/
640NEXUS_Error NEXUS_Message_GetStatus(
641    NEXUS_MessageHandle handle,
642    NEXUS_MessageStatus *pStatus /* [out] */
643    );
644
645/*
646Summary:
647Set CAP pattern corresponding to each NEXUS_DssMessageType_eRegularCapFilter type
648*/
649NEXUS_Error NEXUS_Message_SetDssCapPattern(
650    unsigned capFilterIndex, /* 0 corresponds to NEXUS_DssMessageType_eRegularCapFilter0, etc. */
651    uint32_t pattern /* 32-bit CAP pattern */
652    );
653
654#ifdef __cplusplus
655}
656#endif
657
658#endif
Note: See TracBrowser for help on using the repository browser.