| 1 | /*************************************************************** |
|---|
| 2 | ** (c)2009 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 | ** Created: 8/22/2002 by Jeffrey P. Fisher |
|---|
| 39 | ** |
|---|
| 40 | ** $brcm_Workfile: bgfx_defs.h $ |
|---|
| 41 | ** $brcm_Revision: Refsw_7550/2 $ |
|---|
| 42 | ** $brcm_Date: 9/25/09 12:54p $ |
|---|
| 43 | ** |
|---|
| 44 | ** Revision History: |
|---|
| 45 | ** |
|---|
| 46 | ** $brcm_Log: /nexus/lib/softgfx/src/bgfx_defs.h $ |
|---|
| 47 | ** |
|---|
| 48 | ** Refsw_7550/2 9/25/09 12:54p kagrawal |
|---|
| 49 | ** SW7550-50: Performance optimized gfx from 7003 latest |
|---|
| 50 | ** |
|---|
| 51 | ** Refsw_7550/1 9/7/09 5:04p kagrawal |
|---|
| 52 | ** SW7550-3: Initial check-in for Soft Graphics |
|---|
| 53 | ** |
|---|
| 54 | ****************************************************************/ |
|---|
| 55 | |
|---|
| 56 | #ifndef __bgfx_defs_h__ |
|---|
| 57 | #define __bgfx_defs_h__ |
|---|
| 58 | #include <stdlib.h> |
|---|
| 59 | #include <string.h> |
|---|
| 60 | #include <stdio.h> |
|---|
| 61 | |
|---|
| 62 | #include "bgfx_types.h" |
|---|
| 63 | |
|---|
| 64 | /* local definitions */ |
|---|
| 65 | #define SGL_DEFAULT_CACHE_SIZE 1024 |
|---|
| 66 | /* Debug macros */ |
|---|
| 67 | #ifdef CONFIG_SGL_DEBUG |
|---|
| 68 | #define SGL_TRACE(x) ((bgfx_get_debug_level() > 1) ? (printf x) : (void) 0) |
|---|
| 69 | #define SGL_DEBUG(x) ((bgfx_get_debug_level()) ? (printf x) : (void) 0) |
|---|
| 70 | #else |
|---|
| 71 | #define SGL_TRACE(x) BDBG_MSG(x) |
|---|
| 72 | #define SGL_DEBUG(x) BDBG_ERR(x) |
|---|
| 73 | #endif |
|---|
| 74 | |
|---|
| 75 | #define SGL_IO_CHECK(x) \ |
|---|
| 76 | err = x; \ |
|---|
| 77 | if (err <= 0) { \ |
|---|
| 78 | SGL_DEBUG(( "IO Failure %s <%d>:\n\t", __FILE__, __LINE__ )); \ |
|---|
| 79 | goto done; \ |
|---|
| 80 | } |
|---|
| 81 | /* Data structures stored little endian, swapping required on big endian systems only */ |
|---|
| 82 | #define SGL_SWAP_INT(x) x |
|---|
| 83 | #define SGL_SWAP_ULONG(x) x |
|---|
| 84 | |
|---|
| 85 | #define SGL_MEMSET memset |
|---|
| 86 | #define SGL_MEMCPY memcpy |
|---|
| 87 | #define SGL_MALLOC(size) malloc(size) |
|---|
| 88 | #define SGL_FREE(ptr) free(ptr) |
|---|
| 89 | |
|---|
| 90 | #ifdef __cplusplus |
|---|
| 91 | extern "C" { |
|---|
| 92 | #endif |
|---|
| 93 | /**************************************************************** |
|---|
| 94 | * Set the current debug message level. |
|---|
| 95 | * When compile time debugging is enabled this function can |
|---|
| 96 | * be used to set the verbosity of the debug messages. |
|---|
| 97 | ****************************************************************/ |
|---|
| 98 | void bgfx_set_debug_level(int level /* debug level selectively enables debugging messages */ |
|---|
| 99 | ); |
|---|
| 100 | |
|---|
| 101 | /**************************************************************** |
|---|
| 102 | * Get the current debug message level. |
|---|
| 103 | * When compile time debugging is enabled this function can |
|---|
| 104 | * be used to get the verbosity of the debug messages. |
|---|
| 105 | ****************************************************************/ |
|---|
| 106 | int bgfx_get_debug_level(void); |
|---|
| 107 | |
|---|
| 108 | /**************************************************************** |
|---|
| 109 | * global sgil initialization |
|---|
| 110 | * Initialize global IO and locking support functions. |
|---|
| 111 | * prot_p must be an allocated and initialized bgfx_prot_t structure. |
|---|
| 112 | * It is important that these entities exist for the entire time |
|---|
| 113 | * SGIL is running and initialized. |
|---|
| 114 | ****************************************************************/ |
|---|
| 115 | void bgfx_config(bgfx_io_t *io_p, /* SGIL_RW read callback funtion */ |
|---|
| 116 | bgfx_prot_t *prot_p /* allocated, initialized sgil_prot_t reference */ |
|---|
| 117 | ); |
|---|
| 118 | |
|---|
| 119 | /**************************************************************** |
|---|
| 120 | * lock access to global SGIL resources |
|---|
| 121 | * Used internaly to control access to global data structures |
|---|
| 122 | * |
|---|
| 123 | ****************************************************************/ |
|---|
| 124 | void bgfx_lock(void); |
|---|
| 125 | |
|---|
| 126 | /**************************************************************** |
|---|
| 127 | * unlock access to global SGIL resources |
|---|
| 128 | * Used internaly to unlock access to global data structures |
|---|
| 129 | * |
|---|
| 130 | ****************************************************************/ |
|---|
| 131 | void bgfx_unlock(void); |
|---|
| 132 | |
|---|
| 133 | /**************************************************************** |
|---|
| 134 | * Internal function to read data |
|---|
| 135 | * Used internaly to read data from a stream. |
|---|
| 136 | * |
|---|
| 137 | ****************************************************************/ |
|---|
| 138 | long bgfx_read(void *buffer, long size, long count, void *fp ); |
|---|
| 139 | int bgfx_set( void *fp,int offset, int whence); |
|---|
| 140 | unsigned int bgfx_tell(void *fp ); |
|---|
| 141 | |
|---|
| 142 | /**************************************************************** |
|---|
| 143 | * Flush cache |
|---|
| 144 | * Used internaly perform cache flush. |
|---|
| 145 | * |
|---|
| 146 | ****************************************************************/ |
|---|
| 147 | void bgfx_cacheflush(void *ptr,int nbytes); |
|---|
| 148 | |
|---|
| 149 | #ifdef __cplusplus |
|---|
| 150 | } |
|---|
| 151 | #endif |
|---|
| 152 | |
|---|
| 153 | #endif /* __bgfx_defs_h__ */ |
|---|
| 154 | |
|---|