1 /*****************************************************************************
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
6 Refer to LICENSE.txt included with this source for details
9 *****************************************************************************/
12 * ---------------------------------------------------------------------------
14 * FILE: csr_wifi_hip_conversions.h
17 * This header file provides the macros for converting to and from
19 * These macros *MUST* work for little-endian AND big-endian hosts.
21 * ---------------------------------------------------------------------------
23 #ifndef __CSR_WIFI_HIP_CONVERSIONS_H__
24 #define __CSR_WIFI_HIP_CONVERSIONS_H__
26 #define SIZEOF_UINT16 2
27 #define SIZEOF_UINT32 4
28 #define SIZEOF_UINT64 8
30 #define SIZEOF_SIGNAL_HEADER 6
31 #define SIZEOF_DATAREF 4
35 * Macro to retrieve the signal ID from a wire-format signal.
37 #define GET_SIGNAL_ID(_buf) CSR_GET_UINT16_FROM_LITTLE_ENDIAN((_buf))
40 * Macros to retrieve and set the DATAREF fields in a packed (i.e. wire-format)
43 #define GET_PACKED_DATAREF_SLOT(_buf, _ref) \
44 CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 0))
46 #define GET_PACKED_DATAREF_LEN(_buf, _ref) \
47 CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 2))
49 #define SET_PACKED_DATAREF_SLOT(_buf, _ref, _slot) \
50 CSR_COPY_UINT16_TO_LITTLE_ENDIAN((_slot), ((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 0))
52 #define SET_PACKED_DATAREF_LEN(_buf, _ref, _len) \
53 CSR_COPY_UINT16_TO_LITTLE_ENDIAN((_len), ((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 2))
55 #define GET_PACKED_MA_PACKET_REQUEST_FRAME_PRIORITY(_buf) \
56 CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 8))
58 #define GET_PACKED_MA_PACKET_REQUEST_HOST_TAG(_buf) \
59 CSR_GET_UINT32_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 4))
61 #define GET_PACKED_MA_PACKET_CONFIRM_HOST_TAG(_buf) \
62 CSR_GET_UINT32_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 8))
64 #define GET_PACKED_MA_PACKET_CONFIRM_TRANSMISSION_STATUS(_buf) \
65 CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 2))
68 s32
get_packed_struct_size(const u8
*buf
);
69 CsrResult
read_unpack_signal(const u8
*ptr
, CSR_SIGNAL
*sig
);
70 CsrResult
write_pack(const CSR_SIGNAL
*sig
, u8
*ptr
, u16
*sig_len
);
72 #endif /* __CSR_WIFI_HIP_CONVERSIONS_H__ */
This page took 0.031417 seconds and 5 git commands to generate.