1/*
2 * Declare directives for structure packing. No padding will be provided
3 * between the members of packed structures, and therefore, there is no
4 * guarantee that structure members will be aligned.
5 *
6 * Declaring packed structures is compiler specific. In order to handle all
7 * cases, packed structures should be delared as:
8 *
9 * #include <packed_section_start.h>
10 *
11 * typedef BWL_PRE_PACKED_STRUCT struct foobar_t {
12 *    some_struct_members;
13 * } BWL_POST_PACKED_STRUCT foobar_t;
14 *
15 * #include <packed_section_end.h>
16 *
17 *
18 * Copyright (C) 1999-2013, Broadcom Corporation
19 *
20 * Permission to use, copy, modify, and/or distribute this software for any
21 * purpose with or without fee is hereby granted, provided that the above
22 * copyright notice and this permission notice appear in all copies.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
25 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
26 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
27 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
28 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
29 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
30 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
31 *
32 * $Id: packed_section_start.h 286783 2011-09-29 06:18:57Z $
33 */
34
35
36/* Error check - BWL_PACKED_SECTION is defined in packed_section_start.h
37 * and undefined in packed_section_end.h. If it is already defined at this
38 * point, then there is a missing include of packed_section_end.h.
39 */
40#ifdef BWL_PACKED_SECTION
41	#error "BWL_PACKED_SECTION is already defined!"
42#else
43	#define BWL_PACKED_SECTION
44#endif
45
46
47
48
49/* Declare compiler-specific directives for structure packing. */
50#if defined(__GNUC__) || defined(__lint)
51	#define	BWL_PRE_PACKED_STRUCT
52	#define	BWL_POST_PACKED_STRUCT	__attribute__ ((packed))
53#elif defined(__CC_ARM)
54	#define	BWL_PRE_PACKED_STRUCT	__packed
55	#define	BWL_POST_PACKED_STRUCT
56#else
57	#error "Unknown compiler!"
58#endif
59