/*************************************************************** ** ** Broadcom Corp. Confidential ** Copyright 2002 Broadcom Corp. All Rights Reserved. ** ** THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED ** SOFTWARE LICENSE AGREEMENT BETWEEN THE USER AND BROADCOM. ** YOU HAVE NO RIGHT TO USE OR EXPLOIT THIS MATERIAL EXCEPT ** SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. ** ** Description: sgil platform definitions ** ** Created: 8/22/2002 by Jeffrey P. Fisher ** ** ** ****************************************************************/ /** 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); */ }