Home | History | Annotate | Download | only in inc
      1 /*
      2  * windows_types.h
      3  *
      4  * Copyright(c) 1998 - 2010 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  * inc/windows_types.h
     37  *
     38  */
     39 
     40 #ifndef _WINDOWS_TYPES_H
     41 #define _WINDOWS_TYPES_H
     42 
     43 #include "tidef.h"
     44 #include "ioctl_init.h"
     45 
     46 /*typedef TI_BOOL    TI_BOOL, *PBOOLEAN;*/
     47 typedef TI_UINT16    USHORT, *PUSHORT;
     48 typedef char      CHAR;
     49 typedef const char * LPCSTR;
     50 
     51 #define IN
     52 #define OUT
     53 #define NDIS_MAX_STRING_LEN   361
     54 
     55 typedef struct _STRING {
     56   USHORT  Length;
     57   USHORT  MaximumLength;
     58   TI_INT8*  Buffer;
     59 } ANSI_STRING, *PANSI_STRING, UNICODE_STRING, *PUNICODE_STRING;
     60 
     61 typedef ANSI_STRING NDIS_STRING, *PNDIS_STRING;
     62 typedef void * NDIS_HANDLE;
     63 typedef int NDIS_STATUS, *PNDIS_STATUS;
     64 
     65 
     66 typedef TI_UINT32 NDIS_OID, *PNDIS_OID;
     67 #define PCI_TYPE0_ADDRESSES             6
     68 #define PCI_TYPE1_ADDRESSES             2
     69 /*typedef LARGE_INTEGER NDIS_PHYSICAL_ADDRESS; */
     70 typedef void* *PDEVICE_OBJECT, *PDRIVER_OBJECT;
     71 typedef TI_UINT32 NDIS_MINIPORT_INTERRUPT, NDIS_MINIPORT_TIMER, NDIS_SPIN_LOCK;
     72 typedef TI_UINT32 PNDIS_PACKET, *PPNDIS_PACKET;
     73 
     74 typedef enum _NDIS_PARAMETER_TYPE {
     75   NdisParameterInteger,
     76   NdisParameterHexInteger,
     77   NdisParameterString,
     78   NdisParameterMultiString,
     79   NdisParameterBinary
     80 } NDIS_PARAMETER_TYPE, *PNDIS_PARAMETER_TYPE;
     81 
     82 typedef struct {
     83     USHORT  Length;
     84     void*  Buffer;
     85 } BINARY_DATA;
     86 
     87 typedef struct _NDIS_CONFIGURATION_PARAMETER {
     88   NDIS_PARAMETER_TYPE  ParameterType;
     89   union {
     90     TI_UINT32  IntegerData;
     91     NDIS_STRING  StringData;
     92     BINARY_DATA  BinaryData;
     93   } ParameterData;
     94   char StringBuffer[NDIS_MAX_STRING_LEN];
     95 } NDIS_CONFIGURATION_PARAMETER, *PNDIS_CONFIGURATION_PARAMETER;
     96 
     97 typedef TI_UINT32 NTSTATUS;
     98 
     99 #ifndef NDIS_STATUS_SUCCESS
    100 # define NDIS_STATUS_SUCCESS                        ((NDIS_STATUS)0x00000000L)
    101 # define NDIS_STATUS_PENDING                        ((NDIS_STATUS)0x00000103L)
    102 # define NDIS_STATUS_RESET_END                      ((NDIS_STATUS)0x40010005L)
    103 # define NDIS_STATUS_MEDIA_SPECIFIC_INDICATION      ((NDIS_STATUS)0x40010012L)
    104 # define NDIS_STATUS_FAILURE                        ((NDIS_STATUS)0xC0000001L)
    105 # define NDIS_STATUS_ADAPTER_NOT_FOUND              ((NDIS_STATUS)0xC0010006L)
    106 # define NDIS_STATUS_INVALID_LENGTH                 ((NDIS_STATUS)0xC0010014L)
    107 # define NDIS_STATUS_BUFFER_TOO_SHORT               ((NDIS_STATUS)0xC0010016L)
    108 # define NDIS_STATUS_INVALID_OID                    ((NDIS_STATUS)0xC0010017L)
    109 #endif        /* NDIS_STATUS_SUCCESS */
    110 
    111 #define STATUS_SUCCESS                0
    112 #define STATUS_INVALID_PARAMETER     -1
    113 
    114 #define NdisZeroMemory(p, size)      os_memoryZero( NULL, p, size )
    115 #define NdisMoveMemory(d, s, size)   os_memoryCopy( NULL, d, s, size )
    116 
    117 NDIS_STATUS NdisUnicodeStringToAnsiString( IN OUT PANSI_STRING  DestinationString,
    118     IN PUNICODE_STRING  SourceString );
    119 void NdisReadConfiguration( OUT PNDIS_STATUS  Status, OUT PNDIS_CONFIGURATION_PARAMETER  *ParameterValue,
    120     IN NDIS_HANDLE  ConfigurationHandle, IN PNDIS_STRING  Keyword, IN NDIS_PARAMETER_TYPE  ParameterType );
    121 void NdisWriteConfiguration( OUT PNDIS_STATUS  Status, IN NDIS_HANDLE  ConfigurationHandle,
    122     IN PNDIS_STRING  Keyword, IN PNDIS_CONFIGURATION_PARAMETER  ParameterValue );
    123 
    124 typedef struct _NDIS_PACKET_POOL {
    125   NDIS_SPIN_LOCK  SpinLock;
    126   struct _NDIS_PACKET *FreeList;
    127   TI_UINT32  PacketLength;
    128   TI_UINT8  Buffer[1];
    129 } NDIS_PACKET_POOL, * PNDIS_PACKET_POOL;
    130 
    131 typedef enum _NDIS_802_11_STATUS_TYPE
    132 {
    133     Ndis802_11StatusType_Authentication,
    134     Ndis802_11StatusTypeMax    /* not a real type, defined as an upper bound*/
    135 } NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE;
    136 
    137 typedef TI_UINT8   NDIS_802_11_MAC_ADDRESS[6];
    138 
    139 typedef struct _NDIS_802_11_STATUS_INDICATION
    140 {
    141     NDIS_802_11_STATUS_TYPE StatusType;
    142 } NDIS_802_11_STATUS_INDICATION, *PNDIS_802_11_STATUS_INDICATION;
    143 
    144 typedef struct _NDIS_802_11_AUTHENTICATION_REQUEST
    145 {
    146     TI_UINT32 Length;            /* Length of structure*/
    147     NDIS_802_11_MAC_ADDRESS Bssid;
    148     TI_UINT32 Flags;
    149 } NDIS_802_11_AUTHENTICATION_REQUEST, *PNDIS_802_11_AUTHENTICATION_REQUEST;
    150 
    151 typedef TI_INT32 NDIS_802_11_RSSI;           /* in dBm*/
    152 
    153 typedef struct _NDIS_802_11_TEST
    154 {
    155 	TI_UINT32 Length;
    156 	TI_UINT32 Type;
    157 	union {
    158 		struct _AuthenticationEvent {
    159             NDIS_802_11_STATUS_INDICATION Status;
    160             NDIS_802_11_AUTHENTICATION_REQUEST Request[1];
    161 		} AuthenticationEvent;
    162 		NDIS_802_11_RSSI RssiTrigger;
    163 	} UNION_NDIS_TEST;
    164 } NDIS_802_11_TEST, *PNDIS_802_11_TEST;
    165 
    166 /* Added new encryption types*/
    167 /* Also aliased typedef to new name*/
    168 typedef enum _NDIS_802_11_WEP_STATUS
    169 {
    170     Ndis802_11WEPEnabled,
    171     Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
    172     Ndis802_11WEPDisabled,
    173     Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
    174     Ndis802_11WEPKeyAbsent,
    175     Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
    176     Ndis802_11WEPNotSupported,
    177     Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
    178     Ndis802_11Encryption2Enabled,
    179     Ndis802_11Encryption2KeyAbsent,
    180     Ndis802_11Encryption3Enabled,
    181     Ndis802_11Encryption3KeyAbsent
    182 } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
    183   NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
    184 
    185 #ifdef TI_DBG
    186 #ifdef __KERNEL__
    187 #define DbgPrint     printk
    188 #else
    189 #define DbgPrint     printf
    190 #endif
    191 #else
    192 #define DbgPrint
    193 #endif
    194 
    195 #endif /* _WINDOWS_TYPES_H */
    196