/*************************************************************** ** (c)2009 Broadcom Corporation ** ** This program is the proprietary software of Broadcom Corporation and/or its licensors, ** and may only be used, duplicated, modified or distributed pursuant to the terms and ** conditions of a separate, written license agreement executed between you and Broadcom ** (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants ** no license (express or implied), right to use, or waiver of any kind with respect to the ** Software, and Broadcom expressly reserves all rights in and to the Software and all ** intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU ** HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY ** NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. ** ** Except as expressly set forth in the Authorized License, ** ** 1. This program, including its structure, sequence and organization, constitutes the valuable trade ** secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, ** and to use this information only in connection with your use of Broadcom integrated circuit products. ** ** 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" ** AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR ** WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO ** THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES ** OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, ** LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION ** OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF ** USE OR PERFORMANCE OF THE SOFTWARE. ** ** 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS ** LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR ** EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR ** USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF ** THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT ** ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE ** LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF ** ANY LIMITED REMEDY. ** ** Created: 8/22/2002 by Jeffrey P. Fisher ** ** $brcm_Workfile: bgfx_defs.c $ ** $brcm_Revision: Refsw_7550/3 $ ** $brcm_Date: 11/26/09 11:27a $ ** ** Revision History: ** ** $brcm_Log: /nexus/lib/softgfx/src/bgfx_defs.c $ ** ** Refsw_7550/3 11/26/09 11:27a kagrawal ** SW7550-77: Fixed compile time warning ** ** Refsw_7550/2 9/25/09 12:54p kagrawal ** SW7550-50: Performance optimized gfx from 7003 latest ** ** Refsw_7550/1 9/7/09 5:04p kagrawal ** SW7550-3: Initial check-in for Soft Graphics ** ****************************************************************/ /** include files **/ #include "bgfx_defs.h" /** local types, definitions and data **/ static int g_bgfx_debug_level = 1; static bgfx_io_t *g_p_io = NULL; static bgfx_prot_t *g_prot_t = NULL; /****************************************************************} * INPUTS: none * OUTPUTS: none * RETURNS: debug level * FUNCTION: get the debug level * ****************************************************************/ int bgfx_get_debug_level() { return g_bgfx_debug_level; } /****************************************************************} * INPUTS: debug level * OUTPUTS: none * RETURNS: none * FUNCTION: set the debug level * ****************************************************************/ void bgfx_set_debug_level(int level) { g_bgfx_debug_level = level; } /**************************************************************** * INPUTS: none * OUTPUTS: none * RETURNS: none * FUNCTION: Called to protect internal global structures. Supplied * callback function should function as a mutual exclusion * semaphore. ****************************************************************/ void bgfx_lock(void) { g_prot_t->lock(); } /**************************************************************** * INPUTS: none * OUTPUTS: none * RETURNS: none * FUNCTION: Called to release protection of internal global structures. * Supplied callback function should release mutual exclusion * semaphore. ****************************************************************/ void bgfx_unlock(void) { g_prot_t->unlock(); } /**************************************************************** * INPUTS: same as standard file IO (see fread) * OUTPUTS: none * RETURNS: none * FUNCTION: Read data from the file stream. Supplied callback function * should load count elements of size bytes into the supplied * buffer and return the number of bytes actualy loaded or * value < 0 when an error occurs. * * ****************************************************************/ long bgfx_read(void *buffer, long size, long count, void *fp ) { return g_p_io->read(buffer,size,count,fp); } /**************************************************************** * INPUTS: same as standard file IO (see fread) * OUTPUTS: none * RETURNS: none * FUNCTION: Read data from the file stream. Supplied callback function * should load count elements of size bytes into the supplied * buffer and return the number of bytes actualy loaded or * value < 0 when an error occurs. * * ****************************************************************/ unsigned int bgfx_tell(void *fp ) { return g_p_io->tell(fp); } /**************************************************************** * INPUTS: same as standard file IO (see fseek) * OUTPUTS: none * RETURNS: none * FUNCTION: Set the current file pointer. (only uses SEEK_SET = 0) * * ****************************************************************/ int bgfx_set( void *fp,int offset, int whence) { return g_p_io->set(fp, offset, whence); } /****************************************************************} * INPUTS: io and protection function structures * OUTPUTS: none * RETURNS: non-zero on failure * FUNCTION: initialize sgl, primarily for protection of freetype global * structures. * ****************************************************************/ void bgfx_config(bgfx_io_t *io_p,bgfx_prot_t *prot_p) { g_p_io = io_p; g_prot_t = prot_p; } /****************************************************************} * INPUTS: ptr - address to flush * nbytes - number of bytes * OUTPUTS: none * RETURNS: none * FUNCTION: Perform a cache flush for the address and size specified. * ****************************************************************/ void bgfx_cacheflush(void *ptr,int nbytes) { /* not implemented in uclibc cacheflush(ptr,nbytes,DCACHE); BROKEN syscall(__NR_cacheflush,ptr,nbytes,DCACHE); */ BSTD_UNUSED(ptr); BSTD_UNUSED(nbytes); }