Index: Common.h =================================================================== diff -u -re8828d66e4a76e0590c3f06b7f6235f33df64e80 -r36da170faf02387c47766be557b4b391cd55ae92 --- Common.h (.../Common.h) (revision e8828d66e4a76e0590c3f06b7f6235f33df64e80) +++ Common.h (.../Common.h) (revision 36da170faf02387c47766be557b4b391cd55ae92) @@ -90,8 +90,8 @@ #define MASK_OFF_MSB 0x00FF ///< Bits to mask off the most significant byte of a 2-byte word. #define MASK_OFF_LSB 0xFF00 ///< Bits to mask off the least significant byte of a 2-byte word. #define MASK_OFF_MSW 0x0000FFFF ///< Bits to mask off the most significant 2-byte word of a 4-byte word. -#define MASK_OFF_LSW 0xFFFF0000 ///< Bits to mask off the least signficiant 2-byte word of a 4-byte word. -#define MASK_OFF_U32_MSB 0x00FFFFFF ///< Bits to mask off the most significatn 2-byte word of a 4-byte word. +#define MASK_OFF_LSW 0xFFFF0000 ///< Bits to mask off the least significant 2-byte word of a 4-byte word. +#define MASK_OFF_U32_MSB 0x00FFFFFF ///< Bits to mask off the most significant 2-byte word of a 4-byte word. #define SHIFT_8_BITS_FOR_BYTE_SHIFT 8 ///< # of bits to shift in order to shift a byte. #define SHIFT_16_BITS_FOR_WORD_SHIFT 16 ///< # of bits to shift in order to shift 2 bytes. #define MASK_OFF_NIBBLE_LSB 0xF0 ///< Bits to mask off the least significant nibble of a byte. @@ -105,11 +105,11 @@ #define SEC_PER_MIN 60 ///< # of seconds in a minute. #define FRACTION_TO_PERCENT_FACTOR 100.0 ///< Percentage factor (100). #define MIN_PER_HOUR 60 ///< # of minutes in an hour. +#define PI 3.1415927 ///< PI. +#define SECONDS_IN_A_DAY 86400 ///< Number of seconds in a day // **** Common Macros **** -#define ABS(v) ((v) < 0 ? (v) * -1 : (v)) -#define FABS(v) ((v) < 0.0 ? (v) * -1.0 : (v)) #define FLOAT_TO_INT_WITH_ROUND(f) ((f) < 0.0 ? (S32)((f) - FLOAT_TO_INT_ROUNDUP_OFFSET) : (S32)((f) + FLOAT_TO_INT_ROUNDUP_OFFSET)) ///< Macro converts a floating point value to an integer. #define CAP(v, u) ((v) > (u) ? (u) : (v)) ///< Macro caps a value to a maximum. #define RANGE(v, l, u) ((v) > (u) ? (u) : ((v) < (l) ? (l) : (v))) ///< Macro enforces a range on a value. @@ -126,9 +126,8 @@ #define MAKE_LONG_OF_WORDS(h, l) ((((U32)(h) << SHIFT_16_BITS_FOR_WORD_SHIFT) & MASK_OFF_LSW) | ((U32)(l) & MASK_OFF_MSW)) ///< Macro merges two 2-byte words into a 4-byte word. #define GET_TOGGLE(v, l, h) ((v) == (l) ? (h) : (l)) ///< Macro toggles a value. #define BIT_BY_POS(p) (1U << (p)) ///< Macro returns a bit mask for a bit of given position. +#define RAD2DEG(r) ((r) * 180.0 / PI) ///< Macro converts radians to degrees -/**@}*/ - /// Macro to set a specific alarm with 1 piece of unsigned 32-bit alarm data. #define SET_ALARM_WITH_1_U32_DATA(a,d1) { \ ALARM_DATA_T dat1; \ @@ -168,17 +167,15 @@ activateAlarm2Data( a, dat1, dat2 ); \ } +/**@}*/ + // **** VectorCAST Definitions **** #ifdef _VECTORCAST_ #define _enable_IRQ() #define _disable_IRQ() #define _enable_FIQ() - #define _disable_FIQ() - - #define fabs(v) ((v) < 0.0 ? ((v) * -1.0) : (v)) - #endif // include alarm mgmt header so any module can trigger an alarm @@ -190,4 +187,6 @@ // include test support definitions and macros #include "TestSupport.h" +/**@}*/ + #endif