source: svn/newcon3bcm2_21bu/nexus/app/bsettop_smessage.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: 11.6 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-2006, Broadcom Corporation
3 *     All Rights Reserved
4 *     Confidential Property of Broadcom Corporation
5 *
6 *  THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE
7 *  AGREEMENT  BETWEEN THE USER AND BROADCOM.  YOU HAVE NO RIGHT TO USE OR
8 *  EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
9 *
10 * $brcm_Workfile: bsettop_smessage.h $
11 * $brcm_Revision: $
12 * $brcm_Date: $
13 *
14 * Module Description:
15 * Message filtering and raw ts capture api. Note inconsistent naming of
16 * types and members in the structures. It was done in attempt to preserve
17 * similarity with bsettop_message.h api.
18 * Revision History:
19 *
20 * $brcm_Log: $
21 *
22 *
23 ***************************************************************************/
24
25#ifndef __BSETTOP_SMESSAGE_H__
26#define __BSETTOP_SMESSAGE_H__
27
28#include "bapp_types.h"
29
30/***************************************************************************
31Summary:
32message stream handle.
33SeeAlso:
34None
35***************************************************************************/
36typedef struct smessage_stream * smessage_stream_t;
37/***************************************************************************
38Summary:
39        Section filter structure, See register reference for typical use with
40        Broadcom chips.
41***************************************************************************/
42typedef struct smessage_filter {
43        uint8_t mask[16];       /* Bits to be ignored. See Description. */
44        uint8_t coef[16];       /* Bits to be included. See Description. */
45        uint8_t excl[16];       /* Bits to be excluded. Doesn't apply to Venom2 platforms. See Description. */
46} smessage_filter;
47
48/***************************************************************************
49Summary:
50Message capture format enumeration. Following formats are supported:
51
52smessage_format_ts - capture raw ts data in to circular buffer
53smessage_format_tsc - capture ts data in to provided buffer with callback
54smessage_format_psi - capture psi sections in to provided buffer with callback
55
56Circular buffer for raw ts capture is allocated internaly by the module, in
57case of smessage_format_tsc and smessage_format_psi buffer must be allocated by
58caller and pointer provided as part of smessage_stream_params_t structure.
59SeeAlso:
60smessage_open
61***************************************************************************/
62typedef enum smessage_format_t {
63    smessage_format_ts,
64    smessage_format_tsc,
65    smessage_format_psi
66} smessage_format;
67
68/***************************************************************************
69Summary:
70Message callback type.
71Description:
72Application must provide function of this type to be called when message is
73captured by message filters. This is the only way for application to obtain
74the message.
75After this call is called messages no longer will be captured by this filter
76unless callback returns non NULL pointer. User must stop and restart
77filter to resume message capture.
78User can not call any smessage_* api from this callback or deadlock will
79result. This callback is called directly from the filter task and it must
80return fast. Delaying return from callback will adversly impact message filter
81performance and may result in overflow for all other filters. If user has to
82do substantial work he must convey the information to another task and do the
83work in another context. If NULL is returned by callback message filtering
84will stop for this filter. If non NULL pointer is returned filtering will
85continue in to the buffer pointed by this pointed.
86Input:
87context - user context provided when message capture is started.
88data_size - size of message captured in the provided buffer.
89Returns:
90New buffer pointer to use for next message capture or NULL if no more messages
91should be captured and operation of filter should be suspended. If filter
92should continue to capture messages in to old buffer, callback should return
93same pointer that was originally passed to the start function. Size of the new
94buffer must be same or larger than the size of the buffer passed in to the
95smessage_start function.
96SeeAlso:
97smessage_stream_params_t
98***************************************************************************/
99typedef void * (*smessage_callback)(void * context, size_t data_size);
100
101/***************************************************************************
102Summary:
103Invalid pid channel definition.
104Description:
105Constant signifying that this pid channel is invalid and defaul algorithm
106for choosing pid channel should be used by mesage filter.
107***************************************************************************/
108#define SMESSAGE_INVALID_CHANNEL (0xffff)
109
110/***************************************************************************
111Summary:
112Parameters for smessage_start function
113Description:
114Structure providing parameters for the smessage_start function.
115
116band - parser band
117pid - pid to filter on
118pid_channel - optional pid channel supplied by the caller. This field is set
119 to SMESSAGE_INVALID_CHANNEL by smessage_stream_params_init function. If
120 user does not chage this field, message filter will allocate pid channel
121 internally, else it will use value provided in this field.
122filter - message filter
123buffer - buffer for complete message
124buffer_size - size of the buffer
125crc_disabled - disable crc checking, crc checking enabled by default.
126data_ready_callback - notification callback invoked when message is captured.
127overflow - notification callback invoked when overflow happens.
128
129Only following parameters are used when stream is captured in to circular
130buffer - band, pid, pid_channel, buffer_size. All other parameters are ignored.
131
132SeeAlso:
133smessage_stream_params_init, smessage_start
134***************************************************************************/
135typedef struct smessage_stream_params_tag {
136    bband_t band;
137    uint16_t pid;
138    uint16_t pid_channel;
139    smessage_filter filter;
140    void * buffer;
141    size_t buffer_size;
142    bool crc_disabled;
143    smessage_callback data_ready_callback;
144    smessage_callback overflow;
145    void * callback_context;
146    void * priv;
147} smessage_stream_params_t;
148
149/***************************************************************************
150Summary:
151Initialize message subsystem.
152Description:
153Initialize message subsystem. No other funtions can be called before this
154function is called or results of other function calls are undefined.
155Input:
156decode_cfgs - decoder configuration.
157Returns:
158b_ok if success, error code otherwise.
159SeeAlso:
160None
161***************************************************************************/
162bresult smessage_init(void *ctx);
163
164/***************************************************************************
165Summary:
166Initialise parameters with default values.
167Description:
168Initialise parameters with default values.
169Input:
170params - parameter structure to fill with default values.
171stream - stream for which to fill the structure.
172Returns:
173None
174SeeAlso:
175None
176***************************************************************************/
177void smessage_stream_params_init( smessage_stream_params_t *params, smessage_stream_t stream);
178
179/***************************************************************************
180Summary:
181Open message with desired format.
182Description:
183This call returns message handle which obtained from internal list. Be sure to
184call smessage_close after handle is no longer needed. Failing to do so will
185result in memory leak and running out of handles.
186Input:
187format - desired format for the message capture.
188Returns:
189smessage_stream_t handle or NULL if the call fails.
190SeeAlso:
191smessage_close
192***************************************************************************/
193smessage_stream_t smessage_open(smessage_format format);
194
195/***************************************************************************
196Summary:
197Start message capture.
198Description:
199This call will start message filtering. When message is captured it will be
200copied in to the provided buffer and callback will be called. After message is
201captured this filter will be disabled if NULL is returned by callback. If
202caller desires to continue message filtering, callback should return a pointer
203to the buffer in which to capture next message.
204If message callback returns NULL and user wants to resume filtering, message
205filter should be stopped and restarted with new parameters by calling this
206api again.
207This call will start capture and immediately return.
208Input:
209params - parameters for message capture
210stream - stream handle for which to start capture.
211Returns:
212b_ok if capture was started, error code otherwise.
213SeeAlso:
214smessage_stop, smessage_stream_params_init
215***************************************************************************/
216bresult smessage_start(const smessage_stream_params_t * params, smessage_stream_t stream);
217
218/***************************************************************************
219Summary:
220Stop message capture.
221Description:
222Stop message capture and if possible free internal hardware and software
223resources.
224Input:
225stream - stream for which to stop message capture.
226Returns:
227b_ok if capture was stopped, error code otherwise.
228SeeAlso:
229smessage_stop
230***************************************************************************/
231bresult smessage_stop(smessage_stream_t stream);
232
233/***************************************************************************
234Summary:
235Close message capture for given stream.
236Description:
237Close message capture for given stream and return stream to the list of free
238streams. Usaer must call smessage_stop before calling this api and user must
239call this api if he no longer needs stream handle. If this api is not called
240stream handle will be leaked and eventually system will run out of stream
241handles as they are limited.
242Input:
243stream - stream handle to free.
244Returns:
245None
246SeeAlso:
247smessage_open
248***************************************************************************/
249void smessage_close(smessage_stream_t stream);
250
251/***************************************************************************
252Summary:
253Get circular buffer pointer for the stream capture buffer.
254Description:
255Get circular buffer pointer for the stream capture buffer. This call is valid
256only for some types of message capture and using it for any other type will
257result in error.
258Input:
259stream - desired stream handle
260pbuffer - pointer to the pointer to buffer. After function returns this
261          variable will contain pointer to the start of avaiable data.
262plength - pointer to the length of the data. After function returns this
263variable will contain lenth of the valid data in the buffer.
264Returns:
265b_ok if call was successful error otherwise. If error is retured values of
266*pbuffer and *plength are not defined and should be discarded.
267SeeAlso:
268smessage_read_complete, smessage_start
269***************************************************************************/
270bresult smessage_get_buffer(smessage_stream_t stream, const void ** pbuffer, size_t * plength);
271
272/***************************************************************************
273Summary:
274Notify circular buffer about amount of comsumed data.
275Description:
276Notify circular buffer about amount of consumed data and advance read pointer.
277This call is valid only for some types of message capture and using it for any
278other type will result in error. Attempt to consume more data that is avalable
279in the circular buffer will result in error.
280Input:
281stream - desired stream handle
282consumed - amount of data that was consumed. Read pointer will be advanced by
283that amount.
284Returns:
285b_ok if call was successful error otherwise.
286SeeAlso:
287smessage_get_buffer, smessage_start
288***************************************************************************/
289bresult smessage_read_complete(smessage_stream_t stream, size_t consumed);
290
291#endif /*__BSETTOP_SMESSAGE_H__*/
Note: See TracBrowser for help on using the repository browser.