/*************************************************************** ** ** 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 ** ** ** ****************************************************************/ #ifndef __bgfx_defs_h__ #define __bgfx_defs_h__ #include "bgfx_types.h" #include "bapp_util.h" /* local definitions */ #define BGFX_DEFAULT_CACHE_SIZE 1024 /* Debug macros */ #ifdef CONFIG_BGFX_DEBUG #define BGFX_TRACE(x) ((bgfx_get_debug_level() > 1) ? (printf x) : (void) 0) #define BGFX_DEBUG(x) ((bgfx_get_debug_level()) ? (printf x) : (void) 0) #else #define BGFX_TRACE(x) ((void) 0) #define BGFX_DEBUG(x) ((void) 0) #endif #define BGFX_IO_CHECK(x) \ err = x; \ if (err <= 0) { \ BGFX_DEBUG(( "IO Failure %s <%d>:\n\t", __FILE__, __LINE__ )); \ goto done; \ } /* Data structures stored little endian, swapping required on big endian systems only */ #define BGFX_SWAP_INT(x) x #define BGFX_SWAP_ULONG(x) x #define BGFX_MEMSET bapp_util_memset #define BGFX_MEMCPY bapp_util_memcpy #define BGFX_MALLOC(size) bapp_util_malloc(size) #define BGFX_FREE(ptr) bapp_util_free(ptr) #ifdef __GNUC__ #define inline __inline__ #endif #ifdef __cplusplus extern "C" { #endif /**************************************************************** * Set the current debug message level. * When compile time debugging is enabled this function can * be used to set the verbosity of the debug messages. ****************************************************************/ void bgfx_set_debug_level(int level /* debug level selectively enables debugging messages */ ); /**************************************************************** * Get the current debug message level. * When compile time debugging is enabled this function can * be used to get the verbosity of the debug messages. ****************************************************************/ int bgfx_get_debug_level(void); /**************************************************************** * global sgil initialization * Initialize global IO and locking support functions. * prot_p must be an allocated and initialized bgfx_prot_t structure. * It is important that these entities exist for the entire time * SGIL is running and initialized. ****************************************************************/ void bgfx_config(bgfx_io_t *io_p, /* SGIL_RW read callback funtion */ bgfx_prot_t *prot_p /* allocated, initialized sgil_prot_t reference */ ); /**************************************************************** * lock access to global SGIL resources * Used internaly to control access to global data structures * ****************************************************************/ void bgfx_lock(void); /**************************************************************** * unlock access to global SGIL resources * Used internaly to unlock access to global data structures * ****************************************************************/ void bgfx_unlock(void); /**************************************************************** * Internal function to read data * Used internaly to read data from a stream. * ****************************************************************/ long bgfx_read(void *buffer, long size, long count, void *fp ); int bgfx_set( void *fp,int offset, int whence); unsigned int bgfx_tell(void *fp ); /**************************************************************** * Flush cache * Used internaly perform cache flush. * ****************************************************************/ void bgfx_cacheflush(void *ptr,int nbytes); #ifdef __cplusplus } #endif #endif /* __bgfx_defs_h__ */