source: svn/newcon3bcm2_21bu/nexus/modules/transport/7552/include/nexus_packetsub.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: 12.3 KB
Line 
1/***************************************************************************
2 *     (c)2003-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_packetsub.h $
39 * $brcm_Revision: 9 $
40 * $brcm_Date: 12/19/11 11:13a $
41 *
42 * Porting interface code for the packet substitution section of the
43 * data transport core.
44 *
45 * Revision History:
46 *
47 * $brcm_Log: /nexus/modules/transport/7400/include/nexus_packetsub.h $
48 *
49 * 9   12/19/11 11:13a erickson
50 * SW7405-5325: decrease default num to 2, add destructor attribute
51 *
52 * 8   12/16/11 11:43a erickson
53 * SW7405-5325: rework packetsub to use array of descriptors, allow for
54 *  skip in the fifo, add dataCallback
55 *
56 * 7   7/11/11 11:40a jtna
57 * SW7420-879: clarified usage of NEXUS_PacketSubSettings.pidchannel.
58 *  removed NEXUS_PacketSubSettings.forcedInsertion.
59 *
60 * 6   5/16/11 9:36a erickson
61 * SW7405-5323: add NEXUS_PacketSubStatus.busy
62 *
63 * 5   5/13/11 12:18p erickson
64 * SW7420-1873: remove shutdown attribute
65 *
66 * 4   9/15/10 4:24p erickson
67 * SW7125-621: add NEXUS_PacketSub_GetStatus
68 *
69 * 3   8/10/10 3:41p erickson
70 * SW7420-934: rename NEXUS_PacketSub_ReadComplete to
71 *  NEXUS_PacketSub_WriteComplete
72 *
73 * 2   3/24/10 12:47p erickson
74 * SWDEPRECATED-3823: fix cplusplus extern
75 *
76 * 1   5/26/09 11:39a erickson
77 * PR55105: add packet sub api
78 *
79 ***************************************************************************/
80#ifndef NEXUS_PACKETSUB_H__
81#define NEXUS_PACKETSUB_H__
82
83#include "nexus_pid_channel.h"
84
85#ifdef __cplusplus
86extern "C" {
87#endif
88
89#ifndef NEXUS_NUM_PACKET_SUB
90#define NEXUS_NUM_PACKET_SUB 2
91#endif
92
93/***************************************************************************
94Summary:
95Handle for packet substition (PSUB) channel returned by NEXUS_PacketSub_Open
96
97Be aware that "packet substition" does not substitute data packets. It inserts
98new data packets without replacing old data packets.
99By default PSUB inserts those new packets into bandwidth openings created
100by dropping NULL packets. So, it is a bandwidth substition, not a data substitution.
101If you set forcedOutput=true, then there is no substitution at all, only unconditional insertion.
102****************************************************************************/
103typedef struct NEXUS_PacketSub *NEXUS_PacketSubHandle;
104
105/***************************************************************************
106Summary:
107Settings used in NEXUS_PacketSub_Open
108****************************************************************************/
109typedef struct NEXUS_PacketSubOpenSettings
110{
111    unsigned fifoSize;       /* Size of buffer for adding data to be inserted */
112    NEXUS_HeapHandle heap;   /* Heap from which to allocate the buffer */
113    unsigned numDescriptors; /* one descriptor is needed per pending WriteComplete calls */
114} NEXUS_PacketSubOpenSettings;
115
116/***************************************************************************
117Summary:
118Get default settings before calling NEXUS_PacketSub_Open
119****************************************************************************/
120void NEXUS_PacketSub_GetDefaultOpenSettings(
121    NEXUS_PacketSubOpenSettings *pSettings /* [out] */
122    );
123
124/***************************************************************************
125Summary:
126Open a packet substitution channel
127****************************************************************************/
128NEXUS_PacketSubHandle NEXUS_PacketSub_Open( /* attr{destructor=NEXUS_PacketSub_Close} */
129    unsigned index,
130    const NEXUS_PacketSubOpenSettings *pSettings /* attr{null_allowed=y} */
131    );
132
133/***************************************************************************
134Summary:
135Close a packet substitution channel
136****************************************************************************/
137void NEXUS_PacketSub_Close(
138    NEXUS_PacketSubHandle packetSub
139    );
140
141/***************************************************************************
142Summary:
143Start packet substitution on this channel
144
145Description:
146All data must be added to the buffer using NEXUS_PacketSub_GetBuffer and NEXUS_PacketSub_WriteComplete before starting.
147You cannot call NEXUS_PacketSub_GetBuffer and NEXUS_PacketSub_WriteComplete after starting.
148****************************************************************************/
149NEXUS_Error NEXUS_PacketSub_Start(
150    NEXUS_PacketSubHandle packetSub
151    );
152
153/***************************************************************************
154Summary:
155Stop a packet substitution
156
157Description:
158After calling stop, the buffer is not cleared. If you want to clear the buffer and
159add new data, call NEXUS_PacketSub_Flush.
160****************************************************************************/
161void NEXUS_PacketSub_Stop(
162    NEXUS_PacketSubHandle packetSub
163    );
164
165/***************************************************************************
166Summary:
167Settings used in NEXUS_PacketSub_SetSettings
168****************************************************************************/
169typedef struct NEXUS_PacketSubSettings
170{
171    NEXUS_PidChannelHandle pidChannel; /* Pid channel that data will be inserted into. This does not imply that data will be substituted on this channel.
172                                          This must be set before call to NEXUS_PacketSub_Start. Playback pid channels are not supported. */
173
174    bool highPriorityDma; /* Prioritize between PSUB channels on the same pid channel. High priority channels will insert before low priority. */
175    bool forcedOutput;    /* Force packets into stream. Do not wait for an available slot. This could cause any packet in the stream to be overwritten. */
176    bool fullRateOutput;  /* Insert a packet at every available slot in the stream. This causes outputRate to be ignored. */
177    unsigned outputRate;  /* The rate at which a single packet should be inserted, in bits/second.
178                             If you specify 188*8*2, then PSUB will insert two packets per second.
179                             If you have 16 PMT packets that you want inserted once every second, you should specify 16*188*8. */
180
181    bool loop;            /* continually loop the data into the PSUB channel. only one WriteComplete is allowed. */
182
183    NEXUS_CallbackDesc dataCallback; /* A descriptor has completed. You can call GetBuffer and submit more data. */
184    NEXUS_CallbackDesc finished; /* All data has been fed into HW. Corresponds to NEXUS_PacketSubStatus.finished. */
185} NEXUS_PacketSubSettings;
186
187/***************************************************************************
188Summary:
189Set new settings
190****************************************************************************/
191NEXUS_Error NEXUS_PacketSub_SetSettings(
192    NEXUS_PacketSubHandle packetSub,
193    const NEXUS_PacketSubSettings *pSettings
194    );
195
196/***************************************************************************
197Summary:
198Get current settings
199****************************************************************************/
200void NEXUS_PacketSub_GetSettings(
201    NEXUS_PacketSubHandle packetSub,
202    NEXUS_PacketSubSettings *pSettings /* [out] */
203    );
204
205/***************************************************************************
206Summary:
207Status
208****************************************************************************/
209typedef struct NEXUS_PacketSubStatus
210{
211    bool finished; /* set true after all data has been fed into HW. data may not have been fed into stream yet.
212                      this will never be true if NEXUS_PacketSubSettings.loop is true. */
213    bool busy;     /* set true if data is being fed into stream. when finished is true and busy is false, then
214                      all the data has been read into HW and fed into the stream. */
215} NEXUS_PacketSubStatus;
216
217/***************************************************************************
218Summary:
219Get status
220****************************************************************************/
221NEXUS_Error NEXUS_PacketSub_GetStatus(
222    NEXUS_PacketSubHandle packetSub,
223    NEXUS_PacketSubStatus *pSettings /* [out] */
224    );
225
226/***************************************************************************
227Summary:
228Pause or unpause
229****************************************************************************/
230NEXUS_Error NEXUS_PacketSub_SetPause(
231    NEXUS_PacketSubHandle packetSub,
232    bool paused
233    );
234
235/***************************************************************************
236Summary:
237Get buffer for adding data to be inserted
238
239Description:
240The underlying hardware is descriptor-based, which supports scatter-gather usage.
241However, because most usage of packet substitution is simple, the Nexus API was designed to be like most
242of the other data feed API's in Nexus (using GetBuffer/ReadComplete).
243
244All data must be added before calling NEXUS_PacketSub_Start. Because of this, the underlying implementation is not
245actually a ring buffer.
246If you want the data to be fed in a continual loop, set NEXUS_PacketSubSettings.loop = true.
247****************************************************************************/
248NEXUS_Error NEXUS_PacketSub_GetBuffer(
249    NEXUS_PacketSubHandle packetSub,
250    void **pBuffer, /* [out] */
251    unsigned *pSize /* [out] */
252    );
253
254/***************************************************************************
255Summary:
256Report amount of data written into the buffer returned by NEXUS_PacketSub_GetBuffer
257****************************************************************************/
258NEXUS_Error NEXUS_PacketSub_WriteComplete(
259    NEXUS_PacketSubHandle packetSub,
260    unsigned amount
261    );
262
263/***************************************************************************
264Summary:
265Report amount of data written into the buffer returned by NEXUS_PacketSub_GetBuffer
266along with amount skipped before the data
267****************************************************************************/
268NEXUS_Error NEXUS_PacketSub_WriteCompleteWithSkip(
269    NEXUS_PacketSubHandle packetSub,
270    unsigned skip,
271    unsigned amount
272    );
273
274#define NEXUS_PacketSub_ReadComplete NEXUS_PacketSub_WriteComplete
275
276/***************************************************************************
277Summary:
278Flush data from the buffer
279****************************************************************************/
280void NEXUS_PacketSub_Flush(
281    NEXUS_PacketSubHandle packetSub
282    );
283
284#ifdef __cplusplus
285}
286#endif
287
288#endif /* #ifndef NEXUS_PACKETSUB_H__ */
289
Note: See TracBrowser for help on using the repository browser.