aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/rtl8712
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
commitfcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch)
treea57612d1888735a2ec7972891b68c1ac5ec8faea /drivers/staging/rtl8712
parent8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff)
Added missing tegra files.HEADmaster
Diffstat (limited to 'drivers/staging/rtl8712')
-rw-r--r--drivers/staging/rtl8712/big_endian.h69
-rw-r--r--drivers/staging/rtl8712/generic.h153
-rw-r--r--drivers/staging/rtl8712/if_ether.h116
-rw-r--r--drivers/staging/rtl8712/ip.h137
-rw-r--r--drivers/staging/rtl8712/little_endian.h69
-rw-r--r--drivers/staging/rtl8712/rtl871x_byteorder.h13
-rw-r--r--drivers/staging/rtl8712/swab.h106
-rw-r--r--drivers/staging/rtl8712/usb_vendor_req.h33
8 files changed, 696 insertions, 0 deletions
diff --git a/drivers/staging/rtl8712/big_endian.h b/drivers/staging/rtl8712/big_endian.h
new file mode 100644
index 00000000000..8512d1b5919
--- /dev/null
+++ b/drivers/staging/rtl8712/big_endian.h
@@ -0,0 +1,69 @@
1#ifndef _LINUX_BYTEORDER_BIG_ENDIAN_H
2#define _LINUX_BYTEORDER_BIG_ENDIAN_H
3
4#ifndef __BIG_ENDIAN
5#define __BIG_ENDIAN 4321
6#endif
7#ifndef __BIG_ENDIAN_BITFIELD
8#define __BIG_ENDIAN_BITFIELD
9#endif
10
11#include "swab.h"
12
13#define __constant_htonl(x) ((__u32)(x))
14#define __constant_ntohl(x) ((__u32)(x))
15#define __constant_htons(x) ((__u16)(x))
16#define __constant_ntohs(x) ((__u16)(x))
17#define __constant_cpu_to_le64(x) ___constant_swab64((x))
18#define __constant_le64_to_cpu(x) ___constant_swab64((x))
19#define __constant_cpu_to_le32(x) ___constant_swab32((x))
20#define __constant_le32_to_cpu(x) ___constant_swab32((x))
21#define __constant_cpu_to_le16(x) ___constant_swab16((x))
22#define __constant_le16_to_cpu(x) ___constant_swab16((x))
23#define __constant_cpu_to_be64(x) ((__u64)(x))
24#define __constant_be64_to_cpu(x) ((__u64)(x))
25#define __constant_cpu_to_be32(x) ((__u32)(x))
26#define __constant_be32_to_cpu(x) ((__u32)(x))
27#define __constant_cpu_to_be16(x) ((__u16)(x))
28#define __constant_be16_to_cpu(x) ((__u16)(x))
29#define __cpu_to_le64(x) __swab64((x))
30#define __le64_to_cpu(x) __swab64((x))
31#define __cpu_to_le32(x) __swab32((x))
32#define __le32_to_cpu(x) __swab32((x))
33#define __cpu_to_le16(x) __swab16((x))
34#define __le16_to_cpu(x) __swab16((x))
35#define __cpu_to_be64(x) ((__u64)(x))
36#define __be64_to_cpu(x) ((__u64)(x))
37#define __cpu_to_be32(x) ((__u32)(x))
38#define __be32_to_cpu(x) ((__u32)(x))
39#define __cpu_to_be16(x) ((__u16)(x))
40#define __be16_to_cpu(x) ((__u16)(x))
41#define __cpu_to_le64p(x) __swab64p((x))
42#define __le64_to_cpup(x) __swab64p((x))
43#define __cpu_to_le32p(x) __swab32p((x))
44#define __le32_to_cpup(x) __swab32p((x))
45#define __cpu_to_le16p(x) __swab16p((x))
46#define __le16_to_cpup(x) __swab16p((x))
47#define __cpu_to_be64p(x) (*(__u64 *)(x))
48#define __be64_to_cpup(x) (*(__u64 *)(x))
49#define __cpu_to_be32p(x) (*(__u32 *)(x))
50#define __be32_to_cpup(x) (*(__u32 *)(x))
51#define __cpu_to_be16p(x) (*(__u16 *)(x))
52#define __be16_to_cpup(x) (*(__u16 *)(x))
53#define __cpu_to_le64s(x) __swab64s((x))
54#define __le64_to_cpus(x) __swab64s((x))
55#define __cpu_to_le32s(x) __swab32s((x))
56#define __le32_to_cpus(x) __swab32s((x))
57#define __cpu_to_le16s(x) __swab16s((x))
58#define __le16_to_cpus(x) __swab16s((x))
59#define __cpu_to_be64s(x) do {} while (0)
60#define __be64_to_cpus(x) do {} while (0)
61#define __cpu_to_be32s(x) do {} while (0)
62#define __be32_to_cpus(x) do {} while (0)
63#define __cpu_to_be16s(x) do {} while (0)
64#define __be16_to_cpus(x) do {} while (0)
65
66#include "generic.h"
67
68#endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */
69
diff --git a/drivers/staging/rtl8712/generic.h b/drivers/staging/rtl8712/generic.h
new file mode 100644
index 00000000000..742424bdf16
--- /dev/null
+++ b/drivers/staging/rtl8712/generic.h
@@ -0,0 +1,153 @@
1#ifndef _LINUX_BYTEORDER_GENERIC_H
2#define _LINUX_BYTEORDER_GENERIC_H
3
4/*
5 * linux/byteorder_generic.h
6 * Generic Byte-reordering support
7 *
8 * Francois-Rene Rideau <fare@tunes.org> 19970707
9 * gathered all the good ideas from all asm-foo/byteorder.h into one file,
10 * cleaned them up.
11 * I hope it is compliant with non-GCC compilers.
12 * I decided to put __BYTEORDER_HAS_U64__ in byteorder.h,
13 * because I wasn't sure it would be ok to put it in types.h
14 * Upgraded it to 2.1.43
15 * Francois-Rene Rideau <fare@tunes.org> 19971012
16 * Upgraded it to 2.1.57
17 * to please Linus T., replaced huge #ifdef's between little/big endian
18 * by nestedly #include'd files.
19 * Francois-Rene Rideau <fare@tunes.org> 19971205
20 * Made it to 2.1.71; now a facelift:
21 * Put files under include/linux/byteorder/
22 * Split swab from generic support.
23 *
24 * TODO:
25 * = Regular kernel maintainers could also replace all these manual
26 * byteswap macros that remain, disseminated among drivers,
27 * after some grep or the sources...
28 * = Linus might want to rename all these macros and files to fit his taste,
29 * to fit his personal naming scheme.
30 * = it seems that a few drivers would also appreciate
31 * nybble swapping support...
32 * = every architecture could add their byteswap macro in asm/byteorder.h
33 * see how some architectures already do (i386, alpha, ppc, etc)
34 * = cpu_to_beXX and beXX_to_cpu might some day need to be well
35 * distinguished throughout the kernel. This is not the case currently,
36 * since little endian, big endian, and pdp endian machines needn't it.
37 * But this might be the case for, say, a port of Linux to 20/21 bit
38 * architectures (and F21 Linux addict around?).
39 */
40
41/*
42 * The following macros are to be defined by <asm/byteorder.h>:
43 *
44 * Conversion of long and short int between network and host format
45 * ntohl(__u32 x)
46 * ntohs(__u16 x)
47 * htonl(__u32 x)
48 * htons(__u16 x)
49 * It seems that some programs (which? where? or perhaps a standard? POSIX?)
50 * might like the above to be functions, not macros (why?).
51 * if that's true, then detect them, and take measures.
52 * Anyway, the measure is: define only ___ntohl as a macro instead,
53 * and in a separate file, have
54 * unsigned long inline ntohl(x){return ___ntohl(x);}
55 *
56 * The same for constant arguments
57 * __constant_ntohl(__u32 x)
58 * __constant_ntohs(__u16 x)
59 * __constant_htonl(__u32 x)
60 * __constant_htons(__u16 x)
61 *
62 * Conversion of XX-bit integers (16- 32- or 64-)
63 * between native CPU format and little/big endian format
64 * 64-bit stuff only defined for proper architectures
65 * cpu_to_[bl]eXX(__uXX x)
66 * [bl]eXX_to_cpu(__uXX x)
67 *
68 * The same, but takes a pointer to the value to convert
69 * cpu_to_[bl]eXXp(__uXX x)
70 * [bl]eXX_to_cpup(__uXX x)
71 *
72 * The same, but change in situ
73 * cpu_to_[bl]eXXs(__uXX x)
74 * [bl]eXX_to_cpus(__uXX x)
75 *
76 * See asm-foo/byteorder.h for examples of how to provide
77 * architecture-optimized versions
78 *
79 */
80
81
82/*
83 * inside the kernel, we can use nicknames;
84 * outside of it, we must avoid POSIX namespace pollution...
85 */
86#define cpu_to_le64 __cpu_to_le64
87#define le64_to_cpu __le64_to_cpu
88#define cpu_to_le32 __cpu_to_le32
89#define le32_to_cpu __le32_to_cpu
90#define cpu_to_le16 __cpu_to_le16
91#define le16_to_cpu __le16_to_cpu
92#define cpu_to_be64 __cpu_to_be64
93#define be64_to_cpu __be64_to_cpu
94#define cpu_to_be32 __cpu_to_be32
95#define be32_to_cpu __be32_to_cpu
96#define cpu_to_be16 __cpu_to_be16
97#define be16_to_cpu __be16_to_cpu
98#define cpu_to_le64p __cpu_to_le64p
99#define le64_to_cpup __le64_to_cpup
100#define cpu_to_le32p __cpu_to_le32p
101#define le32_to_cpup __le32_to_cpup
102#define cpu_to_le16p __cpu_to_le16p
103#define le16_to_cpup __le16_to_cpup
104#define cpu_to_be64p __cpu_to_be64p
105#define be64_to_cpup __be64_to_cpup
106#define cpu_to_be32p __cpu_to_be32p
107#define be32_to_cpup __be32_to_cpup
108#define cpu_to_be16p __cpu_to_be16p
109#define be16_to_cpup __be16_to_cpup
110#define cpu_to_le64s __cpu_to_le64s
111#define le64_to_cpus __le64_to_cpus
112#define cpu_to_le32s __cpu_to_le32s
113#define le32_to_cpus __le32_to_cpus
114#define cpu_to_le16s __cpu_to_le16s
115#define le16_to_cpus __le16_to_cpus
116#define cpu_to_be64s __cpu_to_be64s
117#define be64_to_cpus __be64_to_cpus
118#define cpu_to_be32s __cpu_to_be32s
119#define be32_to_cpus __be32_to_cpus
120#define cpu_to_be16s __cpu_to_be16s
121#define be16_to_cpus __be16_to_cpus
122
123
124/*
125 * Handle ntohl and suches. These have various compatibility
126 * issues - like we want to give the prototype even though we
127 * also have a macro for them in case some strange program
128 * wants to take the address of the thing or something..
129 *
130 * Note that these used to return a "long" in libc5, even though
131 * long is often 64-bit these days.. Thus the casts.
132 *
133 * They have to be macros in order to do the constant folding
134 * correctly - if the argument passed into a inline function
135 * it is no longer constant according to gcc..
136 */
137
138#undef ntohl
139#undef ntohs
140#undef htonl
141#undef htons
142
143/*
144 * Do the prototypes. Somebody might want to take the
145 * address or some such sick thing..
146 */
147extern __u32 ntohl(__u32);
148extern __u32 htonl(__u32);
149extern unsigned short int ntohs(unsigned short int);
150extern unsigned short int htons(unsigned short int);
151
152#endif /* _LINUX_BYTEORDER_GENERIC_H */
153
diff --git a/drivers/staging/rtl8712/if_ether.h b/drivers/staging/rtl8712/if_ether.h
new file mode 100644
index 00000000000..0e9753b9ed3
--- /dev/null
+++ b/drivers/staging/rtl8712/if_ether.h
@@ -0,0 +1,116 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Global definitions for the Ethernet IEEE 802.3 interface.
7 *
8 * Version: @(#)if_ether.h 1.0.1a 02/08/94
9 *
10 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
11 * Donald Becker, <becker@super.org>
12 * Alan Cox, <alan@redhat.com>
13 * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk>
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version.
19 */
20
21#ifndef _LINUX_IF_ETHER_H
22#define _LINUX_IF_ETHER_H
23
24/*
25 * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
26 * and FCS/CRC (frame check sequence).
27 */
28
29#define ETH_ALEN 6 /* Octets in one ethernet addr */
30#define ETH_HLEN 14 /* Total octets in header. */
31#define ETH_ZLEN 60 /* Min. octets in frame sans FCS */
32#define ETH_DATA_LEN 1500 /* Max. octets in payload */
33#define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */
34
35/*
36 * These are the defined Ethernet Protocol ID's.
37 */
38
39#define ETH_P_LOOP 0x0060 /* Ethernet Loopback packet */
40#define ETH_P_PUP 0x0200 /* Xerox PUP packet */
41#define ETH_P_PUPAT 0x0201 /* Xerox PUP Addr Trans packet */
42#define ETH_P_IP 0x0800 /* Internet Protocol packet */
43#define ETH_P_X25 0x0805 /* CCITT X.25 */
44#define ETH_P_ARP 0x0806 /* Address Resolution packet */
45#define ETH_P_BPQ 0x08FF /* G8BPQ AX.25 Ethernet Packet
46 * [ NOT AN OFFICIAL ID ] */
47#define ETH_P_IEEEPUP 0x0a00 /* Xerox IEEE802.3 PUP packet */
48#define ETH_P_IEEEPUPAT 0x0a01 /* Xerox IEEE802.3 PUP Addr
49 * Trans packet */
50#define ETH_P_DEC 0x6000 /* DEC Assigned proto */
51#define ETH_P_DNA_DL 0x6001 /* DEC DNA Dump/Load */
52#define ETH_P_DNA_RC 0x6002 /* DEC DNA Remote Console */
53#define ETH_P_DNA_RT 0x6003 /* DEC DNA Routing */
54#define ETH_P_LAT 0x6004 /* DEC LAT */
55#define ETH_P_DIAG 0x6005 /* DEC Diagnostics */
56#define ETH_P_CUST 0x6006 /* DEC Customer use */
57#define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */
58#define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */
59#define ETH_P_ATALK 0x809B /* Appletalk DDP */
60#define ETH_P_AARP 0x80F3 /* Appletalk AARP */
61#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */
62#define ETH_P_IPX 0x8137 /* IPX over DIX */
63#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */
64#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */
65#define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */
66#define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */
67#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport
68 * over Ethernet
69 */
70
71/*
72 * Non DIX types. Won't clash for 1500 types.
73 */
74
75#define ETH_P_802_3 0x0001 /* Dummy type for 802.3 frames */
76#define ETH_P_AX25 0x0002 /* Dummy protocol id for AX.25 */
77#define ETH_P_ALL 0x0003 /* Every packet (be careful!!!) */
78#define ETH_P_802_2 0x0004 /* 802.2 frames */
79#define ETH_P_SNAP 0x0005 /* Internal only */
80#define ETH_P_DDCMP 0x0006 /* DEC DDCMP: Internal only */
81#define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/
82#define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */
83#define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */
84#define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/
85#define ETH_P_TR_802_2 0x0011i /* 802.2 frames */
86#define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */
87#define ETH_P_CONTROL 0x0016 /* Card specific control frames */
88#define ETH_P_IRDA 0x0017 /* Linux-IrDA */
89#define ETH_P_ECONET 0x0018 /* Acorn Econet */
90
91/*
92 * This is an Ethernet frame header.
93 */
94
95struct ethhdr {
96 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
97 unsigned char h_source[ETH_ALEN]; /* source ether addr */
98 unsigned short h_proto; /* packet type ID field */
99};
100
101struct _vlan {
102 unsigned short h_vlan_TCI; /* Encapsulates priority and VLAN ID*/
103 unsigned short h_vlan_encapsulated_proto;
104};
105
106
107
108#define get_vlan_id(pvlan) ((ntohs((unsigned short)pvlan->h_vlan_TCI)) & 0xfff)
109#define get_vlan_priority(pvlan) ((ntohs((unsigned short)\
110 pvlan->h_vlan_TCI)) >> 13)
111#define get_vlan_encap_proto(pvlan) (ntohs((unsigned short)\
112 pvlan->h_vlan_encapsulated_proto))
113
114
115#endif /* _LINUX_IF_ETHER_H */
116
diff --git a/drivers/staging/rtl8712/ip.h b/drivers/staging/rtl8712/ip.h
new file mode 100644
index 00000000000..f37b0f8d14d
--- /dev/null
+++ b/drivers/staging/rtl8712/ip.h
@@ -0,0 +1,137 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for the IP protocol.
7 *
8 * Version: @(#)ip.h 1.0.2 04/28/93
9 *
10 * Authors: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17#ifndef _LINUX_IP_H
18#define _LINUX_IP_H
19
20#include "rtl871x_byteorder.h"
21
22/* SOL_IP socket options */
23
24#define IPTOS_TOS_MASK 0x1E
25#define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK)
26#define IPTOS_LOWDELAY 0x10
27#define IPTOS_THROUGHPUT 0x08
28#define IPTOS_RELIABILITY 0x04
29#define IPTOS_MINCOST 0x02
30
31#define IPTOS_PREC_MASK 0xE0
32#define IPTOS_PREC(tos) ((tos)&IPTOS_PREC_MASK)
33#define IPTOS_PREC_NETCONTROL 0xe0
34#define IPTOS_PREC_INTERNETCONTROL 0xc0
35#define IPTOS_PREC_CRITIC_ECP 0xa0
36#define IPTOS_PREC_FLASHOVERRIDE 0x80
37#define IPTOS_PREC_FLASH 0x60
38#define IPTOS_PREC_IMMEDIATE 0x40
39#define IPTOS_PREC_PRIORITY 0x20
40#define IPTOS_PREC_ROUTINE 0x00
41
42/* IP options */
43#define IPOPT_COPY 0x80
44#define IPOPT_CLASS_MASK 0x60
45#define IPOPT_NUMBER_MASK 0x1f
46
47#define IPOPT_COPIED(o) ((o)&IPOPT_COPY)
48#define IPOPT_CLASS(o) ((o)&IPOPT_CLASS_MASK)
49#define IPOPT_NUMBER(o) ((o)&IPOPT_NUMBER_MASK)
50
51#define IPOPT_CONTROL 0x00
52#define IPOPT_RESERVED1 0x20
53#define IPOPT_MEASUREMENT 0x40
54#define IPOPT_RESERVED2 0x60
55
56#define IPOPT_END (0 | IPOPT_CONTROL)
57#define IPOPT_NOOP (1 | IPOPT_CONTROL)
58#define IPOPT_SEC (2 | IPOPT_CONTROL|IPOPT_COPY)
59#define IPOPT_LSRR (3 | IPOPT_CONTROL|IPOPT_COPY)
60#define IPOPT_TIMESTAMP (4 | IPOPT_MEASUREMENT)
61#define IPOPT_RR (7 | IPOPT_CONTROL)
62#define IPOPT_SID (8 | IPOPT_CONTROL | IPOPT_COPY)
63#define IPOPT_SSRR (9 | IPOPT_CONTROL | IPOPT_COPY)
64#define IPOPT_RA (20 | IPOPT_CONTROL | IPOPT_COPY)
65
66#define IPVERSION 4
67#define MAXTTL 255
68#define IPDEFTTL 64
69
70/* struct timestamp, struct route and MAX_ROUTES are removed.
71 *
72 * REASONS: it is clear that nobody used them because:
73 * - MAX_ROUTES value was wrong.
74 * - "struct route" was wrong.
75 * - "struct timestamp" had fatally misaligned bitfields and was completely
76 * unusable.
77 */
78
79#define IPOPT_OPTVAL 0
80#define IPOPT_OLEN 1
81#define IPOPT_OFFSET 2
82#define IPOPT_MINOFF 4
83#define MAX_IPOPTLEN 40
84#define IPOPT_NOP IPOPT_NOOP
85#define IPOPT_EOL IPOPT_END
86#define IPOPT_TS IPOPT_TIMESTAMP
87
88#define IPOPT_TS_TSONLY 0 /* timestamps only */
89#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
90#define IPOPT_TS_PRESPEC 3 /* specified modules only */
91
92struct ip_options {
93 __u32 faddr; /* Saved first hop address */
94 unsigned char optlen;
95 unsigned char srr;
96 unsigned char rr;
97 unsigned char ts;
98 unsigned char is_setbyuser:1, /* Set by setsockopt? */
99 is_data:1, /* Options in __data, rather than skb */
100 is_strictroute:1, /* Strict source route */
101 srr_is_hit:1, /* Packet destination addr was our one*/
102 is_changed:1, /* IP checksum more not valid */
103 rr_needaddr:1, /* Need to record addr of outgoing dev*/
104 ts_needtime:1, /* Need to record timestamp */
105 ts_needaddr:1; /* Need to record addr of outgoing dev*/
106 unsigned char router_alert;
107 unsigned char __pad1;
108 unsigned char __pad2;
109 unsigned char __data[0];
110};
111
112#define optlength(opt) (sizeof(struct ip_options) + opt->optlen)
113
114struct iphdr {
115#if defined(__LITTLE_ENDIAN_BITFIELD)
116 __u8 ihl:4,
117 version:4;
118#elif defined(__BIG_ENDIAN_BITFIELD)
119 __u8 version:4,
120 ihl:4;
121#else
122#error "Please fix <asm/byteorder.h>"
123#endif
124 __u8 tos;
125 __u16 tot_len;
126 __u16 id;
127 __u16 frag_off;
128 __u8 ttl;
129 __u8 protocol;
130 __u16 check;
131 __u32 saddr;
132 __u32 daddr;
133 /*The options start here. */
134};
135
136#endif /* _LINUX_IP_H */
137
diff --git a/drivers/staging/rtl8712/little_endian.h b/drivers/staging/rtl8712/little_endian.h
new file mode 100644
index 00000000000..0248c143c6d
--- /dev/null
+++ b/drivers/staging/rtl8712/little_endian.h
@@ -0,0 +1,69 @@
1#ifndef _LINUX_BYTEORDER_LITTLE_ENDIAN_H
2#define _LINUX_BYTEORDER_LITTLE_ENDIAN_H
3
4#ifndef __LITTLE_ENDIAN
5#define __LITTLE_ENDIAN 1234
6#endif
7#ifndef __LITTLE_ENDIAN_BITFIELD
8#define __LITTLE_ENDIAN_BITFIELD
9#endif
10
11#include "swab.h"
12
13#define __constant_htonl(x) ___constant_swab32((x))
14#define __constant_ntohl(x) ___constant_swab32((x))
15#define __constant_htons(x) ___constant_swab16((x))
16#define __constant_ntohs(x) ___constant_swab16((x))
17#define __constant_cpu_to_le64(x) ((__u64)(x))
18#define __constant_le64_to_cpu(x) ((__u64)(x))
19#define __constant_cpu_to_le32(x) ((__u32)(x))
20#define __constant_le32_to_cpu(x) ((__u32)(x))
21#define __constant_cpu_to_le16(x) ((__u16)(x))
22#define __constant_le16_to_cpu(x) ((__u16)(x))
23#define __constant_cpu_to_be64(x) ___constant_swab64((x))
24#define __constant_be64_to_cpu(x) ___constant_swab64((x))
25#define __constant_cpu_to_be32(x) ___constant_swab32((x))
26#define __constant_be32_to_cpu(x) ___constant_swab32((x))
27#define __constant_cpu_to_be16(x) ___constant_swab16((x))
28#define __constant_be16_to_cpu(x) ___constant_swab16((x))
29#define __cpu_to_le64(x) ((__u64)(x))
30#define __le64_to_cpu(x) ((__u64)(x))
31#define __cpu_to_le32(x) ((__u32)(x))
32#define __le32_to_cpu(x) ((__u32)(x))
33#define __cpu_to_le16(x) ((__u16)(x))
34#define __le16_to_cpu(x) ((__u16)(x))
35#define __cpu_to_be64(x) __swab64((x))
36#define __be64_to_cpu(x) __swab64((x))
37#define __cpu_to_be32(x) __swab32((x))
38#define __be32_to_cpu(x) __swab32((x))
39#define __cpu_to_be16(x) __swab16((x))
40#define __be16_to_cpu(x) __swab16((x))
41#define __cpu_to_le64p(x) (*(__u64 *)(x))
42#define __le64_to_cpup(x) (*(__u64 *)(x))
43#define __cpu_to_le32p(x) (*(__u32 *)(x))
44#define __le32_to_cpup(x) (*(__u32 *)(x))
45#define __cpu_to_le16p(x) (*(__u16 *)(x))
46#define __le16_to_cpup(x) (*(__u16 *)(x))
47#define __cpu_to_be64p(x) __swab64p((x))
48#define __be64_to_cpup(x) __swab64p((x))
49#define __cpu_to_be32p(x) __swab32p((x))
50#define __be32_to_cpup(x) __swab32p((x))
51#define __cpu_to_be16p(x) __swab16p((x))
52#define __be16_to_cpup(x) __swab16p((x))
53#define __cpu_to_le64s(x) do {} while (0)
54#define __le64_to_cpus(x) do {} while (0)
55#define __cpu_to_le32s(x) do {} while (0)
56#define __le32_to_cpus(x) do {} while (0)
57#define __cpu_to_le16s(x) do {} while (0)
58#define __le16_to_cpus(x) do {} while (0)
59#define __cpu_to_be64s(x) __swab64s((x))
60#define __be64_to_cpus(x) __swab64s((x))
61#define __cpu_to_be32s(x) __swab32s((x))
62#define __be32_to_cpus(x) __swab32s((x))
63#define __cpu_to_be16s(x) __swab16s((x))
64#define __be16_to_cpus(x) __swab16s((x))
65
66#include "generic.h"
67
68#endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */
69
diff --git a/drivers/staging/rtl8712/rtl871x_byteorder.h b/drivers/staging/rtl8712/rtl871x_byteorder.h
new file mode 100644
index 00000000000..07707e23dbe
--- /dev/null
+++ b/drivers/staging/rtl8712/rtl871x_byteorder.h
@@ -0,0 +1,13 @@
1#ifndef _RTL871X_BYTEORDER_H_
2#define _RTL871X_BYTEORDER_H_
3
4#if defined(__LITTLE_ENDIAN)
5# include "little_endian.h"
6#elif defined(__BIG_ENDIAN)
7# include "big_endian.h"
8#else
9# error "Must be LITTLE/BIG Endian Host"
10#endif
11
12#endif /* _RTL871X_BYTEORDER_H_ */
13
diff --git a/drivers/staging/rtl8712/swab.h b/drivers/staging/rtl8712/swab.h
new file mode 100644
index 00000000000..44709a91baf
--- /dev/null
+++ b/drivers/staging/rtl8712/swab.h
@@ -0,0 +1,106 @@
1#ifndef _LINUX_BYTEORDER_SWAB_H
2#define _LINUX_BYTEORDER_SWAB_H
3
4#ifndef __u16
5 #define __u16 unsigned short
6#endif
7
8#ifndef __u32
9 #define __u32 unsigned int
10#endif
11
12#ifndef __u8
13 #define __u8 unsigned char
14#endif
15
16#ifndef __u64
17 #define __u64 unsigned long long
18#endif
19
20
21static inline __u16 ___swab16(__u16 x)
22{
23 __u16 __x = x;
24 return (__u16)(
25 (((__u16)(__x) & (__u16)0x00ffU) << 8) |
26 (((__u16)(__x) & (__u16)0xff00U) >> 8));
27
28}
29
30static inline __u32 ___swab32(__u32 x)
31{
32 __u32 __x = (x);
33 return (__u32)(
34 (((__u32)(__x) & (__u32)0x000000ffUL) << 24) |
35 (((__u32)(__x) & (__u32)0x0000ff00UL) << 8) |
36 (((__u32)(__x) & (__u32)0x00ff0000UL) >> 8) |
37 (((__u32)(__x) & (__u32)0xff000000UL) >> 24));
38}
39
40static inline __u64 ___swab64(__u64 x)
41{
42 __u64 __x = (x);
43
44 return (__u64)( \
45 (__u64)(((__u64)(__x) & (__u64)0x00000000000000ffULL) << 56) | \
46 (__u64)(((__u64)(__x) & (__u64)0x000000000000ff00ULL) << 40) | \
47 (__u64)(((__u64)(__x) & (__u64)0x0000000000ff0000ULL) << 24) | \
48 (__u64)(((__u64)(__x) & (__u64)0x00000000ff000000ULL) << 8) | \
49 (__u64)(((__u64)(__x) & (__u64)0x000000ff00000000ULL) >> 8) | \
50 (__u64)(((__u64)(__x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
51 (__u64)(((__u64)(__x) & (__u64)0x00ff000000000000ULL) >> 40) | \
52 (__u64)(((__u64)(__x) & (__u64)0xff00000000000000ULL) >> 56));
53}
54
55#ifndef __arch__swab16
56static inline __u16 __arch__swab16(__u16 x)
57{
58 return ___swab16(x);
59}
60
61#endif
62
63#ifndef __arch__swab32
64static inline __u32 __arch__swab32(__u32 x)
65{
66 __u32 __tmp = (x) ;
67 return ___swab32(__tmp);
68}
69#endif
70
71#ifndef __arch__swab64
72
73static inline __u64 __arch__swab64(__u64 x)
74{
75 __u64 __tmp = (x) ;
76 return ___swab64(__tmp);
77}
78
79
80#endif
81
82#define __swab16(x) __fswab16(x)
83#define __swab32(x) __fswab32(x)
84#define __swab64(x) __fswab64(x)
85
86static inline const __u16 __fswab16(__u16 x)
87{
88 return __arch__swab16(x);
89}
90static inline const __u32 __fswab32(__u32 x)
91{
92 return __arch__swab32(x);
93}
94
95#define swab16 __swab16
96#define swab32 __swab32
97#define swab64 __swab64
98#define swab16p __swab16p
99#define swab32p __swab32p
100#define swab64p __swab64p
101#define swab16s __swab16s
102#define swab32s __swab32s
103#define swab64s __swab64s
104
105#endif /* _LINUX_BYTEORDER_SWAB_H */
106
diff --git a/drivers/staging/rtl8712/usb_vendor_req.h b/drivers/staging/rtl8712/usb_vendor_req.h
new file mode 100644
index 00000000000..d35c538c47a
--- /dev/null
+++ b/drivers/staging/rtl8712/usb_vendor_req.h
@@ -0,0 +1,33 @@
1#ifndef _USB_VENDOR_REQUEST_H_
2#define _USB_VENDOR_REQUEST_H_
3
4/*4 Set/Get Register related wIndex/Data */
5#define RT_USB_RESET_MASK_OFF 0
6#define RT_USB_RESET_MASK_ON 1
7#define RT_USB_SLEEP_MASK_OFF 0
8#define RT_USB_SLEEP_MASK_ON 1
9#define RT_USB_LDO_ON 1
10#define RT_USB_LDO_OFF 0
11
12/*4 Set/Get SYSCLK related wValue or Data */
13#define RT_USB_SYSCLK_32KHZ 0
14#define RT_USB_SYSCLK_40MHZ 1
15#define RT_USB_SYSCLK_60MHZ 2
16
17enum RT_USB_BREQUEST {
18 RT_USB_SET_REGISTER = 1,
19 RT_USB_SET_SYSCLK = 2,
20 RT_USB_GET_SYSCLK = 3,
21 RT_USB_GET_REGISTER = 4
22};
23
24enum RT_USB_WVALUE {
25 RT_USB_RESET_MASK = 1,
26 RT_USB_SLEEP_MASK = 2,
27 RT_USB_USB_HRCPWM = 3,
28 RT_USB_LDO = 4,
29 RT_USB_BOOT_TYPE = 5
30};
31
32#endif
33