diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-19 19:15:42 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-19 19:37:01 -0400 |
commit | 635d2b00e5070378e7bf812acf47fb135c6ab928 (patch) | |
tree | 7048a0a511f3d221aa2dfe40aa3a401991f1b175 /drivers/staging/csr/csr_wifi_hip_conversions.h | |
parent | 15a4bc17b7f4e85cb019e683f14e834078ec2208 (diff) |
Staging: add CSR wifi module
This consists of two modules, the driver, and a "helper" module that is
just a wrapper around common kernel functions. The wrapper module will
be removed soon, but for now it's needed.
These files were based on the csr-linux-wifi-5.0.3-oss.tar.gz package
provided by CSR and Blue Giga, and is covered under the license
specified in the LICENSE.txt file (basically dual BSD and GPLv2). The
files were flattened out of the deep directory mess they were originally
in, and a few EXPORT_SYMBOL_GPL() were added in order for everything to
link properly with the helper module setup.
Cc: Mikko Virkkilä <mikko.virkkila@bluegiga.com>
Cc: Lauri Hintsala <Lauri.Hintsala@bluegiga.com>
Cc: Riku Mettälä <riku.mettala@bluegiga.com>
Cc: Veli-Pekka Peltola <veli-pekka.peltola@bluegiga.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/csr/csr_wifi_hip_conversions.h')
-rw-r--r-- | drivers/staging/csr/csr_wifi_hip_conversions.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/drivers/staging/csr/csr_wifi_hip_conversions.h b/drivers/staging/csr/csr_wifi_hip_conversions.h new file mode 100644 index 00000000000..6a4647d5f91 --- /dev/null +++ b/drivers/staging/csr/csr_wifi_hip_conversions.h | |||
@@ -0,0 +1,81 @@ | |||
1 | /***************************************************************************** | ||
2 | |||
3 | (c) Cambridge Silicon Radio Limited 2011 | ||
4 | All rights reserved and confidential information of CSR | ||
5 | |||
6 | Refer to LICENSE.txt included with this source for details | ||
7 | on the license terms. | ||
8 | |||
9 | *****************************************************************************/ | ||
10 | |||
11 | /* | ||
12 | * --------------------------------------------------------------------------- | ||
13 | * | ||
14 | * FILE: csr_wifi_hip_conversions.h | ||
15 | * | ||
16 | * PURPOSE: | ||
17 | * This header file provides the macros for converting to and from | ||
18 | * wire format. | ||
19 | * These macros *MUST* work for little-endian AND big-endian hosts. | ||
20 | * | ||
21 | * --------------------------------------------------------------------------- | ||
22 | */ | ||
23 | #ifndef __CSR_WIFI_HIP_CONVERSIONS_H__ | ||
24 | #define __CSR_WIFI_HIP_CONVERSIONS_H__ | ||
25 | |||
26 | #ifdef __cplusplus | ||
27 | extern "C" { | ||
28 | #endif | ||
29 | |||
30 | #define SIZEOF_UINT16 2 | ||
31 | #define SIZEOF_UINT32 4 | ||
32 | #define SIZEOF_UINT64 8 | ||
33 | |||
34 | #define SIZEOF_SIGNAL_HEADER 6 | ||
35 | #define SIZEOF_DATAREF 4 | ||
36 | |||
37 | |||
38 | /* | ||
39 | * Macro to retrieve the signal ID from a wire-format signal. | ||
40 | */ | ||
41 | #define GET_SIGNAL_ID(_buf) CSR_GET_UINT16_FROM_LITTLE_ENDIAN((_buf)) | ||
42 | |||
43 | /* | ||
44 | * Macros to retrieve and set the DATAREF fields in a packed (i.e. wire-format) | ||
45 | * HIP signal. | ||
46 | */ | ||
47 | #define GET_PACKED_DATAREF_SLOT(_buf, _ref) \ | ||
48 | CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 0)) | ||
49 | |||
50 | #define GET_PACKED_DATAREF_LEN(_buf, _ref) \ | ||
51 | CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 2)) | ||
52 | |||
53 | #define SET_PACKED_DATAREF_SLOT(_buf, _ref, _slot) \ | ||
54 | CSR_COPY_UINT16_TO_LITTLE_ENDIAN((_slot), ((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 0)) | ||
55 | |||
56 | #define SET_PACKED_DATAREF_LEN(_buf, _ref, _len) \ | ||
57 | CSR_COPY_UINT16_TO_LITTLE_ENDIAN((_len), ((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 2)) | ||
58 | |||
59 | #define GET_PACKED_MA_PACKET_REQUEST_FRAME_PRIORITY(_buf) \ | ||
60 | CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 8)) | ||
61 | |||
62 | #define GET_PACKED_MA_PACKET_REQUEST_HOST_TAG(_buf) \ | ||
63 | CSR_GET_UINT32_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 4)) | ||
64 | |||
65 | #define GET_PACKED_MA_PACKET_CONFIRM_HOST_TAG(_buf) \ | ||
66 | CSR_GET_UINT32_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 8)) | ||
67 | |||
68 | #define GET_PACKED_MA_PACKET_CONFIRM_TRANSMISSION_STATUS(_buf) \ | ||
69 | CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 2)) | ||
70 | |||
71 | |||
72 | CsrInt32 get_packed_struct_size(const CsrUint8 *buf); | ||
73 | CsrResult read_unpack_signal(const CsrUint8 *ptr, CSR_SIGNAL *sig); | ||
74 | CsrResult write_pack(const CSR_SIGNAL *sig, CsrUint8 *ptr, CsrUint16 *sig_len); | ||
75 | |||
76 | #ifdef __cplusplus | ||
77 | } | ||
78 | #endif | ||
79 | |||
80 | #endif /* __CSR_WIFI_HIP_CONVERSIONS_H__ */ | ||
81 | |||