platforms/os/common/inc/cli_cu_common.h
changeset 0 10c42ec6c05f
equal deleted inserted replaced
-1:000000000000 0:10c42ec6c05f
       
     1 /*
       
     2  * cli_cu_common.h
       
     3  *
       
     4  * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
       
     5  * All rights reserved.      
       
     6  * 
       
     7  * This program and the accompanying materials are made available under the 
       
     8  * terms of the Eclipse Public License v1.0 or BSD License which accompanies
       
     9  * this distribution. The Eclipse Public License is available at
       
    10  * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
       
    11  *                                                                       
       
    12  * Redistribution and use in source and binary forms, with or without    
       
    13  * modification, are permitted provided that the following conditions    
       
    14  * are met:                                                              
       
    15  *                                                                       
       
    16  *  * Redistributions of source code must retain the above copyright     
       
    17  *    notice, this list of conditions and the following disclaimer.      
       
    18  *  * Redistributions in binary form must reproduce the above copyright  
       
    19  *    notice, this list of conditions and the following disclaimer in    
       
    20  *    the documentation and/or other materials provided with the         
       
    21  *    distribution.                                                      
       
    22  *  * Neither the name Texas Instruments nor the names of its            
       
    23  *    contributors may be used to endorse or promote products derived    
       
    24  *    from this software without specific prior written permission.      
       
    25  *                                                                       
       
    26  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   
       
    27  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     
       
    28  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
       
    29  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  
       
    30  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
       
    31  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      
       
    32  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
       
    33  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
       
    34  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   
       
    35  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
       
    36  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       
    37  */
       
    38 
       
    39 #ifndef common_h
       
    40 #define common_h
       
    41 
       
    42 #include "tidef.h"
       
    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 TI_TRUE
       
    53 #define TI_TRUE  1
       
    54 #endif
       
    55 
       
    56 #ifndef TI_FALSE
       
    57 #define TI_FALSE 0
       
    58 #endif
       
    59 
       
    60 #ifndef TI_PENDING
       
    61 #define TI_PENDING 2
       
    62 #endif
       
    63 
       
    64 
       
    65 #ifndef NULL
       
    66 # define NULL 0L
       
    67 #endif
       
    68 
       
    69 #ifndef TI_VOIDCAST
       
    70 #define TI_VOIDCAST(p) ((void)p)
       
    71 #endif
       
    72 
       
    73 
       
    74 #ifndef print_err
       
    75 # define print_err(fmt, arg...) fprintf(stderr, fmt, ##arg)
       
    76 #endif
       
    77 
       
    78 
       
    79 #ifndef SIZE_ARR
       
    80 # define SIZE_ARR(a) (sizeof(a)/sizeof(a[0]) )
       
    81 #endif
       
    82 
       
    83 #ifndef min
       
    84 # define min(a, b)	(((a)<(b)) ? (a) : (b))
       
    85 #endif
       
    86 
       
    87 #ifndef max
       
    88 # define max(a, b)	(((a)>(b)) ? (a) : (b))
       
    89 #endif
       
    90 
       
    91 typedef struct
       
    92 {
       
    93     TI_UINT32 value;
       
    94     char *name;
       
    95 } named_value_t;
       
    96 
       
    97 #define print_available_values(arr) \
       
    98         {   int i; for(i=0; i<SIZE_ARR(arr); i++) \
       
    99             print("%d - %s%s", arr[i].value, arr[i].name, (i>=SIZE_ARR(arr)-1) ? "\n" : ", " ); \
       
   100         }
       
   101         
       
   102 void print_memory_dump(char *addr, int size );
       
   103 
       
   104 #endif	/* common_h */
       
   105