diff options
author | Vic Yang <victoryang@chromium.org> | 2013-04-14 20:01:55 +0800 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-04-15 20:40:02 -0700 |
commit | 216bb93128c2477d2c4053110e0b0df4ddd0b40f (patch) | |
tree | 4378ec4f8c12cf3f572851049518dc8c46608189 /chip | |
parent | 108235225d2536f75a3100cd535f44f732b486c3 (diff) | |
download | chrome-ec-216bb93128c2477d2c4053110e0b0df4ddd0b40f.tar.gz |
Fix flash tests
This merges flash_overwrite and flash_rw_erase to a single test binary.
BUG=chrome-os-partner:18598
TEST=Run on Spring
BRANCH=None
Change-Id: I1da7577cb5dc196178930dda3a07bb942d959866
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48090
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r-- | chip/lm4/mock_flash.c | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/chip/lm4/mock_flash.c b/chip/lm4/mock_flash.c deleted file mode 100644 index 8200b66c91..0000000000 --- a/chip/lm4/mock_flash.c +++ /dev/null @@ -1,73 +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 flash memory module for Chrome EC. - * Due to RAM size limit, we cannot mock entire flash memory. Instead, we only - * mock the last bank in order to make pstate works. */ - -#include "flash.h" -#include "uart.h" -#include "util.h" - -#define FLASH_FSIZE 0x7f -#define PHYSICAL_SIZE ((FLASH_FSIZE + 1) * CONFIG_FLASH_BANK_SIZE) -#define FLASH_MOCK_BEGIN (FLASH_FSIZE * CONFIG_FLASH_BANK_SIZE) - -char mock_protect[FLASH_FSIZE + 1]; -char pstate_space[CONFIG_FLASH_BANK_SIZE]; - -int flash_physical_size(void) -{ - return PHYSICAL_SIZE; -} - - -int flash_physical_write(int offset, int size, const char* data) -{ - int i; - int xorsum = 0; - if (offset >= FLASH_MOCK_BEGIN) - memcpy(pstate_space + offset - FLASH_MOCK_BEGIN, data, size); - else { - xorsum = 0; - for (i = 0; i < size; ++i) - xorsum ^= data[i]; - uart_printf("Flash write at %x size %x XOR %x\n", - offset, - size, - xorsum); - } - return EC_SUCCESS; -} - - -int flash_physical_erase(int offset, int size) -{ - uart_printf("Flash erase at %x size %x\n", offset, size); - if (offset + size >= FLASH_MOCK_BEGIN) - memset(pstate_space, 0xff, offset + size - FLASH_MOCK_BEGIN); - return EC_SUCCESS; -} - - -int flash_physical_get_protect(int block) -{ - return mock_protect[block]; -} - -uint32_t flash_get_protect(void) -{ - return 0; -} - -int flash_set_protect(uint32_t mask, uint32_t flags) -{ - return 0; -} - -int flash_pre_init(void) -{ - return EC_SUCCESS; -} |