summaryrefslogtreecommitdiff
path: root/chip/lm4
diff options
context:
space:
mode:
Diffstat (limited to 'chip/lm4')
-rw-r--r--chip/lm4/mock_gpio.c116
-rw-r--r--chip/lm4/mock_keyboard_scan_stub.c85
-rw-r--r--chip/lm4/mock_lpc.c79
-rw-r--r--chip/lm4/mock_pwm.c69
4 files changed, 0 insertions, 349 deletions
diff --git a/chip/lm4/mock_gpio.c b/chip/lm4/mock_gpio.c
deleted file mode 100644
index 59c32dc7ce..0000000000
--- a/chip/lm4/mock_gpio.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Copyright (c) 2012 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.
- */
-
-/* Mock GPIO module for Chrome EC */
-
-#include "console.h"
-#include "gpio.h"
-#include "util.h"
-
-
-static int8_t mock_value[GPIO_COUNT] = {0};
-static int8_t mock_gpio_im[GPIO_COUNT] = {0};
-
-
-int gpio_pre_init(void)
-{
- /* Nothing to do */
- return EC_SUCCESS;
-}
-
-
-void gpio_set_alternate_function(int port, int mask, int func)
-{
- /* Not implemented */
- return;
-}
-
-
-const char *gpio_get_name(enum gpio_signal signal)
-{
- return gpio_list[signal].name;
-}
-
-
-int gpio_get_level(enum gpio_signal signal)
-{
- return mock_value[signal] ? 1 : 0;
-}
-
-
-int gpio_set_level(enum gpio_signal signal, int value)
-{
- mock_value[signal] = value;
- return EC_SUCCESS;
-}
-
-
-int gpio_set_flags(enum gpio_signal signal, int flags)
-{
- /* Not implemented */
- return EC_SUCCESS;
-}
-
-
-int gpio_enable_interrupt(enum gpio_signal signal)
-{
- const struct gpio_info *g = gpio_list + signal;
-
- /* Fail if no interrupt handler */
- if (!g->irq_handler)
- return EC_ERROR_UNKNOWN;
-
- mock_gpio_im[signal] = 1;
- return EC_SUCCESS;
-}
-
-
-/* Find a GPIO signal by name. Returns the signal index, or GPIO_COUNT if
- * no match. */
-static enum gpio_signal find_signal_by_name(const char *name)
-{
- const struct gpio_info *g = gpio_list;
- int i;
-
- if (!name || !*name)
- return GPIO_COUNT;
-
- for (i = 0; i < GPIO_COUNT; i++, g++) {
- if (!strcasecmp(name, g->name))
- return i;
- }
-
- return GPIO_COUNT;
-}
-
-
-static int command_gpio_mock(int argc, char **argv)
-{
- char *e;
- int v, i;
- const struct gpio_info *g;
-
- if (argc < 3)
- return EC_ERROR_PARAM_COUNT;
-
- i = find_signal_by_name(argv[1]);
- if (i == GPIO_COUNT)
- return EC_ERROR_PARAM1;
- g = gpio_list + i;
-
- v = strtoi(argv[2], &e, 0);
- if (*e)
- return EC_ERROR_PARAM2;
-
- gpio_set_level(i, v);
-
- if (g->irq_handler && mock_gpio_im[i])
- g->irq_handler(i);
- return EC_SUCCESS;
-}
-DECLARE_CONSOLE_COMMAND(gpiomock, command_gpio_mock,
- "name <0 | 1>",
- "Mock a GPIO input",
- NULL);
diff --git a/chip/lm4/mock_keyboard_scan_stub.c b/chip/lm4/mock_keyboard_scan_stub.c
deleted file mode 100644
index 6334475dfa..0000000000
--- a/chip/lm4/mock_keyboard_scan_stub.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* 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.
- */
-
-/* Mock functions for keyboard scanner module for Chrome EC */
-
-#include "common.h"
-#include "console.h"
-#include "keyboard_config.h"
-#include "keyboard_raw.h"
-#include "keyboard_scan.h"
-#include "task.h"
-#include "uart.h"
-#include "util.h"
-
-static int enable_scanning = 1;
-static int selected_column = -1;
-static int interrupt_enabled = 0;
-static uint8_t matrix_status[KEYBOARD_COLS];
-
-void keyboard_raw_init(void)
-{
- /* Init matrix status to release all */
- int i;
- for (i = 0; i < KEYBOARD_COLS; ++i)
- matrix_status[i] = 0xff;
-}
-
-void keyboard_raw_task_start(void)
-{
-}
-
-void keyboard_raw_drive_column(int col)
-{
- selected_column = col;
-}
-
-int keyboard_raw_read_rows(void)
-{
- if (selected_column >= 0)
- return matrix_status[selected_column] ^ 0xff;
- else
- return 0;
-}
-
-void keyboard_raw_enable_interrupt(int enable)
-{
- interrupt_enabled = enable;
-}
-
-static int command_mock_matrix(int argc, char **argv)
-{
- int r, c, p;
- char *e;
-
- if (argc < 4)
- return EC_ERROR_PARAM_COUNT;
-
- c = strtoi(argv[1], &e, 0);
- if (*e || c < 0 || c >= KEYBOARD_COLS)
- return EC_ERROR_PARAM1;
-
- r = strtoi(argv[2], &e, 0);
- if (*e || r < 0 || r >= KEYBOARD_ROWS)
- return EC_ERROR_PARAM2;
-
- p = strtoi(argv[3], &e, 0);
- if (*e)
- return EC_ERROR_PARAM3;
-
- if (p)
- matrix_status[c] &= ~(1 << r);
- else
- matrix_status[c] |= (1 << r);
-
- if (interrupt_enabled)
- task_wake(TASK_ID_KEYSCAN);
-
- return EC_SUCCESS;
-}
-DECLARE_CONSOLE_COMMAND(mockmatrix, command_mock_matrix,
- "<Col> <Row> <0 | 1>",
- "Mock keyboard matrix",
- NULL);
diff --git a/chip/lm4/mock_lpc.c b/chip/lm4/mock_lpc.c
deleted file mode 100644
index b4b7164352..0000000000
--- a/chip/lm4/mock_lpc.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Copyright (c) 2012 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.
- */
-
-/* Mock LPC module for Chrome EC */
-
-#include "common.h"
-#include "ec_commands.h"
-#include "lpc.h"
-#include "registers.h"
-#include "uart.h"
-
-
-void lpc_set_host_event_state(uint32_t mask)
-{
- uart_printf("Host event: %x\n", mask);
-}
-
-
-uint32_t lpc_get_host_event_state(void)
-{
- /* Not implemented */
- return 0;
-}
-
-
-void lpc_clear_host_event_state(uint32_t mask)
-{
- uart_printf("Clear host event: %x\n", mask);
-}
-
-
-void lpc_set_host_event_mask(enum lpc_host_event_type type, uint32_t mask)
-{
- uart_printf("Set host event mask: type %d = %x\n", type, mask);
-}
-
-
-uint32_t lpc_get_host_event_mask(enum lpc_host_event_type type)
-{
- /* Not implemented */
- return 0;
-}
-
-
-int lpc_comx_has_char(void)
-{
- /* Not implemented */
- return 0;
-}
-
-
-int lpc_comx_get_char(void)
-{
- /* Not implemented */
- return 0;
-}
-
-
-void lpc_comx_put_char(int c)
-{
- /* Not implemented */
- return;
-}
-
-#define LPC_POOL_OFFS_CMD_DATA 512 /* Data range for host commands - 512-767 */
-#define LPC_POOL_CMD_DATA (LM4_LPC_LPCPOOL + LPC_POOL_OFFS_CMD_DATA)
-
-uint8_t *lpc_get_memmap_range(void)
-{
- return (uint8_t *)LPC_POOL_CMD_DATA + EC_HOST_PARAM_SIZE * 2;
-}
-
-
-uint8_t *host_get_buffer(void)
-{
- return (uint8_t *)LPC_POOL_CMD_DATA;
-}
diff --git a/chip/lm4/mock_pwm.c b/chip/lm4/mock_pwm.c
deleted file mode 100644
index b269b8f116..0000000000
--- a/chip/lm4/mock_pwm.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Copyright (c) 2012 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.
- */
-
-/* Mock PWM control module for Chrome EC */
-
-#include "pwm.h"
-#include "timer.h"
-#include "uart.h"
-
-static int fan_target_rpm;
-static int kblight;
-
-int pwm_set_fan_target_rpm(int rpm)
-{
- uart_printf("Fan RPM: %d\n", rpm);
- fan_target_rpm = rpm;
- return EC_SUCCESS;
-}
-
-
-int pwm_get_fan_target_rpm(void)
-{
- return fan_target_rpm;
-}
-
-
-int pwm_set_keyboard_backlight(int percent)
-{
- uart_printf("KBLight: %d\n", percent);
- kblight = percent;
- return EC_SUCCESS;
-}
-
-
-int pwm_get_keyboard_backlight(void)
-{
- return kblight;
-}
-
-
-int pwm_get_keyboard_backlight_enabled(void)
-{
- /* Always enabled */
- return 1;
-}
-
-
-int pwm_enable_keyboard_backlight(int enable)
-{
- /* Not implemented */
- return EC_SUCCESS;
-}
-
-
-int pwm_set_fan_duty(int percent)
-{
- /* Not implemented */
- return EC_SUCCESS;
-}
-
-
-void pwm_task(void)
-{
- /* Do nothing */
- while (1)
- sleep(5);
-}