mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-28 02:35:28 +00:00
Body 5678901234567890123456789012345678901234567890123456789012345678901 Previously the GPIO driver used quite redundant encodings for its WUI and DEVALT mapping tables. This refactor compresses those tables significantly, while adding the ability to represent an inverted DEVALT bit. The resulting RO firmware image for Wheatley is 384 bytes smaller. This commit also corrects the interpretation of the func parameter to gpio_set_alternate_function. Any non-negative func should be interpreted as a request to switch a pin to an alternate mode. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Ran on Wheatley, manually verified basic functionality Change-Id: I3a56a4b56d13a70a30c388e7e2c77dd7acd3838a Reviewed-on: https://chromium-review.googlesource.com/329761 Commit-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Mulin Chao <mlchao@nuvoton.com> Reviewed-by: Shawn N <shawnn@chromium.org>
33 lines
1.0 KiB
C
33 lines
1.0 KiB
C
/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
/* Handy clever tricks */
|
|
|
|
#ifndef __CROS_EC_COMPILE_TIME_MACROS_H
|
|
#define __CROS_EC_COMPILE_TIME_MACROS_H
|
|
|
|
/* Test an important condition at compile time, not run time */
|
|
#define _BA1_(cond, line) \
|
|
extern int __build_assertion_ ## line[1 - 2*!(cond)] \
|
|
__attribute__ ((unused))
|
|
#define _BA0_(c, x) _BA1_(c, x)
|
|
#define BUILD_ASSERT(cond) _BA0_(cond, __LINE__)
|
|
|
|
/* Number of elements in an array */
|
|
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
|
|
|
/* Make for loops that iterate over pointers to array entries more readable */
|
|
#define ARRAY_BEGIN(array) (array)
|
|
#define ARRAY_END(array) ((array) + ARRAY_SIZE(array))
|
|
|
|
/* Just in case - http://gcc.gnu.org/onlinedocs/gcc/Offsetof.html */
|
|
#ifndef offsetof
|
|
#define offsetof(type, member) __builtin_offsetof(type, member)
|
|
#endif
|
|
|
|
#define __visible __attribute__((externally_visible))
|
|
|
|
#endif /* __CROS_EC_COMPILE_TIME_MACROS_H */
|