zephyr/samples/net/common/cc2520_a101.c
David B. Kinder ac74d8b652 license: Replace Apache boilerplate with SPDX tag
Replace the existing Apache 2.0 boilerplate header with an SPDX tag
throughout the zephyr code tree. This patch was generated via a
script run over the master branch.

Also updated doc/porting/application.rst that had a dependency on
line numbers in a literal include.

Manually updated subsys/logging/sys_log.c that had a malformed
header in the original file.  Also cleanup several cases that already
had a SPDX tag and we either got a duplicate or missed updating.

Jira: ZEP-1457

Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-19 03:50:58 +00:00

58 lines
1.5 KiB
C

/* cc2520_a101.c - Arduino 101 board setup for cc2520 */
/*
* Copyright (c) 2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <ieee802154/cc2520.h>
#include <gpio.h>
#define CC2520_GPIO_DEV_NAME CONFIG_GPIO_QMSI_0_NAME
#define CC2520_GPIO_VREG_EN 16 /* PIN 50, IO8 */
#define CC2520_GPIO_RESET 20 /* PIN 54, IO7 */
#define CC2520_GPIO_FIFO 19 /* PIN 53, IO4 */
#define CC2520_GPIO_CCA 18 /* PIN 52, IO2 */
#define CC2520_GPIO_SFD 15 /* PIN 49, IO5 */
#define CC2520_GPIO_FIFOP 17 /* PIN 51, IO3 */
static struct cc2520_gpio_configuration cc2520_gpios[CC2520_GPIO_IDX_MAX] = {
{ .dev = NULL, .pin = CC2520_GPIO_VREG_EN, },
{ .dev = NULL, .pin = CC2520_GPIO_RESET, },
{ .dev = NULL, .pin = CC2520_GPIO_FIFO, },
{ .dev = NULL, .pin = CC2520_GPIO_CCA, },
{ .dev = NULL, .pin = CC2520_GPIO_SFD, },
{ .dev = NULL, .pin = CC2520_GPIO_FIFOP, },
};
struct cc2520_gpio_configuration *cc2520_configure_gpios(void)
{
struct device *gpio;
int i;
gpio = device_get_binding(CC2520_GPIO_DEV_NAME);
if (!gpio) {
return NULL;
}
for (i = 0; i < CC2520_GPIO_IDX_MAX; i++) {
int flags;
if (i >= 0 && i < CC2520_GPIO_IDX_FIFO) {
flags = GPIO_DIR_OUT;
} else if (i < CC2520_GPIO_IDX_SFD) {
flags = GPIO_DIR_IN;
} else {
flags = (GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
GPIO_INT_ACTIVE_HIGH | GPIO_INT_DEBOUNCE);
}
gpio_pin_configure(gpio, cc2520_gpios[i].pin, flags);
cc2520_gpios[i].dev = gpio;
}
return cc2520_gpios;
}