1/* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#ifndef bbs_BASIC_EM_H 18#define bbs_BASIC_EM_H 19 20/* ---- includes ----------------------------------------------------------- */ 21 22/** This header file is not part of the repository. 23 * If you get an error message at this point, copy 24 * b_BasicEm/LibConfigDefault.h into 25 * "../conf/b_BasicEm/LibConfig.h" 26 */ 27#include "../conf/b_BasicEm/LibConfig.h" 28 29#include "b_BasicEm/Config.h" 30 31/* ---- defines ------------------------------------------------------------ */ 32 33#if defined( WIN32 ) 34 /* disable warning for short += short: */ 35 #pragma warning( disable : 4244 ) 36#endif 37 38#if defined( bbs_NO_MESSAGE_HANDLING ) 39#error bbs_NO_MESSAGE_HANDLING is obsolete, please use bbs_COMPACT_MESSAGE_HANDLING instead. 40#endif 41#if defined( bbs_ENABLE_MESSAGE_FPTRG ) 42#error bbs_ENABLE_MESSAGE_FPTRG is obsolete, please use error handler in context object instead. 43#endif 44 45#if defined( bbs_NO_MESSAGE_HANDLING ) && defined( bbs_ENABLE_MESSAGE_FPTRG ) 46#error LibConfig.h: bbs_NO_MESSAGE_HANDLING and bbs_ENABLE_MESSAGE_FPTRG are mutually exclusive 47#endif 48 49 50 51/* ---- typedefs ----------------------------------------------------------- */ 52 53typedef signed char int8; 54typedef signed short int16; 55typedef unsigned char uint8; 56typedef unsigned short uint16; 57 58#if defined HW_TMS320C6x 59 typedef signed int int32; 60 typedef unsigned int uint32; 61 typedef uint32 count_t; 62#elif defined HW_TMS320C5x 63 typedef signed long int32; 64 typedef unsigned long uint32; 65 typedef uint16 count_t; 66#else 67 typedef signed int int32; 68 typedef unsigned int uint32; 69 typedef uint32 count_t; 70#endif 71 72 73typedef uint32 flag; /* boolean type */ 74 75/* 76 Please modify the 64 bit types declarations below for specific platforms/compilers 77 where necessary; 78 bbs_TYPES_64_AVAILABLE should be checked in code sections that make use of 64 bit data types. 79*/ 80#ifdef bbs_TYPES_64_AVAILABLE 81 82#ifdef WIN64 83 typedef __int64 int64; 84 typedef unsigned __int64 uint64; 85#else 86 typedef long long int64; 87 typedef unsigned long long uint64; 88#endif 89 90#endif /* bbs_TYPES_64_AVAILABLE */ 91 92/** floating point type */ 93struct flt16 94{ 95 int16 valE; 96 int16 bbpE; 97}; 98 99#ifndef TRUE 100 #define TRUE 1 101 #define FALSE 0 102#endif 103 104#ifndef NULL 105 #define NULL 0L 106#endif 107 108#define bbs_MAX_STRING_LENGTH 1024 109 110/* ---- macros ------------------------------------------------------------- */ 111 112/** device independent macro definitions for sizeof: 113 * bbs_SIZEOF8: size in bytes 114 * bbs_SIZEOF16: size in 16-bit words 115 * bbs_SIZEOF32: size in 32-bit words 116 */ 117#if defined( HW_TMS320C5x ) 118 #define bbs_SIZEOF8( typeA ) ( sizeof( typeA ) << 1 ) 119 #define bbs_SIZEOF16( typeA ) ( sizeof( typeA ) ) 120 #define bbs_SIZEOF32( typeA ) ( sizeof( typeA ) >> 1 ) 121#else 122 #define bbs_SIZEOF8( typeA ) ( sizeof( typeA ) ) 123 #define bbs_SIZEOF16( typeA ) ( sizeof( typeA ) >> 1 ) 124 #define bbs_SIZEOF32( typeA ) ( sizeof( typeA ) >> 2 ) 125#endif 126 127/** messages */ 128#if defined( HW_TMS320C5x ) || defined( bbs_COMPACT_MESSAGE_HANDLING ) 129 130 #define bbs_DEF_fNameL( fNameA ) 131 132 #define bbs_ERROR0( formatA ) bbs_Context_pushError( cpA, bbs_Error_create( bbs_ERR_ERROR, __LINE__, __FILE__, NULL ) ) 133 #define bbs_ERROR1( formatA, arg1A ) bbs_Context_pushError( cpA, bbs_Error_create( bbs_ERR_ERROR, __LINE__, __FILE__, NULL ) ) 134 #define bbs_ERROR2( formatA, arg1A, arg2A ) bbs_Context_pushError( cpA, bbs_Error_create( bbs_ERR_ERROR, __LINE__, __FILE__, NULL ) ) 135 #define bbs_ERROR3( formatA, arg1A, arg2A, arg3A ) bbs_Context_pushError( cpA, bbs_Error_create( bbs_ERR_ERROR, __LINE__, __FILE__, NULL ) ) 136 #define bbs_ERROR4( formatA, arg1A, arg2A, arg3A, arg4A ) bbs_Context_pushError( cpA, bbs_Error_create( bbs_ERR_ERROR, __LINE__, __FILE__, NULL ) ) 137 #define bbs_ERROR5( formatA, arg1A, arg2A, arg3A, arg4A, arg5A ) bbs_Context_pushError( cpA, bbs_Error_create( bbs_ERR_ERROR, __LINE__, __FILE__, NULL ) ) 138 139 #define bbs_ERR0( errorA, formatA ) bbs_Context_pushError( cpA, bbs_Error_create( errorA, __LINE__, __FILE__, NULL ) ) 140 #define bbs_ERR1( errorA, formatA, arg1A ) bbs_Context_pushError( cpA, bbs_Error_create( errorA, __LINE__, __FILE__, NULL ) ) 141 #define bbs_ERR2( errorA, formatA, arg1A, arg2A ) bbs_Context_pushError( cpA, bbs_Error_create( errorA, __LINE__, __FILE__, NULL ) ) 142 #define bbs_ERR3( errorA, formatA, arg1A, arg2A, arg3A ) bbs_Context_pushError( cpA, bbs_Error_create( errorA, __LINE__, __FILE__, NULL ) ) 143 #define bbs_ERR4( errorA, formatA, arg1A, arg2A, arg3A, arg4A ) bbs_Context_pushError( cpA, bbs_Error_create( errorA, __LINE__, __FILE__, NULL ) ) 144 #define bbs_ERR5( errorA, formatA, arg1A, arg2A, arg3A, arg4A, arg5A ) bbs_Context_pushError( cpA, bbs_Error_create( errorA, __LINE__, __FILE__, NULL ) ) 145 146#else 147 148 #define bbs_DEF_fNameL( fNameA ) const char* fNameL = fNameA; 149 150 #define bbs_ERROR0( formatA ) bbs_Context_pushError( cpA, bbs_Error_create( bbs_ERR_ERROR, __LINE__, __FILE__, formatA ) ) 151 #define bbs_ERROR1( formatA, arg1A ) bbs_Context_pushError( cpA, bbs_Error_create( bbs_ERR_ERROR, __LINE__, __FILE__, formatA, arg1A ) ) 152 #define bbs_ERROR2( formatA, arg1A, arg2A ) bbs_Context_pushError( cpA, bbs_Error_create( bbs_ERR_ERROR, __LINE__, __FILE__, formatA, arg1A, arg2A ) ) 153 #define bbs_ERROR3( formatA, arg1A, arg2A, arg3A ) bbs_Context_pushError( cpA, bbs_Error_create( bbs_ERR_ERROR, __LINE__, __FILE__, formatA, arg1A, arg2A, arg3A ) ) 154 #define bbs_ERROR4( formatA, arg1A, arg2A, arg3A, arg4A ) bbs_Context_pushError( cpA, bbs_Error_create( bbs_ERR_ERROR, __LINE__, __FILE__, formatA, arg1A, arg2A, arg3A, arg4A ) ) 155 #define bbs_ERROR5( formatA, arg1A, arg2A, arg3A, arg4A, arg5A ) bbs_Context_pushError( cpA, bbs_Error_create( bbs_ERR_ERROR, __LINE__, __FILE__, formatA, arg1A, arg2A, arg3A, arg4A, arg5A ) ) 156 157 #define bbs_ERR0( errorA, formatA ) bbs_Context_pushError( cpA, bbs_Error_create( errorA, __LINE__, __FILE__, formatA ) ) 158 #define bbs_ERR1( errorA, formatA, arg1A ) bbs_Context_pushError( cpA, bbs_Error_create( errorA, __LINE__, __FILE__, formatA, arg1A ) ) 159 #define bbs_ERR2( errorA, formatA, arg1A, arg2A ) bbs_Context_pushError( cpA, bbs_Error_create( errorA, __LINE__, __FILE__, formatA, arg1A, arg2A ) ) 160 #define bbs_ERR3( errorA, formatA, arg1A, arg2A, arg3A ) bbs_Context_pushError( cpA, bbs_Error_create( errorA, __LINE__, __FILE__, formatA, arg1A, arg2A, arg3A ) ) 161 #define bbs_ERR4( errorA, formatA, arg1A, arg2A, arg3A, arg4A ) bbs_Context_pushError( cpA, bbs_Error_create( errorA, __LINE__, __FILE__, formatA, arg1A, arg2A, arg3A, arg4A ) ) 162 #define bbs_ERR5( errorA, formatA, arg1A, arg2A, arg3A, arg4A, arg5A ) bbs_Context_pushError( cpA, bbs_Error_create( errorA, __LINE__, __FILE__, formatA, arg1A, arg2A, arg3A, arg4A, arg5A ) ) 163 164#endif 165 166/* ---- constants ---------------------------------------------------------- */ 167 168/* ---- associated objects ------------------------------------------------- */ 169 170/* ---- external functions ------------------------------------------------- */ 171 172#endif /* bbs_BASIC_EM_H */ 173 174