00001 #ifndef _myStuff_ 00002 00003 #include <stdio.h> 00004 00005 #define DEBUG 00006 00007 #ifdef DEBUG 00008 #define _MY_PRINT_FILE printf("%s:%d: ", __FILE__, __LINE__) 00009 #define _MY_PRINT_LF printf("\n") 00010 #define _MY_PRINT_I(var1) printf("%d ", var1) 00011 #define _MY_PRINT_X(var1) printf("0x%x ", var1) 00012 #define _MY_PRINT_D(var1) printf("%f ", var1) 00013 #define _MY_PRINT_S(var1) printf("%s ", var1) 00014 #define _MY_PRINT_S_X(var1, var2) printf("%s 0x%x", var1, var2) 00015 00016 #define _MY_PRINTLF_0 printf("%s:%d \n", __FILE__, __LINE__) 00017 #define _MY_PRINTLF_I(var1) printf("%s:%d: %d \n", __FILE__, __LINE__, var1) 00018 #define _MY_PRINTLF_X(var1) printf("%s:%d: 0x%x \n", __FILE__, __LINE__, var1) 00019 #define _MY_PRINTLF_D(var1) printf("%s:%d: %f \n", __FILE__, __LINE__, var1) 00020 #define _MY_PRINTLF_S(var1) printf("%s:%d: %s \n", __FILE__, __LINE__, var1) 00021 #define _MY_PRINTLF_S_I(var1, var2) printf("%s:%d: %s %d \n", __FILE__, __LINE__, var1, var2) 00022 #define _MY_PRINTLF_S_X(var1, var2) printf("%s:%d: %s 0x%x \n", __FILE__, __LINE__, var1, var2) 00023 #define _MY_PRINTLF_S_D(var1, var2) printf("%s:%d: %s %f \n", __FILE__, __LINE__, var1, var2) 00024 #define _MY_PRINTLF_S_S(var1, var2) printf("%s:%d: %s %s \n", __FILE__, __LINE__, var1, var2) 00025 #define _MY_PRINTLF_S_I_D(var1, var2, var3) printf("%s:%d: %s %d %f \n", __FILE__, __LINE__, var1, var2, var3) 00026 #define _MY_PRINTLF_S_X_D(var1, var2, var3) printf("%s:%d: %s 0x%x %f \n", __FILE__, __LINE__, var1, var2, var3) 00027 #define _MY_PRINTLF_S_X_X(var1, var2, var3) printf("%s:%d: %s 0x%x 0x%x \n", __FILE__, __LINE__, var1, var2, var3) 00028 #define _MY_PRINTLF_S_D_D(var1, var2, var3) printf("%s:%d: %s %f %f \n", __FILE__, __LINE__, var1, var2, var3) 00029 #else 00030 #define _MY_PRINT_FILE 00031 #define _MY_PRINT_LF 00032 #define _MY_PRINT_I(var1) 00033 #define _MY_PRINT_X(var1) 00034 #define _MY_PRINT_D(var1) 00035 #define _MY_PRINT_S(var1) 00036 #define _MY_PRINT_S_X(var1, var2) 00037 00038 #define _MY_PRINTLF_0 00039 #define _MY_PRINTLF_I(var1) 00040 #define _MY_PRINTLF_X(var1) 00041 #define _MY_PRINTLF_D(var1) 00042 #define _MY_PRINTLF_S(var1) 00043 #define _MY_PRINTLF_S_I(var1, var2) 00044 #define _MY_PRINTLF_S_X(var1, var2) 00045 #define _MY_PRINTLF_S_D(var1, var2) 00046 #define _MY_PRINTLF_S_S(var1, var2) 00047 #define _MY_PRINTLF_S_I_D(var1, var2, var3) 00048 #define _MY_PRINTLF_S_X_D(var1, var2, var3) 00049 #define _MY_PRINTLF_S_X_X(var1, var2, var3) 00050 #define _MY_PRINTLF_S_D_D(var1, var2, var3) 00051 #endif 00052 00053 #define _MY_GET_UINT8_FROM_BYTE_ARRAY(arr, off) (arr[off]) 00054 #define _MY_GET_UINT16_FROM_BYTE_ARRAY(arr, off) (arr[off]<<8 | arr[off+1]) 00055 #define _MY_GET_UINT32_FROM_BYTE_ARRAY(arr, off) (arr[off]<<24 | arr[off]<<16 | arr[off]<<8 | arr[off+1]) 00056 #define _MY_GET_REAL_FROM_BYTE_ARRAY(arr, off, dataType) (*((dataType*) &(arr[off]))) 00057 00058 #define _MY_GET_RT_TIME rt_get_cpu_time_ns()/1000000.0 00059 00060 #define _myStuff_ 00061 #endif