Files
OpenCellular/include/gpio_list.h
Todd Broch 07203ac931 Add config option to reduce GPIO name string size.
In order to reduce flash size on some constrained boards this CL
modifies the GPIO macro in gpio_list.h to change the name field from
that listed 'name' to the concat of 'port' and 'pin'.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=samus
BUG=chrome-os-partner:34489
TEST=manual
1. build with and without CONFIG_COMMON_GPIO_SHORTNAMES
See 897 bytes savings with config option
2. See reduced names for gpioget
  > gpioget
    0  E6
    0  F2
    1  B0

Change-Id: Ife1e1e2bcfa620ba87fe6c1ce2b47fe258c46514
Reviewed-on: https://chromium-review.googlesource.com/234587
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
2014-12-16 22:47:50 +00:00

36 lines
1.0 KiB
C

/* Copyright (c) 2014 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.
*/
#ifdef CONFIG_COMMON_GPIO_SHORTNAMES
#define GPIO(name, port, pin, flags, signal) \
{#port#pin, GPIO_##port, (1 << pin), flags, signal},
#else
#define GPIO(name, port, pin, flags, signal) \
{#name, GPIO_##port, (1 << pin), flags, signal},
#endif
#define UNIMPLEMENTED(name) \
{#name, DUMMY_GPIO_BANK, 0, GPIO_DEFAULT, NULL},
/* GPIO signal list. */
const struct gpio_info gpio_list[] = {
#include "gpio.wrap"
};
BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
/*
* Construct the gpio_alt_funcs array. This array is used by gpio_config_module
* to enable and disable GPIO alternate functions on a module by module basis.
*/
#define ALTERNATE(port, mask, function, module, flags) \
{GPIO_##port, mask, function, module, flags},
const struct gpio_alt_func gpio_alt_funcs[] = {
#include "gpio.wrap"
};
const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs);