• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * cli_cu_common.h
3  *
4  * Copyright(c) 1998 - 2009 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 #ifndef common_h
35 #define common_h
36 
37 #include "tidef.h"
38 
39 #ifdef _WINDOWS
40 #define DRV_NAME "\\\\.\\tiwlnpci"
41 #endif
42 
43 #ifndef TIWLAN_DRV_NAME
44 #define TIWLAN_DRV_NAME  DRV_NAME
45 #endif
46 
47 #define IN     /* input parameter          */
48 #define OUT    /* output parameter         */
49 #define INOUT  /* input & output parameter */
50 
51 #ifndef TI_TRUE
52 #define TI_TRUE  1
53 #endif
54 
55 #ifndef TI_FALSE
56 #define TI_FALSE 0
57 #endif
58 
59 #ifndef TI_PENDING
60 #define TI_PENDING 2
61 #endif
62 
63 
64 #ifndef NULL
65 # define NULL 0L
66 #endif
67 
68 #ifndef TI_VOIDCAST
69 #define TI_VOIDCAST(p) ((void)p)
70 #endif
71 
72 #ifdef __LINUX__
73 #ifndef print
74 # define print(fmt, arg...) fprintf(stdout, fmt, ##arg)
75 #endif
76 
77 #ifndef print_err
78 # define print_err(fmt, arg...) fprintf(stderr, fmt, ##arg)
79 #endif
80 
81 #ifndef print_deb
82 # ifdef DEBUG_MESSAGES
83 #  define print_deb(fmt, arg...) fprintf(stdout, fmt, ##arg)
84 # else
85 #  define print_deb(fmt, arg...)
86 # endif	/* DEBUG_MESSAGES */
87 #endif	/* print_deb */
88 
89 #endif /* __LINUX__ */
90 
91 #ifndef SIZE_ARR
92 # define SIZE_ARR(a) (sizeof(a)/sizeof(a[0]) )
93 #endif
94 
95 #ifndef min
96 # define min(a, b)	(((a)<(b)) ? (a) : (b))
97 #endif
98 
99 #ifndef max
100 # define max(a, b)	(((a)>(b)) ? (a) : (b))
101 #endif
102 
103 typedef struct
104 {
105     TI_UINT32 value;
106     char *name;
107 } named_value_t;
108 
109 #define print_available_values(arr) \
110         {   int i; for(i=0; i<SIZE_ARR(arr); i++) \
111             print("%d - %s%s", arr[i].value, arr[i].name, (i>=SIZE_ARR(arr)-1) ? "\n" : ", " ); \
112         }
113 
114 void print_memory_dump(char *addr, int size );
115 
116 #endif	/* common_h */
117 
118