/*************************************************************** ** ** 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" /* 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 BKNI_Memset #define BGFX_MEMCPY BKNI_Memcpy #define BGFX_MALLOC(size) BKNI_Malloc(size) #define BGFX_FREE(ptr) BKNI_Free(ptr) typedef struct bin_read_t { unsigned char *data; unsigned int size; unsigned int cnt; }bin_read_t; #ifdef __GNUC__ #define inline __inline__ #endif #ifdef __cplusplus extern "C" { #endif /* Summary: Utility IO function. Description: Utility IO function to be used for pseudo IO. */ int bin_read( void *buffer, int size, int count, void *fp ); int bin_set(void *fp, int offset, int whence ); unsigned int bin_tell(void *fp ); /**************************************************************** * 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, /* io callback functions */ bgfx_prot_t *prot_p, /* allocated, initialized sgil_prot_t */ bgfx_hw_t *hw_p /* hw acceleration callbacks */ ); /**************************************************************** * 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); /**************************************************************** * HW acceleration functions. * ****************************************************************/ int bgfx_hw_fill( void *surf, bgfx_rect *r, uint32_t pixel ); int bgfx_hw_blit( void *src_surf, bgfx_rect *src_r, void *dst_surf, bgfx_rect *dst_r, void *out_surf, bgfx_rect *out_r ); bgfx_hw_t *bgfx_hw_get_fcn(void); int bgfx_hw_surf_create(uint32_t width, uint32_t height, int format, uint8_t **mem, uint32_t *pitch, void **p_settop_surf ); void bgfx_hw_surf_destroy(void *p_settop_surf ); #ifdef __cplusplus } #endif #endif /* __bgfx_defs_h__ */