From f93f1cfe77ed3603ab16047d79a283a781416db4 Mon Sep 17 00:00:00 2001 From: Louis Yung-Chieh Lo Date: Tue, 15 Jul 2014 10:41:16 -0700 Subject: hadoken: initial commit. Board bring up. GPIO / UART / timer / console / task / hook are working now. BRANCH=tot BUG=none TEST=run on evaluation board and see LED 0/1 are blinking. Console commands are available to use. Change-Id: If93a2c94b8abe1c2c931c03a7a12ddd2bed9d9f6 Signed-off-by: Louis Yung-Chieh Lo Reviewed-on: https://chromium-review.googlesource.com/209403 Reviewed-by: Vic Yang --- board/hadoken/board.c | 12 ++++++++++++ board/hadoken/board.h | 30 ++++++++++++++++++++++++++++++ board/hadoken/build.mk | 13 +++++++++++++ board/hadoken/ec.tasklist | 20 ++++++++++++++++++++ board/hadoken/gpio.inc | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 121 insertions(+) create mode 100644 board/hadoken/board.c create mode 100644 board/hadoken/board.h create mode 100644 board/hadoken/build.mk create mode 100644 board/hadoken/ec.tasklist create mode 100644 board/hadoken/gpio.inc (limited to 'board/hadoken') diff --git a/board/hadoken/board.c b/board/hadoken/board.c new file mode 100644 index 0000000000..895974efee --- /dev/null +++ b/board/hadoken/board.c @@ -0,0 +1,12 @@ +/* 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. + */ +#include "gpio.h" +#include "registers.h" +#include "util.h" + + +/* To define the gpio_list[] instance. */ +#include "gpio_list.h" + diff --git a/board/hadoken/board.h b/board/hadoken/board.h new file mode 100644 index 0000000000..feb27e668d --- /dev/null +++ b/board/hadoken/board.h @@ -0,0 +1,30 @@ +/* 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. + */ + +/* Hadoken board configuration */ + +#ifndef __BOARD_H +#define __BOARD_H + +#ifndef __ASSEMBLER__ + +#undef CONFIG_FLASH /* TODO: implement me */ +#undef CONFIG_FMAP /* TODO: implement me */ +#undef CONFIG_WATCHDOG +#undef CONFIG_LID_SWITCH + + +/* + * nRF51 board specific configuration. + */ +#define NRF51_UART_TX_PIN 25 +#define NRF51_UART_RX_PIN 29 + +#include "gpio_signal.h" + +#endif /* !__ASSEMBLER__ */ + +#endif /* __BOARD_H */ + diff --git a/board/hadoken/build.mk b/board/hadoken/build.mk new file mode 100644 index 0000000000..f8bb859201 --- /dev/null +++ b/board/hadoken/build.mk @@ -0,0 +1,13 @@ +# -*- makefile -*- +# 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. +# +# Board specific files build + +# the IC is Nordic nRF51822 +CHIP:=nrf51 +CHIP_FAMILY:=nrf51x22 +CHIP_VARIANT:=nrf51822 + +board-y=board.o diff --git a/board/hadoken/ec.tasklist b/board/hadoken/ec.tasklist new file mode 100644 index 0000000000..684f22b716 --- /dev/null +++ b/board/hadoken/ec.tasklist @@ -0,0 +1,20 @@ +/* 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. + */ + +/** + * List of enabled tasks in the priority order + * + * The first one has the lowest priority. + * + * For each task, use the macro TASK(n, r, d, s) where : + * 'n' in the name of the task + * 'r' in the main routine of the task + * 'd' in an opaque parameter passed to the routine at startup + * 's' is the stack size in bytes; must be a multiple of 8 + */ +#define CONFIG_TASK_LIST \ + TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \ + TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \ + diff --git a/board/hadoken/gpio.inc b/board/hadoken/gpio.inc new file mode 100644 index 0000000000..da5df7a968 --- /dev/null +++ b/board/hadoken/gpio.inc @@ -0,0 +1,46 @@ +/* -*- mode: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. + */ + +#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH) +#define GPIO_KB_OUTPUT GPIO_ODR_HIGH + +/* Inputs with interrupt handlers are first for efficiency */ + +/* Keyboard inputs */ +/* + * TODO(yjlou): call keyboard_raw_gpio_interrupt() in chip/nrf51/keyboard_raw.c + */ +GPIO(KB_IN00, 0, 6, GPIO_KB_INPUT, NULL) +GPIO(KB_IN01, 0, 24, GPIO_KB_INPUT, NULL) +GPIO(KB_IN02, 0, 1, GPIO_KB_INPUT, NULL) +GPIO(KB_IN03, 0, 4, GPIO_KB_INPUT, NULL) +GPIO(KB_IN04, 0, 0, GPIO_KB_INPUT, NULL) +GPIO(KB_IN05, 0, 30, GPIO_KB_INPUT, NULL) +GPIO(KB_IN06, 0, 27, GPIO_KB_INPUT, NULL) +GPIO(KB_IN07, 0, 26, GPIO_KB_INPUT, NULL) + +/* Other inputs */ + +/* Outputs */ +GPIO(LED0, 0, 18, GPIO_OUTPUT | GPIO_HIGH, NULL) +GPIO(LED1, 0, 19, GPIO_OUTPUT | GPIO_HIGH, NULL) +GPIO(KB_OUT00, 0, 2, GPIO_KB_OUTPUT, NULL) +GPIO(KB_OUT01, 0, 10, GPIO_KB_OUTPUT, NULL) +GPIO(KB_OUT02, 0, 7, GPIO_KB_OUTPUT, NULL) +GPIO(KB_OUT03, 0, 5, GPIO_KB_OUTPUT, NULL) +GPIO(KB_OUT04, 0, 3, GPIO_KB_OUTPUT, NULL) +GPIO(KB_OUT05, 0, 9, GPIO_KB_OUTPUT, NULL) +GPIO(KB_OUT06, 0, 8, GPIO_KB_OUTPUT, NULL) +GPIO(KB_OUT07, 0, 28, GPIO_KB_OUTPUT, NULL) +GPIO(KB_OUT08, 0, 18, GPIO_KB_OUTPUT, NULL) +GPIO(KB_OUT09, 0, 16, GPIO_KB_OUTPUT, NULL) +GPIO(KB_OUT10, 0, 12, GPIO_KB_OUTPUT, NULL) +GPIO(KB_OUT11, 0, 15, GPIO_KB_OUTPUT, NULL) +GPIO(KB_OUT12, 0, 11, GPIO_KB_OUTPUT, NULL) + +/* Unimplemented */ +UNIMPLEMENTED(ENTERING_RW) -- cgit v1.2.1