source: svn/trunk/newcon3bcm2_21bu/magnum/portinginterface/grc/7552/bgrc_packet.h

Last change on this file was 2, checked in by jglee, 11 years ago

first commit

  • Property svn:executable set to *
File size: 12.7 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2009-2011, 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: bgrc_packet.h $
11 * $brcm_Revision: Hydra_Software_Devel/29 $
12 * $brcm_Date: 11/29/11 4:22p $
13 *
14 * Module Description: GRC Packet header
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/portinginterface/grc/7405/bgrc_packet.h $
19 *
20 * Hydra_Software_Devel/29   11/29/11 4:22p nissen
21 * SW7425-1795: Changed to BMEM_Handle.
22 *
23 * Hydra_Software_Devel/28   11/22/11 6:26p nissen
24 * SW7425-1795: Added heap field to BGRC_PacketContext_CreateSettings
25 * structure for packet memory allocations.
26 *
27 * Hydra_Software_Devel/27   12/6/10 12:49p nissen
28 * SW7420-1138: Added support for validating memory bounds used by blits.
29 *
30 * Hydra_Software_Devel/26   11/11/10 5:36p nissen
31 * SW7420-1200: Added support for storing packets before submitting,
32 * through a field in the context's create settings structure.
33 *
34 * Hydra_Software_Devel/25   9/3/10 4:21p nissen
35 * SW7405-4810: Added BGRC_Packet_GetStatus function.
36 *
37 * Hydra_Software_Devel/24   7/21/10 4:30p nissen
38 * SW7405-3671: Added support for user supplying private data ptr during
39 * context creation which gets passed back when getting status.
40 *
41 * Hydra_Software_Devel/23   7/15/10 9:06p nissen
42 * SW7405-3671: Added more interrupt support.
43 *
44 * Hydra_Software_Devel/22   7/12/10 2:36p nissen
45 * SW7405-3671: Updated api functions.
46 *
47 * Hydra_Software_Devel/21   6/30/10 9:29p nissen
48 * SW7405-3671: Updated color matrix and filter conversion functions.
49 *
50 * Hydra_Software_Devel/20   6/30/10 7:53p nissen
51 * SW7405-3671: Updated pixel format conversion function and removed blend
52 * conversion function.
53 *
54 * Hydra_Software_Devel/19   6/24/10 2:18p nissen
55 * SW7405-3671: Added source feeder destripe packet function.
56 *
57 * Hydra_Software_Devel/18   6/21/10 2:25p nissen
58 * SW7405-3671: Fixed packet settings.
59 *
60 * Hydra_Software_Devel/17   6/21/10 12:41p nissen
61 * SW7405-3671: Added context support. Switched to M2MC packets.
62 *
63 * Hydra_Software_Devel/16   3/19/10 2:33p nissen
64 * SW7405-3671: Fixed alpha premultiply.
65 *
66 * Hydra_Software_Devel/15   3/11/10 1:14p nissen
67 * SW7405-3671: Added support for alpha premultiply.
68 *
69 * Hydra_Software_Devel/14   3/10/10 2:50p nissen
70 * SW7405-3671: Added offset buffer pointers to batch packet blits.
71 *
72 * Hydra_Software_Devel/13   2/10/10 2:16p nissen
73 * SW7405-3671: Fixed palette to palette blits.
74 *
75 * Hydra_Software_Devel/12   2/9/10 4:35p nissen
76 * SW7405-3671: Updated batch blits.
77 *
78 * Hydra_Software_Devel/11   2/8/10 6:00p nissen
79 * SW7405-3671: Updated batching to submit as many blits as possible.
80 *
81 * Hydra_Software_Devel/10   2/5/10 8:20p nissen
82 * SW7405-3671: Fixed palette to palette blits.
83 *
84 * Hydra_Software_Devel/9   2/5/10 12:08p nissen
85 * SW7405-3671: Fixed problem with init packet.
86 *
87 * Hydra_Software_Devel/8   2/5/10 10:50a nissen
88 * SW7405-3671: Moved packet function.
89 *
90 * Hydra_Software_Devel/7   2/3/10 2:01p nissen
91 * SW7405-3671: Added batch packets.
92 *
93 * Hydra_Software_Devel/6   1/29/10 7:20p nissen
94 * SW7405-3671: Added support for using packets in any order.
95 *
96 * Hydra_Software_Devel/5   1/19/10 4:45p nissen
97 * SW7405-3671: Added support for different M2MC cores.
98 *
99 * Hydra_Software_Devel/4   1/19/10 12:31p nissen
100 * SW7405-3671: Added support for sync'ing and 420 destriping.
101 *
102 * Hydra_Software_Devel/3   1/8/10 2:26p nissen
103 * SW7405-3671: Removed buffer size parameters when opening packet module.
104 *
105 * Hydra_Software_Devel/2   12/31/09 10:17p nissen
106 * SW7405-3671: Added palette support and software striping while scaling
107 * support.
108 *
109 * Hydra_Software_Devel/1   12/24/09 1:10a nissen
110 * SW7405-3671: Packet blits
111 *
112 ***************************************************************************/
113
114#ifndef BGRC_PACKET_H__
115#define BGRC_PACKET_H__
116
117#ifdef __cplusplus
118extern "C" {
119#endif
120
121#include "bm2mc_packet.h"
122#include "berr_ids.h"
123
124/***************************************************************************/
125typedef struct BGRC_P_PacketContext *BGRC_PacketContext_Handle;
126
127/***************************************************************************/
128#define BGRC_PACKET_MSG_PACKETS_INCOMPLETE   BERR_MAKE_CODE(BERR_GRC_ID, 0x0100)
129#define BGRC_PACKET_MSG_BLITS_COMPLETE       BERR_MAKE_CODE(BERR_GRC_ID, 0x0101)
130
131/***************************************************************************/
132typedef struct
133{
134        BMEM_Handle packet_buffer_heap;      /* heap for packet buffer allocations */
135        size_t packet_buffer_size;           /* size of packet ring buffer to allocate */
136        size_t packet_buffer_store;          /* size of packet buffer to store before submitting */
137        void *private_data;                  /* ptr passed back to the user when getting status */
138        struct {
139                uint32_t offset;                 /* bounded memory offset (0=no bounds check) */
140                size_t size;                     /* bounded memory size  (0=no bounds check)*/
141        } memory_bounds;                     /* verify blits do not violate memory bounds */
142}
143BGRC_PacketContext_CreateSettings;
144
145/***************************************************************************/
146typedef struct
147{
148        BGRC_PacketContext_Handle hContext;
149        void *private_data;               /* ptr to user's private data */
150        size_t packet_buffer_available;   /* size of available packet memory */
151        bool sync;                        /* indicates blit sync */
152}
153BGRC_Packet_ContextStatus;
154
155/***************************************************************************/
156typedef struct
157{
158        bool m2mc_busy;                   /* indicates m2mc is busy */
159}
160BGRC_Packet_Status;
161
162/***************************************************************************
163 PACKET API - MAIN FUNCTIONS
164 ***************************************************************************/
165/***************************************************************************
166Set one callback for all contexts, which overrides any context callbacks.
167Either a single callback will be called for all interrupts, or context's
168can get their own callbacks using BGRC_Packet_SetContextCallbacks.
169 ***************************************************************************/
170BERR_Code BGRC_Packet_SetCallback(
171        BGRC_Handle hGrc,
172        BGRC_Callback callback_isr,   /* general callback for all contexts */
173        void *callback_data           /* ptr to user's data */
174);
175
176/***************************************************************************/
177BERR_Code BGRC_Packet_GetDefaultCreateContextSettings(
178        BGRC_Handle hGrc,
179        BGRC_PacketContext_CreateSettings *pSettings
180);
181
182/***************************************************************************/
183BERR_Code BGRC_Packet_CreateContext(
184        BGRC_Handle hGrc,
185        BGRC_PacketContext_Handle *phContext,
186        BGRC_PacketContext_CreateSettings *pSettings
187);
188
189/***************************************************************************/
190BERR_Code BGRC_Packet_DestroyContext(
191        BGRC_Handle hGrc,
192        BGRC_PacketContext_Handle hContext
193);
194
195/***************************************************************************
196Set Advance and Sync callbacks per context. These callbacks will not be used
197if setting a general callback through BGRC_Packet_SetCallback.
198 ***************************************************************************/
199BERR_Code BGRC_Packet_SetContextCallbacks(
200        BGRC_Handle hGrc,
201        BGRC_PacketContext_Handle hContext,
202        BGRC_Callback advance_callback_isr,   /* callback indicating packet procssing can be */
203        void *advance_callback_data,          /* advanced because device fifo memory is available */
204        BGRC_Callback sync_callback_isr,      /* callback indicating blits are complete */
205        void *sync_callback_data              /* up to the point of the sync */
206);
207
208/***************************************************************************
209Gets packet memory from the packet ring buffer. If the specified minimum
210size is not available, then the ring buffer will wrap if possible and
211return memory from the front of the buffer, otherwise a size of zero will
212be returned. The returned size will be the maximium amount available.
213 ***************************************************************************/
214BERR_Code BGRC_Packet_GetPacketMemory(
215        BGRC_Handle hGrc,
216        BGRC_PacketContext_Handle hContext, /* cannot be null */
217        void **buffer,                      /* [out] ptr to packet buffer ptr */
218        size_t *size_out,                   /* [out] ptr to size of buffer */
219        size_t size_in                      /* minimum size requested (4-bytes or greater) */
220);
221
222/***************************************************************************
223Submit packets for processing to a context. If all packets cannot be
224processed, then _MSG_PACKETS_INCOMPLETE is returned, and the callback is
225called when packet processing becomes possible again. If there is no
226callback specified, remaining packets still need to be advanced.
227 ***************************************************************************/
228BERR_Code BGRC_Packet_SubmitPackets(
229        BGRC_Handle hGrc,
230        BGRC_PacketContext_Handle hContext, /* cannot be null */
231        size_t size                         /* size of packet buffer submitted */
232);
233
234/***************************************************************************
235Advances the context's uncompleted packet processing. If all the packets
236cannot be finished, then _MSG_PACKETS_INCOMPLETE is returned, and the
237callback is called when packet processing becomes possible again. If there
238is no callback specified, then all packets will have finished processing
239upon return.
240 ***************************************************************************/
241BERR_Code BGRC_Packet_AdvancePackets(
242        BGRC_Handle hGrc,
243        BGRC_PacketContext_Handle hContext /* set to null to advance all contexts */
244);
245
246/***************************************************************************
247Synchronizes the context's blits. If there are any remaining packets that
248still need to be Advanced, then _MSG_PACKETS_INCOMPLETE is returned. If all
249the context's blits are already complete, then _MSG_BLITS_COMPLETE is
250returned, otherwise the callback will be called when the blits are complete.
251If there is no callback specified, then all outstanding blits will be
252complete upon return. Sync can be called once per context, and cannot be
253called again until the callback is called.
254 ***************************************************************************/
255BERR_Code BGRC_Packet_SyncPackets(
256        BGRC_Handle hGrc,
257        BGRC_PacketContext_Handle hContext /* cannot be null */
258);
259
260/***************************************************************************
261Returns the how much packet memory is available for contexts with packets
262that need advancing, and the blit sync status of contexts that have synced
263since the last call to this function.
264 ***************************************************************************/
265BERR_Code BGRC_Packet_GetContextStatus(
266        BGRC_Handle hGrc,
267        BGRC_Packet_ContextStatus *status_array, /* [out] context status array */
268        size_t *size_out,                        /* [out] size of array*/
269        size_t size_in                           /* size of array */
270);
271
272/***************************************************************************
273Returns the M2MC device status.
274 ***************************************************************************/
275BERR_Code BGRC_Packet_GetStatus(
276        BGRC_Handle hGrc,
277        BGRC_Packet_Status *status              /* [out] status */
278);
279
280/***************************************************************************
281 PACKET API - STATE DATA CONVERSION
282 ***************************************************************************/
283BERR_Code BGRC_Packet_ConvertPixelFormat(
284        BM2MC_PACKET_PixelFormat *format,       /* [out] packet pixel format */
285        BPXL_Format pxl_format                  /* BPXL pixel format */
286);
287
288/***************************************************************************/
289BERR_Code BGRC_Packet_ConvertFilter( 
290        BM2MC_PACKET_FilterCoeffs *coeffs,      /* [out] packet filter coeffs */
291        BGRC_FilterCoeffs filter,               /* BGRC filter enum */
292        size_t src_size,                        /* source width or height */
293        size_t out_size                         /* output width or height */
294);
295
296/***************************************************************************/
297BERR_Code BGRC_Packet_ConvertColorMatrix( 
298        BM2MC_PACKET_ColorMatrix *matrix_out,   /* [out] packet colormatrix */
299        const int32_t *matrix_in,               /* BGRC color matrix */
300        size_t shift                            /* BGRC matrix element shift */
301);
302
303/***************************************************************************/
304
305#ifdef __cplusplus
306}
307#endif
308
309#endif /* #ifndef BGRC_PACKET_H__ */
310
311/* end of file */
Note: See TracBrowser for help on using the repository browser.