diff options
author | Viktor Mladenovski <viktor.mladenovski@stericsson.com> | 2011-05-20 14:10:59 +0200 |
---|---|---|
committer | Viktor Mladenovski <viktor.mladenovski@stericsson.com> | 2011-05-20 14:10:59 +0200 |
commit | f7e95217e936da34d7124aaced590692eb515923 (patch) | |
tree | 2d9ef4750a67d9d1dd3fe9180a4fef2929fad54b /lcmodule/source/legacy_compatibility |
Initial contribution of loader_communication
ST-Ericsson ID: 326913
ST-Ericsson FOSS-OUT ID: STETL-FOSS-OUT-10204
Change-Id: I171cfc2ee458a8a0a91a1916137d131f0f7ecee5
Diffstat (limited to 'lcmodule/source/legacy_compatibility')
-rw-r--r-- | lcmodule/source/legacy_compatibility/c_compiler.h | 124 | ||||
-rw-r--r-- | lcmodule/source/legacy_compatibility/c_system.h | 34 | ||||
-rw-r--r-- | lcmodule/source/legacy_compatibility/r_basicdefinitions.h | 168 | ||||
-rw-r--r-- | lcmodule/source/legacy_compatibility/r_debug.h | 360 | ||||
-rw-r--r-- | lcmodule/source/legacy_compatibility/t_basicdefinitions.h | 280 |
5 files changed, 966 insertions, 0 deletions
diff --git a/lcmodule/source/legacy_compatibility/c_compiler.h b/lcmodule/source/legacy_compatibility/c_compiler.h new file mode 100644 index 0000000..90799b1 --- /dev/null +++ b/lcmodule/source/legacy_compatibility/c_compiler.h @@ -0,0 +1,124 @@ +/****************************************************************************** +* +* Copyright (C) ST-Ericsson SA 2011 +* License terms: 3-clause BSD license +* +******************************************************************************/ +#ifndef _C_COMPILER_H +#define _C_COMPILER_H + +/************************************************************************* +* +* HEADER SPECIFICATION +* +* $Workfile: c_compiler.h $ +* +************************************************************************** +* +* DESCRIPTION: +* +* This file contains macros that determines current compiler +* +* +************************************************************************** +* +* REVISION HISTORY: +* +* $Log: \LD_FuncBlocks_012\cnh160692_exec_pltf_srv_swbp\inc\c_compiler.h $ + * + * Version: ...\cnh160692_r1a_dev\3 12 Mar 2002 14:21 (GMT) QCSSTZI + * rename p_compiler to c_compiler. + * + * Version: ...\cnh160692_r1a_dev\2 10 Jan 2002 12:35 (GMT) QCSSTZI + * Updated to reflect R4A013 on the old module (cnh1010024) + * + * Version: ...\cnh1010024_r4a_dev\1 11 Sep 2001 07:34 (GMT) QCSPAAB + * Merge to Valentina (R4) + * + * Version: ...\cnh1010024\1 14 Nov 2000 15:30 (GMT) ECSJENE + * Merge to start new dev-branch for the Mia project. + * + * Version: ...\cnh1010024_r2a_dev\4 05 Oct 2000 06:25 (GMT) ECSSTMA + * Macro to remove non_banked directive. + * + * Version: ...\cnh1010024_r2a_dev\3 19 Sep 2000 12:38 (GMT) QCSLAIS + * Compiler warnings work around. + * + * Version: ...\cnh1010024_r2a_dev\2 22 May 2000 08:25 (GMT) ECSSTMA + * Accept LINT as being one among the compilers. + * + * Version: ...\cnh1010024_r2a_dev\1 16 May 2000 12:19 (GMT) QCSLAIS + * Created file compiler.h which determines current compiler and target +* +**************************************************************************/ + +#if defined(__IAR_SYSTEMS_ICC) || defined(__IAR_SYSTEMS_ICC__) +/* COMPILER IS FROM IAR */ +#if ((__TID__ >> 8) & 0x7f) == 23 +/* TARGET IS Z80 */ +#define COMPILER_IAR_Z80 +#elif ((__TID__ >> 8) & 0x7f) == 90 +/* TARGET IS AVR */ +#define COMPILER_IAR_AVR /* Preferred */ +#define COMPILER_AVR +#define AT90S +#elif ((__TID__ >> 8) & 0x7f) == 0x4f +/* TARGET IS ARM */ +#define COMPILER_IAR_ARM /* Preferred */ +#define COMPILER_ARM +#define ARM +#else +#error Unknown IAR compiler +#endif +#elif defined(_WIN32) +/* TARGET IS Win32 */ +#define COMPILER_MSDEV +#define __arm +#define __pcs +#define __no_init +#elif defined(__arm) +/* TARGET IS ARM */ +#define COMPILER_ARM_ARM /* Preferred */ +#define COMPILER_ARM +#define ARM +#elif defined(__GNUC__) +#ifdef __arm__ +#define COMPILER_GCC_ARM +#elif defined(__linux__) +/* TARGET IS LINUX */ +#define COMPILER_GCC +#endif +#elif defined(__IAR_SYSTEMS_ASM__) +#elif defined(_lint) +#else +#error Unknown compiler +#endif + +/* + * Some compiler bug work arounds. + */ + +/* + * Avoid ARM compiler error when comparing NULL with a pointer + * by defining NULL as NULL pointer. + */ +#if defined(COMPILER_ARM_ARM) && !defined(NULL) +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +/* + * Some modules still use the unused banked prefix. + */ +#ifndef banked +#define banked +#endif + +#ifndef non_banked +#define non_banked +#endif + +#endif // _C_COMPILER_H diff --git a/lcmodule/source/legacy_compatibility/c_system.h b/lcmodule/source/legacy_compatibility/c_system.h new file mode 100644 index 0000000..fe65751 --- /dev/null +++ b/lcmodule/source/legacy_compatibility/c_system.h @@ -0,0 +1,34 @@ +#ifndef INCLUSION_GUARD_C_SYSTEM_H +#define INCLUSION_GUARD_C_SYSTEM_H + +/************************************************************************* +* Copyright (C) ST-Ericsson SA 2011 +* License terms: 3-clause BSD license +************************************************************************** +* +* DESCRIPTION: +* +* System configuration include file. This file must be the first +* file included by every source (*.c) file in the system +* +*************************************************************************/ + +/************************************************************************* +* Includes +*************************************************************************/ + +#include "c_compiler.h" + +//#include "product.h" + +/************************************************************************* +* Types, constants and external variables +*************************************************************************/ + + + +#endif // INCLUSION_GUARD_C_SYSTEM_H + + + + diff --git a/lcmodule/source/legacy_compatibility/r_basicdefinitions.h b/lcmodule/source/legacy_compatibility/r_basicdefinitions.h new file mode 100644 index 0000000..35bf0bc --- /dev/null +++ b/lcmodule/source/legacy_compatibility/r_basicdefinitions.h @@ -0,0 +1,168 @@ +/****************************************************************************** +* $Workfile: r_basicdefinitions.h $ +* +* Copyright (C) ST-Ericsson SA 2011 +* License terms: 3-clause BSD license +* +* DESCRIPTION: +* +* Portable types used for a consistent target platform. +* The name should make it totally clear as to what they are used for. +* +* +*/ + +#ifndef _R_BASICDEFINITIONS_H +#define _R_BASICDEFINITIONS_H + +#include "t_basicdefinitions.h" + +/******************** +* General macro's +* These should be moved to a utility header when we have a good file name put it in. +*********************/ +/** + * Returns the smallest value of x and y. + * + * @param [in] x Value of any scalar type + * @param [in] y Value of any scalar type + * + * @return The return type obeys the rules regarding binary conversion of the + * programming language C. + * + * @sigbased No - Macro, parameters expand more than one time + */ +#ifndef MIN +#define MIN(val1, val2) (((val1) < (val2)) ? (val1) : (val2)) +#endif + +/** + * Returns the largest value of x and y. + * + * @param [in] x Value of any scalar type + * @param [in] y Value of any scalar type + * + * @return The return type obeys the rules regarding binary conversion of the + * programming language C. + * + * @sigbased No - Macro, parameters expand more than one time + */ +#ifndef MAX +#define MAX(val1, val2) (((val1) > (val2)) ? (val1) : (val2)) +#endif + +/** + * The return value is evaluated at compile time, not at run-time. The return + * value can be used as dimension parameter in other declarations of other + * arrays. The return value can however not be used in expressions evaluated in + * pre-processor directives (e.g. #if (ElementsOf(a) > 10)) since it is based on + * the sizeof() operator. + * + * @param [in] a Must be an array variable or array type + * + * @return Number of elements in the array passed as parameter. + * + * @sigbased No - Macro, parameters expand more than one time + */ +#ifndef ElementsOf +#define ElementsOf(array) (sizeof(array) / sizeof(array[0])) +#endif + + +/***************************** +* Macro's to extract bytes from uint16 or sint16 +******************************/ +/** + * Used to retrieve the least significant 8 bits of a 16 bit word. + * + * @param [in] w A value of type uint16 + * + * @return Returns value of type uint8 representing the low byte of the value + * passed as parameter. + * + * @sigbased No - Macro + */ +#define INT16_LBYTE(i) (uint8)((i) & 0xFF) + +/** + * Used to retrieve the most significant 8 bits of a 16 bit word. + * + * @param [in] w A value of type uint16 + * + * @return Returns value of type uint8 representing the high byte of the value + * passed as parameter. + * + * @sigbased No - Macro + */ +#define INT16_HBYTE(i) (uint8)((i) >> 8) + +/***************************** +* Macro's to build int16 from two bytes (low & high) +******************************/ +/** + * Used to form a 16 bit signed value from two 8 bit values. The result will + * be negative if the most significant bit (MSB) of the HighByte parameter is + * a one, otherwise positive. + * + * @param [in] LowByte Defines the value that will be in the low byte of the + * returned sint16 value. + * @param [in] HighByte Defines the value that will be in the high byte of the + * returned sint16 value. + * + * @return Returns value of type sint16 constructed from two byte values. + * + * @sigbased No - Macro + */ +#define BYTES_TO_SINT16(l,h) (sint16)((h << 8) + l) + +/** + * Used to form a 16 bit unsigned value from two 8 bit values. + * + * @param [in] LowByte Defines the value that will be in the low byte of the + * returned sint16 value. + * @param [in] HighByte Defines the value that will be in the high byte of the + * returned sint16 value. + * + * @return Returns value of type uint16 constructed from two byte values. + * + * @sigbased No - Macro + */ +#define BYTES_TO_UINT16(l,h) (uint16)((h << 8) + l) + +/* +**======================================================================== +** +** MACRO TO AVOID WARNINGS FOR UNUSED PARAMETERS OR VARIABLE +** +** Example of use: +** +** int MyFunc(int p) +** { +** int a = 42; +** NOT_USED(p); // This line must be placed after declaration of local variables. +** +** return a; +** } +** +**======================================================================== +*/ + + +#ifdef IDENTIFIER_NOT_USED +#undef IDENTIFIER_NOT_USED +#endif + +//#define IDENTIFIER_NOT_USED(p) if (sizeof(&p)) {} +// this seems to work better under lint: +/** + * Should be used to "touch" a variable or a formal parameter that is intentionally + * not used and thereby avoid compiler warnings. + * + * @param [in] Id A symbol that represents a variable that is not used, usually a + * formal parameter. + * + * @sigbased No - Macro + */ +#define IDENTIFIER_NOT_USED(P) (void)(P); + +#endif //_R_BASICDEFINITIONS_H diff --git a/lcmodule/source/legacy_compatibility/r_debug.h b/lcmodule/source/legacy_compatibility/r_debug.h new file mode 100644 index 0000000..6c6c280 --- /dev/null +++ b/lcmodule/source/legacy_compatibility/r_debug.h @@ -0,0 +1,360 @@ +#ifndef INCLUSION_GUARD_R_DEBUG_H +#define INCLUSION_GUARD_R_DEBUG_H + +/******************************************************************************* + * Copyright (C) ST-Ericsson SA 2011 + * License terms: 3-clause BSD license + ******************************************************************************/ + +#include <stdio.h> +#include "t_basicdefinitions.h" + +/* Disable printouts if debug subsystem is disabled */ +#ifndef ENABLE_DEBUG +#define DISABLE_PRINT_ALL_ +#endif + +// Disable flags ( "command line #undef" ) +#ifdef DISABLE_PRINT_A_ +#undef PRINT_A_ +#endif +#ifdef DISABLE_PRINT_B_ +#undef PRINT_B_ +#endif +#ifdef DISABLE_PRINT_C_ +#undef PRINT_C_ +#endif +#ifdef DISABLE_PRINT_ALL_ +#undef PRINT_C_ +#undef PRINT_B_ +#undef PRINT_A_ +#endif + +#if defined(PRINT_A_) +#define PRINT_LEVEL_A_ +#endif + +#if defined(PRINT_B_) +#define PRINT_LEVEL_B_ +#endif + +#if defined(PRINT_C_) +#define PRINT_LEVEL_C_ +#endif + +#if defined(PRINT_A_) || defined(PRINT_B_) +#define PRINT_LEVEL_A_B_ +#endif + +#if defined(PRINT_A_) || defined(PRINT_C_) +#define PRINT_LEVEL_A_C_ +#endif + +#if defined(PRINT_B_) || defined(PRINT_C_) +#define PRINT_LEVEL_B_C_ +#endif + +#if defined(PRINT_A_) || defined(PRINT_B_) || defined(PRINT_C_) +#define PRINT_LEVEL_A_B_C_ +#endif + +#define A_(_PAR_) +#define A_ASSERT_(exp) +#define B_(_PAR_) +#define B_ASSERT_(exp) +#define C_(_PAR_) +#define C_ASSERT_(exp) +#define A_B_(p) +#define A_B_ASSERT_(bool) +#define A_C_(p) +#define A_C_ASSERT_(bool) +#define B_C_(p) +#define B_C_ASSERT_(bool) +#define A_B_C_(p) +#define A_B_C_ASSERT_(bool) + +#ifdef _WIN32 +//#pragma message("COMPILING FOR WIN32") +#ifdef __cplusplus +extern "C" +{ +#endif + int _TraceEnter(int Level); + void _TraceExit(int Level); + void _TraceAssert(void *, void *, unsigned); +#ifdef __cplusplus +} // extern "C" { +#endif + +#define _ABCTRACE(_PAR_, _ABC_) if (_TraceEnter(_ABC_)) {_PAR_; _TraceExit(_ABC_);} +#define _ASSERT(exp) (void)( (exp) || (_TraceAssert(#exp, __FILE__, __LINE__), 0) ) + +#ifdef PRINT_A_ +#undef A_ +#define A_(_PAR_) _ABCTRACE(_PAR_, 'A') +#undef A_ASSERT_ +#define A_ASSERT_(exp) _ASSERT(exp) +#endif +#ifdef PRINT_B_ +#undef B_ +#define B_(_PAR_) _ABCTRACE(_PAR_, 'B') +#undef B_ASSERT_ +#define B_ASSERT_(exp) _ASSERT(exp) +#endif +#ifdef PRINT_C_ +#undef C_ +#define C_(_PAR_) _ABCTRACE(_PAR_, 'C') +#undef C_ASSERT_ +#define C_ASSERT_(exp) _ASSERT(exp) +#endif +#ifdef PRINT_LEVEL_A_B_ +#undef A_B_ +#define A_B_(_PAR_) _ABCTRACE(_PAR_, 'A') +#undef A_B__ASSERT_ +#define A_B__ASSERT_(exp) _ASSERT(exp) +#endif +#ifdef PRINT_LEVEL_A_C_ +#undef A_C_ +#define A_C_(_PAR_) _ABCTRACE(_PAR_, 'A') +#undef A_C_ASSERT_ +#define A_C_ASSERT_(exp) _ASSERT(exp) +#endif +#ifdef PRINT_LEVEL_B_C_ +#undef B_C_ +#define B_C_(_PAR_) _ABCTRACE(_PAR_, 'B') +#undef B_C_ASSERT_ +#define B_C_ASSERT_(exp) _ASSERT(exp) +#endif +#ifdef PRINT_LEVEL_A_B_C_ +#undef A_B_C_ +#define A_B_C_(_PAR_) _ABCTRACE(_PAR_, 'A') +#undef A_B_C_ASSERT_ +#define A_B_C_ASSERT_(exp) _ASSERT(exp) +#endif + +#ifndef PRINT_LEVEL_IS_SETTABLE +// We Can remove this TRACE_IS_SETTABLE test when: +// * We do not have constructions with functions inserted in A_ macro's like: A_(void foo(void);) +// beacause an if statement will be prefixed to the _PAR_ experssion +#ifdef PRINT_A_ +#undef A_ +#define A_(_PAR_) _PAR_ +#undef A_ASSERT_ +#define A_ASSERT_(exp) _ASSERT(exp) +#endif +#ifdef PRINT_B_ +#undef B_ +#define B_(_PAR_) _PAR_ +#undef B_ASSERT_ +#define B_ASSERT_(exp) _ASSERT(exp) +#endif +#ifdef PRINT_C_ +#undef C_ +#define C_(_PAR_) _PAR_ +#undef C_ASSERT_ +#define C_ASSERT_(exp) _ASSERT(exp) +#endif +#ifdef PRINT_LEVEL_A_B_ +#undef A_B_ +#define A_B_(_PAR_) _PAR_ +#undef A_B__ASSERT_ +#define A_B__ASSERT_(exp) _ASSERT(exp) +#endif +#ifdef PRINT_LEVEL_A_C_ +#undef A_C_ +#define A_C_(_PAR_) _PAR_ +#undef A_C_ASSERT_ +#define A_C_ASSERT_(exp) _ASSERT(exp) +#endif +#ifdef PRINT_LEVEL_B_C_ +#undef B_C_ +#define B_C_(_PAR_) _PAR_ +#undef B_C_ASSERT_ +#define B_C_ASSERT_(exp) _ASSERT(exp) +#endif +#ifdef PRINT_LEVEL_A_B_C_ +#undef A_B_C_ +#define A_B_C_(_PAR_) _PAR_ +#undef A_B_C_ASSERT_ +#define A_B_C_ASSERT_(exp) _ASSERT(exp) +#endif +#endif // PRINT_LEVEL_IS_SETTABLE + +#else // _WIN32 + +#ifdef BSYS_ASSERT_CAUSE_DUMP +extern void p_assert_dump(const char *, unsigned int); + +#define _ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + p_assert_dump(__FILE__, __LINE__); \ + } \ + } while (0) +#else +extern void p_assert_print(const char *, unsigned int); + +#define _ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + p_assert_print(__FILE__, __LINE__); \ + } \ + } while (0) +#endif /* BSYS_ASSERT_CAUSE_DUMP */ + +#undef A_ +#undef A_ASSERT_ +#ifdef PRINT_A_ +#define A_(p) p +#define A_ASSERT_(bool) _ASSERT(bool) +#else +#define A_(p) +#define A_ASSERT_(bool) +#endif + +#undef B_ +#undef B_ASSERT_ +#ifdef PRINT_B_ +#define B_(p) p +#define B_ASSERT_(bool) _ASSERT(bool) +#else +#define B_(p) +#define B_ASSERT_(bool) +#endif + +#undef C_ +#undef C_ASSERT_ +#ifdef PRINT_C_ +#define C_(p) p +#define C_ASSERT_(bool) _ASSERT(bool) +#else +#define C_(p) +#define C_ASSERT_(bool) +#endif + +#undef A_B_ +#undef A_B_ASSERT_ +#ifdef PRINT_LEVEL_A_B_ +#define A_B_(p) p +#define A_B_ASSERT_(bool) _ASSERT(bool) +#else +#define A_B_(p) +#define A_B_ASSERT_(bool) +#endif + +#undef A_C_ +#undef A_C_ASSERT_ +#ifdef PRINT_LEVEL_A_C_ +#define A_C_(p) p +#define A_C_ASSERT_(bool) _ASSERT(bool) +#else +#define A_C_(p) +#define A_C_ASSERT_(bool) +#endif + +#undef B_C_ +#undef B_C_ASSERT_ +#ifdef PRINT_LEVEL_B_C_ +#define B_C_(p) p +#define B_C_ASSERT_(bool) _ASSERT(bool) +#else +#define B_C_(p) +#define B_C_ASSERT_(bool) +#endif + +#undef A_B_C_ +#undef A_B_C_ASSERT_ +#ifdef PRINT_LEVEL_A_B_C_ +#define A_B_C_(p) p +#define A_B_C_ASSERT_(bool) _ASSERT(bool) +#else +#define A_B_C_(p) +#define A_B_C_ASSERT_(bool) +#endif + +#endif // else _WIN32 + +/* + * Obsolete TAE debugging. A_(), B_(), etc. should be used in new code. + */ +#if defined(PRINT_TA_) + +#define DbgTrace1(msg) printf(msg) +#define DbgTrace2(msg,a1) printf(msg,a1) +#define DbgTrace3(msg,a1,a2) printf(msg,a1,a2) +#define DbgTrace4(msg,a1,a2,a3) printf(msg,a1,a2,a3) +#define DbgTrace5(msg,a1,a2,a3,a4) printf(msg,a1,a2,a3,a4) +#define DbgTrace6(msg,a1,a2,a3,a4,a5) printf(msg,a1,a2,a3,a4,a5) +#define DbgTrace7(msg,a1,a2,a3,a4,a5,a6) printf(msg,a1,a2,a3,a4,a5,a6) +#define DbgTrace8(msg,a1,a2,a3,a4,a5,a6,a7) printf(msg,a1,a2,a3,a4,a5,a6,a7) + +#else + +#define DbgTrace1(msg) +#define DbgTrace2(msg,a1) +#define DbgTrace3(msg,a1,a2) +#define DbgTrace4(msg,a1,a2,a3) +#define DbgTrace5(msg,a1,a2,a3,a4) +#define DbgTrace6(msg,a1,a2,a3,a4,a5) +#define DbgTrace7(msg,a1,a2,a3,a4,a5,a6) +#define DbgTrace8(msg,a1,a2,a3,a4,a5,a6,a7) + +#endif + +#if defined(PRINT_TA_) + +#define LLPRE2(expr) do{ if(expr){ printf("WARNING: "); +#define LLPOST2 }}while(0) + +#define DbgIf_Warn1(expr,msg) LLPRE2(expr) printf(msg); LLPOST2 +#define DbgIf_Warn2(expr,msg,a1) LLPRE2(expr) printf(msg,a1); LLPOST2 +#define DbgIf_Warn3(expr,msg,a1,a2) LLPRE2(expr) printf(msg,a1,a2); LLPOST2 +#define DbgIf_Warn4(expr,msg,a1,a2,a3) LLPRE2(expr) printf(msg,a1,a2,a3); LLPOST2 +#define DbgIf_Warn5(expr,msg,a1,a2,a3,a4) LLPRE2(expr) printf(msg,a1,a2,a3,a4); LLPOST2 +#define DbgIf_Warn6(expr,msg,a1,a2,a3,a4,a5) LLPRE2(expr) printf(msg,a1,a2,a3,a4,a5); LLPOST2 +#define DbgIf_Warn7(expr,msg,a1,a2,a3,a4,a5,a6) LLPRE2(expr) printf(msg,a1,a2,a3,a4,a5,a6); LLPOST2 +#define DbgIf_Warn8(expr,msg,a1,a2,a3,a4,a5,a6,a7) LLPRE2(expr) printf(msg,a1,a2,a3,a4,a5,a6,a7); LLPOST2 + +#else + +#define DbgIf_Warn1(expr,msg) +#define DbgIf_Warn2(expr,msg,a1) +#define DbgIf_Warn3(expr,msg,a1,a2) +#define DbgIf_Warn4(expr,msg,a1,a2,a3) +#define DbgIf_Warn5(expr,msg,a1,a2,a3,a4) +#define DbgIf_Warn6(expr,msg,a1,a2,a3,a4,a5) +#define DbgIf_Warn7(expr,msg,a1,a2,a3,a4,a5,a6) +#define DbgIf_Warn8(expr,msg,a1,a2,a3,a4,a5,a6,a7) + +#endif + +#define LLPRE3(expr) do{ if(expr){ printf("*FATAL* "); +#if defined(PRINT_TA_) +#define LLPOST3 LL_TerminateSystem(); }}while(0) +#else +#define LLPOST3 error(0xBABE); }}while(0) +#endif + +#define DbgIf_Fatal1(expr,msg) LLPRE3(expr) printf(msg); LLPOST3 +#define DbgIf_Fatal2(expr,msg,a1) LLPRE3(expr) printf(msg,a1); LLPOST3 +#define DbgIf_Fatal3(expr,msg,a1,a2) LLPRE3(expr) printf(msg,a1,a2); LLPOST3 +#define DbgIf_Fatal4(expr,msg,a1,a2,a3) LLPRE3(expr) printf(msg,a1,a2,a3); LLPOST3 +#define DbgIf_Fatal5(expr,msg,a1,a2,a3,a4) LLPRE3(expr) printf(msg,a1,a2,a3,a4); LLPOST3 +#define DbgIf_Fatal6(expr,msg,a1,a2,a3,a4,a5) LLPRE3(expr) printf(msg,a1,a2,a3,a4,a5); LLPOST3 +#define DbgIf_Fatal7(expr,msg,a1,a2,a3,a4,a5,a6) LLPRE3(expr) printf(msg,a1,a2,a3,a4,a5,a6); LLPOST3 +#define DbgIf_Fatal8(expr,msg,a1,a2,a3,a4,a5,a6,a7) LLPRE3(expr) printf(msg,a1,a2,a3,a4,a5,a6,a7); LLPOST3 + + + +// Map TA calls +#define DbgTrace_HexDump(pData,nLength) BSYS_HexDump(pData,nLength,0) + +// Prototypes + +void BSYS_HexDump(const void *pData, int nLength, boolean DumpWithOffset); + +#endif // INCLUSION_GUARD_R_DEBUG_H diff --git a/lcmodule/source/legacy_compatibility/t_basicdefinitions.h b/lcmodule/source/legacy_compatibility/t_basicdefinitions.h new file mode 100644 index 0000000..8b453ff --- /dev/null +++ b/lcmodule/source/legacy_compatibility/t_basicdefinitions.h @@ -0,0 +1,280 @@ +#ifndef INCLUSION_GUARD_T_BASICDEFINITIONS_H +#define INCLUSION_GUARD_T_BASICDEFINITIONS_H + +/****************************************************************************** + * Copyright (C) ST-Ericsson SA 2011 + * License terms: 3-clause BSD license +******************************************************************************* +* +* $Workfile: t_basicdefinitions.h $ +* +******************************************************************************* +* +* DESCRIPTION: +* +* Portable types used for a consistent target platform. +* The name should make it totally clear as to what they are used for. +* +* For calculations: +* ----------------- +* sint8 - signed integer 8 bits +* uint8 - unsigned integer 8bits +* sint16 - signed integer 16 bits +* uint16 - unsigned integer 16 bits +* sint32 - signed integer 32 bits +* uint32 - unsigned integer 32 bits +* MAX and MIN values for all integer types are also supported. +* +* Unsigned integer types for other purposes than calculations: +* ------------------------------------------------------------ +* boolean - TRUE or FALSE +* +* Bitfield types to use in packed structs: +* ---------------------------------------- +* sbitfield - signed bitfield +* ubitfield - unsigned bitfield +* +* Bitmasks: +* --------- +* BIT_0 - unsigned integer of values 0x00000001 +* ... +* BIT_31 - unsigned integer of values 0x80000000 +* +* Enumeration: +* ------------ +* TYPEDEF_ENUM - This macro should be used to start the defenition of a enumerated type +* ENUM8(t) - uint8 enum +* ENUM16(t) - uint16 enum +* ENUM32(t) - uint32 enum +* SIGNED_ENUM8(t) - sint8 enum +* SIGNED_ENUM16(t) - sint16 enum +* SIGNED_ENUM32(t) - sint32 enum +* +******************************************************************************/ + +/******************** +* Include files +*********************/ + +#include "c_compiler.h" +#include <limits.h> + +/******************** +* Portable data types +*********************/ + +#if defined(COMPILER_IAR_ARM) && (__VER__ >= 300) +#define SINT64_SUPPORTED +#define UINT64_SUPPORTED +#define INT64_BASE_TYPE long long +#elif defined(COMPILER_ARM_ARM) +#define SINT64_SUPPORTED +#define UINT64_SUPPORTED +#define INT64_BASE_TYPE long long +#elif defined(_WIN32) +#define SINT64_SUPPORTED +#define UINT64_SUPPORTED +#define INT64_BASE_TYPE __int64 +#endif + + +/** Type definition for a signed 8 bit data entity. */ +typedef signed char sint8; +/** Type definition for an unsigned 8 bit data entity. */ +typedef unsigned char uint8; +/** Type definition for a signed 16 bit data entity. */ +typedef signed short sint16; +/** Type definition for an unsigned 16 bit data entity. */ +typedef unsigned short uint16; +/** Type definition for a signed 32 bit data entity. */ +typedef signed int sint32; +/** Type definition for an unsigned 32 bit data entity. */ +#if defined(_WIN32) +typedef unsigned long uint32; +#else +typedef unsigned int uint32; +#endif + +/** + * Type definition for a signed 64 bit data entity. Only available if the switch + * SINT64_SUPPORTED is defined. + */ +#ifdef SINT64_SUPPORTED +typedef signed INT64_BASE_TYPE sint64; +#endif + +/** + * Type definition for an unsigned 64 bit data entity. Only available if the + * switch UINT64_SUPPORTED is defined. + */ +#ifdef UINT64_SUPPORTED +typedef unsigned INT64_BASE_TYPE uint64; +#endif + +/******************* +* MAX and MIN values +********************/ +/** Minimum value for an entity of type sint8 */ +#define MIN_SINT8 (SCHAR_MIN) +/** Maximum value for an entity of type sint8 */ +#define MAX_SINT8 (SCHAR_MAX) +/** Maximum value for an entity of type uint8 */ +#define MAX_UINT8 (UCHAR_MAX) +/** Minimum value for an entity of type sint16 */ +#define MIN_SINT16 (SHRT_MIN) +/** Maximum value for an entity of type sint16 */ +#define MAX_SINT16 (SHRT_MAX) +/** Maximum value for an entity of type uint16 */ +#define MAX_UINT16 (USHRT_MAX) +/** Minimum value for an entity of type sint32 */ +#define MIN_SINT32 (LONG_MIN) +/** Maximum value for an entity of type sint32 */ +#define MAX_SINT32 (LONG_MAX) +/** Maximum value for an entity of type uint32 */ +#define MAX_UINT32 (ULONG_MAX) + + +#ifdef SINT64_SUPPORTED +/** + * Minimum value for an entity of type sint64. Only available if the switch + * SINT64_SUPPORTED is defined. + */ +#define MIN_SINT64 (-0x8000000000000000) +/** + * Maximum value for an entity of type sint64. Only available if the switch + * SINT64_SUPPORTED is defined. + */ +#define MAX_SINT64 (0x7fffffffffffffff) +#endif + +#ifdef UINT64_SUPPORTED +/** + * Maximum value for an entity of type uint64. Only available if the switch + * UINT64_SUPPORTED is defined. + */ +#define MAX_UINT64 (0xffffffffffffffff) +#endif + +/******************** +* boolean: TRUE/FALSE +*********************/ +/** Type definition for a boolean/logical value */ +typedef uint8 boolean; + +#ifndef TRUE +/** Value representing the boolean/logical value false. */ +#define FALSE 0 +/** Value representing the boolean/logical value true. */ +#define TRUE (!FALSE) +#endif + +/****************************************** +* Portable bitfield definitions +*******************************************/ + +#if defined(COMPILER_IAR_AVR) || defined(COMPILER_IAR_ARM) || defined(_WIN32) || defined(COMPILER_ARM_ARM) || defined(COMPILER_GCC_ARM) || defined(COMPILER_GCC) +/** Type definition to be used when implementing bit-fields that should hold + * signed values. + */ +typedef sint8 sbitfield; +/** Type definition to be used when implementing bit-fields that should hold + * unsigned values. + */ +typedef uint8 ubitfield; +#elif defined(_lint) +typedef signed int sbitfield; +typedef unsigned int ubitfield; +#else +#error Unknown preferred bitfield definition for this compiler +#endif + +/************************* +* Bit mask definitions +**************************/ + +/** +* This sections defines a set of masks implemented as scalar unsigned values +* that can be used to mask out bits of a scalar entity. The definitions are +* named BIT_0 through BIT_31 and each implements the unsigned value of two to +* the power of the value in the definitions name. E.g. BIT_0 implements the value of 1 while BIT_10 implements the value of 0x0400 (equals 1024 in decimal form). +*/ +#define BIT_0 0x0001U +#define BIT_1 0x0002U +#define BIT_2 0x0004U +#define BIT_3 0x0008U +#define BIT_4 0x0010U +#define BIT_5 0x0020U +#define BIT_6 0x0040U +#define BIT_7 0x0080U +#define BIT_8 0x0100U +#define BIT_9 0x0200U +#define BIT_10 0x0400U +#define BIT_11 0x0800U +#define BIT_12 0x1000U +#define BIT_13 0x2000U +#define BIT_14 0x4000U +#define BIT_15 0x8000U +#define BIT_16 0x00010000UL +#define BIT_17 0x00020000UL +#define BIT_18 0x00040000UL +#define BIT_19 0x00080000UL +#define BIT_20 0x00100000UL +#define BIT_21 0x00200000UL +#define BIT_22 0x00400000UL +#define BIT_23 0x00800000UL +#define BIT_24 0x01000000UL +#define BIT_25 0x02000000UL +#define BIT_26 0x04000000UL +#define BIT_27 0x08000000UL +#define BIT_28 0x10000000UL +#define BIT_29 0x20000000UL +#define BIT_30 0x40000000UL +#define BIT_31 0x80000000UL + +/***************************** +* Macro's for fixed size enums +* +* Example of use: +* +* TYPEDEF_ENUM { +* Def1, +* ..., +* Defn +* }ENUM8 (MyEnum_t); // Or ENUM16 or ENUM32 +* +******************************/ +/** This macro should be used to start the definition of an enumerated type. */ +#define TYPEDEF_ENUM enum +/** + * This macro should be used to finalize the definition of an enumerated type + * "t" compatible with the uint8 data type described in section 3.1.1. + */ +#define ENUM8(t) ;typedef uint8 t +/** + * This macro should be used to finalize the definition of an enumerated type + * "t" compatible with the uint16 data type described in section 3.1.1. + */ +#define ENUM16(t) ;typedef uint16 t +/** + * This macro should be used to finalize the definition of an enumerated type + * "t" compatible with the uint32 data type described in section 3.1.1. + */ +#define ENUM32(t) ;typedef uint32 t +/** + * This macro should be used to finalize the definition of an enumerated type + * "t" compatible with the sint8 data type described in section 3.1.1. + */ +#define SIGNED_ENUM8(t) ;typedef sint8 t +/** + * This macro should be used to finalize the definition of an enumerated type + * "t" compatible with the sint16 data type described in section 3.1.1. + */ +#define SIGNED_ENUM16(t) ;typedef sint16 t +/** + * This macro should be used to finalize the definition of an enumerated type + * "t" compatible with the sint32 data type described in section 3.1.1. + */ +#define SIGNED_ENUM32(t) ;typedef sint32 t + +#endif // INCLUSION_GUARD_T_BASICDEFINITIONS_H + |