1/**************************************************************************** 2**+-----------------------------------------------------------------------+** 3**| |** 4**| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved. |** 5**| All rights reserved. |** 6**| |** 7**| Redistribution and use in source and binary forms, with or without |** 8**| modification, are permitted provided that the following conditions |** 9**| are met: |** 10**| |** 11**| * Redistributions of source code must retain the above copyright |** 12**| notice, this list of conditions and the following disclaimer. |** 13**| * Redistributions in binary form must reproduce the above copyright |** 14**| notice, this list of conditions and the following disclaimer in |** 15**| the documentation and/or other materials provided with the |** 16**| distribution. |** 17**| * Neither the name Texas Instruments nor the names of its |** 18**| contributors may be used to endorse or promote products derived |** 19**| from this software without specific prior written permission. |** 20**| |** 21**| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |** 22**| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |** 23**| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |** 24**| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |** 25**| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |** 26**| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |** 27**| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |** 28**| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |** 29**| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |** 30**| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |** 31**| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |** 32**| |** 33**+-----------------------------------------------------------------------+** 34****************************************************************************/ 35 36#ifndef common_h 37#define common_h 38 39#include "osTIType.h" 40 41#ifdef _WINDOWS 42#endif 43 44#ifndef TIWLAN_DRV_NAME 45#define TIWLAN_DRV_NAME DRV_NAME 46#endif 47 48#define IN /* input parameter */ 49#define OUT /* output parameter */ 50#define INOUT /* input & output parameter */ 51 52#ifndef TRUE 53#define TRUE 1 54#endif 55 56#ifndef FALSE 57#define FALSE 0 58#endif 59 60#ifndef NULL 61# define NULL 0L 62#endif 63 64#ifndef UNUSED 65# define UNUSED(p) ((void)p) 66#endif 67 68#ifndef _WINDOWS 69 70 #ifndef print 71 # define print(fmt, arg...) fprintf(stdout, fmt, ##arg) 72 #endif 73 74 #ifndef print_err 75 # define print_err(fmt, arg...) fprintf(stderr, fmt, ##arg) 76 #endif 77 78 #ifndef print_deb 79 # ifdef DEBUG_MESSAGES 80 # define print_deb(fmt, arg...) fprintf(stdout, fmt, ##arg) 81 # else 82 # define print_deb(fmt, arg...) 83 # endif /* DEBUG_MESSAGES */ 84 #endif /* print_deb */ 85 86#endif /* __LINUX__ */ 87 88#ifndef SIZE_ARR 89# define SIZE_ARR(a) (sizeof(a)/sizeof(a[0]) ) 90#endif 91 92#ifndef min 93# define min(a, b) (((a)<(b)) ? (a) : (b)) 94#endif 95 96#ifndef max 97# define max(a, b) (((a)>(b)) ? (a) : (b)) 98#endif 99 100typedef struct 101{ 102 tiUINT32 value; 103 char *name; 104} named_value_t; 105#ifdef _WINDOWS 106#else 107#define print_available_values(arr) \ 108 { int i; for(i=0; i<SIZE_ARR(arr); i++) \ 109 print("%d - %s%s", arr[i].value, arr[i].name, (i>=SIZE_ARR(arr)-1) ? "\n" : ", " ); \ 110 } 111#endif 112 113void print_memory_dump(char *addr, int size ); 114 115#endif /* common_h */ 116 117