diff options
Diffstat (limited to 'test')
284 files changed, 0 insertions, 43125 deletions
diff --git a/test/accel_cal.c b/test/accel_cal.c deleted file mode 100644 index de46822711..0000000000 --- a/test/accel_cal.c +++ /dev/null @@ -1,143 +0,0 @@ -/* Copyright 2020 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 "common.h" -#include "accel_cal.h" -#include "test_util.h" -#include "motion_sense.h" -#include <math.h> - -struct motion_sensor_t motion_sensors[] = {}; -const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); - -struct accel_cal_algo algos[2] = { - { - .newton_fit = NEWTON_FIT(8, 1, 0.01f, 0.25f, 1.0e-8f, 100), - }, - { - .newton_fit = NEWTON_FIT(8, 1, 0.01f, 0.25f, 1.0e-8f, 100), - } -}; - -struct accel_cal cal = { - .still_det = STILL_DET(0.00025f, 800 * MSEC, 1200 * MSEC, 5), - .algos = algos, - .num_temp_windows = ARRAY_SIZE(algos), -}; - -static bool accumulate(float x, float y, float z, float temperature) -{ - return accel_cal_accumulate(&cal, 0, x, y, z, temperature) - | accel_cal_accumulate(&cal, 200 * MSEC, x, y, z, temperature) - | accel_cal_accumulate(&cal, 400 * MSEC, x, y, z, temperature) - | accel_cal_accumulate(&cal, 600 * MSEC, x, y, z, temperature) - | accel_cal_accumulate(&cal, 800 * MSEC, x, y, z, temperature) - | accel_cal_accumulate(&cal, 1000 * MSEC, x, y, z, temperature); -} - -DECLARE_EC_TEST(test_calibrated_correctly_with_kasa) -{ - bool has_bias; - - accumulate(1.01f, 0.01f, 0.01f, 21.0f); - accumulate(-0.99f, 0.01f, 0.01f, 21.0f); - accumulate(0.01f, 1.01f, 0.01f, 21.0f); - accumulate(0.01f, -0.99f, 0.01f, 21.0f); - accumulate(0.01f, 0.01f, 1.01f, 21.0f); - accumulate(0.01f, 0.01f, -0.99f, 21.0f); - accumulate(0.7171f, 0.7171f, 0.7171f, 21.0f); - has_bias = accumulate(-0.6971f, -0.6971f, -0.6971f, 21.0f); - - zassert_true(has_bias, NULL); - zassert_within(cal.bias[X], 0.01f, 0.0001f, "%f", cal.bias[X]); - zassert_within(cal.bias[Y], 0.01f, 0.0001f, "%f", cal.bias[Y]); - zassert_within(cal.bias[Z], 0.01f, 0.0001f, "%f", cal.bias[Z]); - - return EC_SUCCESS; -} - -DECLARE_EC_TEST(test_calibrated_correctly_with_newton) -{ - bool has_bias = false; - struct kasa_fit kasa; - fpv3_t kasa_bias; - float kasa_radius; - int i; - float data[] = { - 1.00290f, 0.09170f, 0.09649f, - 0.95183f, 0.23626f, 0.25853f, - 0.95023f, 0.15387f, 0.31865f, - 0.97374f, 0.01639f, 0.27675f, - 0.88521f, 0.30212f, 0.39558f, - 0.92787f, 0.35157f, 0.21209f, - 0.95162f, 0.33173f, 0.10924f, - 0.98397f, 0.22644f, 0.07737f, - }; - - kasa_reset(&kasa); - for (i = 0; i < ARRAY_SIZE(data); i += 3) { - zassert_false(has_bias, NULL); - kasa_accumulate(&kasa, data[i], data[i + 1], data[i + 2]); - has_bias = accumulate(data[i], data[i + 1], data[i + 2], 21.0f); - } - - kasa_compute(&kasa, kasa_bias, &kasa_radius); - zassert_true(has_bias, NULL); - /* Check that the bias is right */ - zassert_within(cal.bias[X], 0.01f, 0.001f, "%f", cal.bias[X]); - zassert_within(cal.bias[Y], 0.01f, 0.001f, "%f", cal.bias[Y]); - zassert_within(cal.bias[Z], 0.01f, 0.001f, "%f", cal.bias[Z]); - /* Demonstrate that we got a better bias compared to kasa */ - zassert_true(sqrtf(powf(cal.bias[X] - 0.01f, 2.0f) + - powf(cal.bias[Y] - 0.01f, 2.0f) + - powf(cal.bias[Z] - 0.01f, 2.0f)) < - sqrtf(powf(kasa_bias[X] - 0.01f, 2.0f) + - powf(kasa_bias[Y] - 0.01f, 2.0f) + - powf(kasa_bias[Z] - 0.01f, 2.0f)), - NULL); - - return EC_SUCCESS; -} - -DECLARE_EC_TEST(test_temperature_gates) -{ - bool has_bias; - - accumulate(1.01f, 0.01f, 0.01f, 21.0f); - accumulate(-0.99f, 0.01f, 0.01f, 21.0f); - accumulate(0.01f, 1.01f, 0.01f, 21.0f); - accumulate(0.01f, -0.99f, 0.01f, 21.0f); - accumulate(0.01f, 0.01f, 1.01f, 21.0f); - accumulate(0.01f, 0.01f, -0.99f, 21.0f); - accumulate(0.7171f, 0.7171f, 0.7171f, 21.0f); - has_bias = accumulate(-0.6971f, -0.6971f, -0.6971f, 31.0f); - - zassert_false(has_bias, NULL); - - return EC_SUCCESS; -} - -void before_test(void) -{ - cal.still_det = STILL_DET(0.00025f, 800 * MSEC, 1200 * MSEC, 5); - accel_cal_reset(&cal); -} - -void after_test(void) {} - -TEST_MAIN() -{ - ztest_test_suite(test_accel_cal, - ztest_unit_test_setup_teardown( - test_calibrated_correctly_with_kasa, - before_test, after_test), - ztest_unit_test_setup_teardown( - test_calibrated_correctly_with_newton, - before_test, after_test), - ztest_unit_test_setup_teardown(test_temperature_gates, - before_test, - after_test)); - ztest_run_test_suite(test_accel_cal); -} diff --git a/test/accel_cal.tasklist b/test/accel_cal.tasklist deleted file mode 100644 index 0e3696c3f0..0000000000 --- a/test/accel_cal.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(MOTIONSENSE, motion_sense_task, NULL, TASK_STACK_SIZE) diff --git a/test/aes.c b/test/aes.c deleted file mode 100644 index 1c71e2874e..0000000000 --- a/test/aes.c +++ /dev/null @@ -1,664 +0,0 @@ -/* Copyright 2018 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. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - -#include "aes.h" -#include "aes-gcm.h" -#include "console.h" -#include "common.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" -#include "watchdog.h" - -/* Temporary buffer, to avoid using too much stack space. */ -static uint8_t tmp[512]; - -/* - * Do encryption, put result in |result|, and compare with |ciphertext|. - */ -static int test_aes_gcm_encrypt(uint8_t *result, - const uint8_t *key, - int key_size, - const uint8_t *plaintext, - const uint8_t *ciphertext, - int plaintext_size, - const uint8_t *nonce, - int nonce_size, - const uint8_t *tag, - int tag_size) -{ - static AES_KEY aes_key; - static GCM128_CONTEXT ctx; - - TEST_ASSERT(AES_set_encrypt_key(key, 8 * key_size, &aes_key) == 0); - - CRYPTO_gcm128_init(&ctx, &aes_key, (block128_f) AES_encrypt, 0); - CRYPTO_gcm128_setiv(&ctx, &aes_key, nonce, nonce_size); - TEST_ASSERT(CRYPTO_gcm128_encrypt(&ctx, &aes_key, plaintext, result, - plaintext_size)); - TEST_ASSERT(CRYPTO_gcm128_finish(&ctx, tag, tag_size)); - TEST_ASSERT_ARRAY_EQ(ciphertext, result, plaintext_size); - - return EC_SUCCESS; -} - -/* - * Do decryption, put result in |result|, and compare with |plaintext|. - */ -static int test_aes_gcm_decrypt(uint8_t *result, - const uint8_t *key, - int key_size, - const uint8_t *plaintext, - const uint8_t *ciphertext, - int plaintext_size, - const uint8_t *nonce, - int nonce_size, - const uint8_t *tag, - int tag_size) -{ - static AES_KEY aes_key; - static GCM128_CONTEXT ctx; - - TEST_ASSERT(AES_set_encrypt_key(key, 8 * key_size, &aes_key) == 0); - - CRYPTO_gcm128_init(&ctx, &aes_key, (block128_f) AES_encrypt, 0); - CRYPTO_gcm128_setiv(&ctx, &aes_key, nonce, nonce_size); - TEST_ASSERT(CRYPTO_gcm128_decrypt(&ctx, &aes_key, ciphertext, result, - plaintext_size)); - TEST_ASSERT(CRYPTO_gcm128_finish(&ctx, tag, tag_size)); - TEST_ASSERT_ARRAY_EQ(plaintext, result, plaintext_size); - - return EC_SUCCESS; -} - -static int test_aes_gcm_raw_inplace(const uint8_t *key, - int key_size, - const uint8_t *plaintext, - const uint8_t *ciphertext, - int plaintext_size, - const uint8_t *nonce, - int nonce_size, - const uint8_t *tag, - int tag_size) -{ - - /* - * Make copies that will be clobbered during in-place encryption or - * decryption. - */ - uint8_t plaintext_copy[plaintext_size]; - uint8_t ciphertext_copy[plaintext_size]; - - memcpy(plaintext_copy, plaintext, plaintext_size); - memcpy(ciphertext_copy, ciphertext, plaintext_size); - - TEST_ASSERT(test_aes_gcm_encrypt(plaintext_copy, - key, - key_size, - plaintext_copy, - ciphertext, - plaintext_size, - nonce, - nonce_size, - tag, - tag_size) == EC_SUCCESS); - - TEST_ASSERT(test_aes_gcm_decrypt(ciphertext_copy, - key, - key_size, - plaintext, - ciphertext_copy, - plaintext_size, - nonce, - nonce_size, - tag, - tag_size) == EC_SUCCESS); - - return EC_SUCCESS; -} - -static int test_aes_gcm_raw_non_inplace(const uint8_t *key, - int key_size, - const uint8_t *plaintext, - const uint8_t *ciphertext, - int plaintext_size, - const uint8_t *nonce, - int nonce_size, - const uint8_t *tag, - int tag_size) -{ - TEST_ASSERT(test_aes_gcm_encrypt(tmp, - key, - key_size, - plaintext, - ciphertext, - plaintext_size, - nonce, - nonce_size, - tag, - tag_size) == EC_SUCCESS); - - TEST_ASSERT(test_aes_gcm_decrypt(tmp, - key, - key_size, - plaintext, - ciphertext, - plaintext_size, - nonce, - nonce_size, - tag, - tag_size) == EC_SUCCESS); - - return EC_SUCCESS; -} - -static int test_aes_gcm_raw(const uint8_t *key, - int key_size, - const uint8_t *plaintext, - const uint8_t *ciphertext, - int plaintext_size, - const uint8_t *nonce, - int nonce_size, - const uint8_t *tag, - int tag_size) -{ - TEST_ASSERT(plaintext_size <= sizeof(tmp)); - - TEST_ASSERT(test_aes_gcm_raw_non_inplace(key, - key_size, - plaintext, - ciphertext, - plaintext_size, - nonce, - nonce_size, - tag, - tag_size) == EC_SUCCESS); - TEST_ASSERT(test_aes_gcm_raw_inplace(key, - key_size, - plaintext, - ciphertext, - plaintext_size, - nonce, - nonce_size, - tag, - tag_size) == EC_SUCCESS); - - return EC_SUCCESS; -} - -static int test_aes_gcm(void) -{ - /* - * Test vectors from BoringSSL crypto/fipsmodule/modes/gcm_tests.txt - * (only the ones with actual data, and no additional data). - */ - static const uint8_t key1[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; - static const uint8_t plain1[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; - static const uint8_t nonce1[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; - static const uint8_t cipher1[] = { - 0x03, 0x88, 0xda, 0xce, 0x60, 0xb6, 0xa3, 0x92, - 0xf3, 0x28, 0xc2, 0xb9, 0x71, 0xb2, 0xfe, 0x78, - }; - static const uint8_t tag1[] = { - 0xab, 0x6e, 0x47, 0xd4, 0x2c, 0xec, 0x13, 0xbd, - 0xf5, 0x3a, 0x67, 0xb2, 0x12, 0x57, 0xbd, 0xdf, - }; - - static const uint8_t key2[] = { - 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, - 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, - }; - static const uint8_t plain2[] = { - 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, - 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, - 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, - 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, - 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, - 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, - 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, - 0xba, 0x63, 0x7b, 0x39, 0x1a, 0xaf, 0xd2, 0x55, - }; - static const uint8_t nonce2[] = { - 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, - 0xde, 0xca, 0xf8, 0x88, - }; - static const uint8_t cipher2[] = { - 0x42, 0x83, 0x1e, 0xc2, 0x21, 0x77, 0x74, 0x24, - 0x4b, 0x72, 0x21, 0xb7, 0x84, 0xd0, 0xd4, 0x9c, - 0xe3, 0xaa, 0x21, 0x2f, 0x2c, 0x02, 0xa4, 0xe0, - 0x35, 0xc1, 0x7e, 0x23, 0x29, 0xac, 0xa1, 0x2e, - 0x21, 0xd5, 0x14, 0xb2, 0x54, 0x66, 0x93, 0x1c, - 0x7d, 0x8f, 0x6a, 0x5a, 0xac, 0x84, 0xaa, 0x05, - 0x1b, 0xa3, 0x0b, 0x39, 0x6a, 0x0a, 0xac, 0x97, - 0x3d, 0x58, 0xe0, 0x91, 0x47, 0x3f, 0x59, 0x85, - }; - static const uint8_t tag2[] = { - 0x4d, 0x5c, 0x2a, 0xf3, 0x27, 0xcd, 0x64, 0xa6, - 0x2c, 0xf3, 0x5a, 0xbd, 0x2b, 0xa6, 0xfa, 0xb4, - }; - - static const uint8_t key3[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; - static const uint8_t plain3[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; - static const uint8_t nonce3[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; - static const uint8_t cipher3[] = { - 0x98, 0xe7, 0x24, 0x7c, 0x07, 0xf0, 0xfe, 0x41, - 0x1c, 0x26, 0x7e, 0x43, 0x84, 0xb0, 0xf6, 0x00, - }; - static const uint8_t tag3[] = { - 0x2f, 0xf5, 0x8d, 0x80, 0x03, 0x39, 0x27, 0xab, - 0x8e, 0xf4, 0xd4, 0x58, 0x75, 0x14, 0xf0, 0xfb, - }; - - static const uint8_t key4[] = { - 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, - 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, - 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, - }; - static const uint8_t plain4[] = { - 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, - 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, - 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, - 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, - 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, - 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, - 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, - 0xba, 0x63, 0x7b, 0x39, 0x1a, 0xaf, 0xd2, 0x55, - }; - static const uint8_t nonce4[] = { - 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, - 0xde, 0xca, 0xf8, 0x88, - }; - static const uint8_t cipher4[] = { - 0x39, 0x80, 0xca, 0x0b, 0x3c, 0x00, 0xe8, 0x41, - 0xeb, 0x06, 0xfa, 0xc4, 0x87, 0x2a, 0x27, 0x57, - 0x85, 0x9e, 0x1c, 0xea, 0xa6, 0xef, 0xd9, 0x84, - 0x62, 0x85, 0x93, 0xb4, 0x0c, 0xa1, 0xe1, 0x9c, - 0x7d, 0x77, 0x3d, 0x00, 0xc1, 0x44, 0xc5, 0x25, - 0xac, 0x61, 0x9d, 0x18, 0xc8, 0x4a, 0x3f, 0x47, - 0x18, 0xe2, 0x44, 0x8b, 0x2f, 0xe3, 0x24, 0xd9, - 0xcc, 0xda, 0x27, 0x10, 0xac, 0xad, 0xe2, 0x56, - }; - static const uint8_t tag4[] = { - 0x99, 0x24, 0xa7, 0xc8, 0x58, 0x73, 0x36, 0xbf, - 0xb1, 0x18, 0x02, 0x4d, 0xb8, 0x67, 0x4a, 0x14, - }; - - static const uint8_t key5[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; - static const uint8_t plain5[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; - static const uint8_t nonce5[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; - static const uint8_t cipher5[] = { - 0xce, 0xa7, 0x40, 0x3d, 0x4d, 0x60, 0x6b, 0x6e, - 0x07, 0x4e, 0xc5, 0xd3, 0xba, 0xf3, 0x9d, 0x18, - }; - static const uint8_t tag5[] = { - 0xd0, 0xd1, 0xc8, 0xa7, 0x99, 0x99, 0x6b, 0xf0, - 0x26, 0x5b, 0x98, 0xb5, 0xd4, 0x8a, 0xb9, 0x19, - }; - - static const uint8_t key6[] = { - 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, - 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, - 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, - 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, - }; - static const uint8_t plain6[] = { - 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, - 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, - 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, - 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, - 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, - 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, - 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, - 0xba, 0x63, 0x7b, 0x39, 0x1a, 0xaf, 0xd2, 0x55, - }; - static const uint8_t nonce6[] = { - 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, - 0xde, 0xca, 0xf8, 0x88, - }; - static const uint8_t cipher6[] = { - 0x52, 0x2d, 0xc1, 0xf0, 0x99, 0x56, 0x7d, 0x07, - 0xf4, 0x7f, 0x37, 0xa3, 0x2a, 0x84, 0x42, 0x7d, - 0x64, 0x3a, 0x8c, 0xdc, 0xbf, 0xe5, 0xc0, 0xc9, - 0x75, 0x98, 0xa2, 0xbd, 0x25, 0x55, 0xd1, 0xaa, - 0x8c, 0xb0, 0x8e, 0x48, 0x59, 0x0d, 0xbb, 0x3d, - 0xa7, 0xb0, 0x8b, 0x10, 0x56, 0x82, 0x88, 0x38, - 0xc5, 0xf6, 0x1e, 0x63, 0x93, 0xba, 0x7a, 0x0a, - 0xbc, 0xc9, 0xf6, 0x62, 0x89, 0x80, 0x15, 0xad, - }; - static const uint8_t tag6[] = { - 0xb0, 0x94, 0xda, 0xc5, 0xd9, 0x34, 0x71, 0xbd, - 0xec, 0x1a, 0x50, 0x22, 0x70, 0xe3, 0xcc, 0x6c, - }; - - static const uint8_t key7[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; - static const uint8_t plain7[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; - /* This nonce results in 0xfff in counter LSB. */ - static const uint8_t nonce7[] = { - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; - static const uint8_t cipher7[] = { - 0x56, 0xb3, 0x37, 0x3c, 0xa9, 0xef, 0x6e, 0x4a, - 0x2b, 0x64, 0xfe, 0x1e, 0x9a, 0x17, 0xb6, 0x14, - 0x25, 0xf1, 0x0d, 0x47, 0xa7, 0x5a, 0x5f, 0xce, - 0x13, 0xef, 0xc6, 0xbc, 0x78, 0x4a, 0xf2, 0x4f, - 0x41, 0x41, 0xbd, 0xd4, 0x8c, 0xf7, 0xc7, 0x70, - 0x88, 0x7a, 0xfd, 0x57, 0x3c, 0xca, 0x54, 0x18, - 0xa9, 0xae, 0xff, 0xcd, 0x7c, 0x5c, 0xed, 0xdf, - 0xc6, 0xa7, 0x83, 0x97, 0xb9, 0xa8, 0x5b, 0x49, - 0x9d, 0xa5, 0x58, 0x25, 0x72, 0x67, 0xca, 0xab, - 0x2a, 0xd0, 0xb2, 0x3c, 0xa4, 0x76, 0xa5, 0x3c, - 0xb1, 0x7f, 0xb4, 0x1c, 0x4b, 0x8b, 0x47, 0x5c, - 0xb4, 0xf3, 0xf7, 0x16, 0x50, 0x94, 0xc2, 0x29, - 0xc9, 0xe8, 0xc4, 0xdc, 0x0a, 0x2a, 0x5f, 0xf1, - 0x90, 0x3e, 0x50, 0x15, 0x11, 0x22, 0x13, 0x76, - 0xa1, 0xcd, 0xb8, 0x36, 0x4c, 0x50, 0x61, 0xa2, - 0x0c, 0xae, 0x74, 0xbc, 0x4a, 0xcd, 0x76, 0xce, - 0xb0, 0xab, 0xc9, 0xfd, 0x32, 0x17, 0xef, 0x9f, - 0x8c, 0x90, 0xbe, 0x40, 0x2d, 0xdf, 0x6d, 0x86, - 0x97, 0xf4, 0xf8, 0x80, 0xdf, 0xf1, 0x5b, 0xfb, - 0x7a, 0x6b, 0x28, 0x24, 0x1e, 0xc8, 0xfe, 0x18, - 0x3c, 0x2d, 0x59, 0xe3, 0xf9, 0xdf, 0xff, 0x65, - 0x3c, 0x71, 0x26, 0xf0, 0xac, 0xb9, 0xe6, 0x42, - 0x11, 0xf4, 0x2b, 0xae, 0x12, 0xaf, 0x46, 0x2b, - 0x10, 0x70, 0xbe, 0xf1, 0xab, 0x5e, 0x36, 0x06, - 0x87, 0x2c, 0xa1, 0x0d, 0xee, 0x15, 0xb3, 0x24, - 0x9b, 0x1a, 0x1b, 0x95, 0x8f, 0x23, 0x13, 0x4c, - 0x4b, 0xcc, 0xb7, 0xd0, 0x32, 0x00, 0xbc, 0xe4, - 0x20, 0xa2, 0xf8, 0xeb, 0x66, 0xdc, 0xf3, 0x64, - 0x4d, 0x14, 0x23, 0xc1, 0xb5, 0x69, 0x90, 0x03, - 0xc1, 0x3e, 0xce, 0xf4, 0xbf, 0x38, 0xa3, 0xb6, - 0x0e, 0xed, 0xc3, 0x40, 0x33, 0xba, 0xc1, 0x90, - 0x27, 0x83, 0xdc, 0x6d, 0x89, 0xe2, 0xe7, 0x74, - 0x18, 0x8a, 0x43, 0x9c, 0x7e, 0xbc, 0xc0, 0x67, - 0x2d, 0xbd, 0xa4, 0xdd, 0xcf, 0xb2, 0x79, 0x46, - 0x13, 0xb0, 0xbe, 0x41, 0x31, 0x5e, 0xf7, 0x78, - 0x70, 0x8a, 0x70, 0xee, 0x7d, 0x75, 0x16, 0x5c, - }; - static const uint8_t tag7[] = { - 0x8b, 0x30, 0x7f, 0x6b, 0x33, 0x28, 0x6d, 0x0a, - 0xb0, 0x26, 0xa9, 0xed, 0x3f, 0xe1, 0xe8, 0x5f, - }; - - TEST_ASSERT(!test_aes_gcm_raw(key1, sizeof(key1), - plain1, cipher1, sizeof(plain1), - nonce1, sizeof(nonce1), tag1, sizeof(tag1))); - TEST_ASSERT(!test_aes_gcm_raw(key2, sizeof(key2), - plain2, cipher2, sizeof(plain2), - nonce2, sizeof(nonce2), tag2, sizeof(tag2))); - TEST_ASSERT(!test_aes_gcm_raw(key3, sizeof(key3), - plain3, cipher3, sizeof(plain3), - nonce3, sizeof(nonce3), tag3, sizeof(tag3))); - TEST_ASSERT(!test_aes_gcm_raw(key4, sizeof(key4), - plain4, cipher4, sizeof(plain4), - nonce4, sizeof(nonce4), tag4, sizeof(tag4))); - TEST_ASSERT(!test_aes_gcm_raw(key5, sizeof(key5), - plain5, cipher5, sizeof(plain5), - nonce5, sizeof(nonce5), tag5, sizeof(tag5))); - TEST_ASSERT(!test_aes_gcm_raw(key6, sizeof(key6), - plain6, cipher6, sizeof(plain6), - nonce6, sizeof(nonce6), tag6, sizeof(tag6))); - TEST_ASSERT(!test_aes_gcm_raw(key7, sizeof(key7), - plain7, cipher7, sizeof(plain7), - nonce7, sizeof(nonce7), tag7, sizeof(tag7))); - - return EC_SUCCESS; -} - -static void test_aes_gcm_speed(void) -{ - int i; - static const uint8_t key[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; - const int key_size = sizeof(key); - static const uint8_t plaintext[512] = { 0 }; - const int plaintext_size = sizeof(plaintext); - static const uint8_t nonce[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; - const int nonce_size = sizeof(nonce); - uint8_t tag[16] = {0}; - const int tag_size = sizeof(tag); - - uint8_t *out = tmp; - static AES_KEY aes_key; - static GCM128_CONTEXT ctx; - timestamp_t t0, t1; - - assert(plaintext_size <= sizeof(tmp)); - - t0 = get_time(); - for (i = 0; i < 1000; i++) { - AES_set_encrypt_key(key, 8 * key_size, &aes_key); - CRYPTO_gcm128_init(&ctx, &aes_key, (block128_f)AES_encrypt, 0); - CRYPTO_gcm128_setiv(&ctx, &aes_key, nonce, nonce_size); - CRYPTO_gcm128_encrypt(&ctx, &aes_key, plaintext, out, - plaintext_size); - CRYPTO_gcm128_tag(&ctx, tag, tag_size); - } - t1 = get_time(); - ccprintf("AES-GCM duration %lld us\n", (long long)(t1.val - t0.val)); -} - -static int test_aes_raw(const uint8_t *key, int key_size, - const uint8_t *plaintext, const uint8_t *ciphertext) -{ - AES_KEY aes_key; - uint8_t *block = tmp; - - TEST_ASSERT(AES_BLOCK_SIZE <= sizeof(tmp)); - - TEST_ASSERT(AES_set_encrypt_key(key, 8 * key_size, &aes_key) == 0); - - /* Test encryption. */ - AES_encrypt(plaintext, block, &aes_key); - TEST_ASSERT_ARRAY_EQ(ciphertext, block, AES_BLOCK_SIZE); - - /* Test in-place encryption. */ - memcpy(block, plaintext, AES_BLOCK_SIZE); - AES_encrypt(block, block, &aes_key); - TEST_ASSERT_ARRAY_EQ(ciphertext, block, AES_BLOCK_SIZE); - - TEST_ASSERT(AES_set_decrypt_key(key, 8 * key_size, &aes_key) == 0); - - /* Test decryption. */ - AES_decrypt(ciphertext, block, &aes_key); - TEST_ASSERT_ARRAY_EQ(plaintext, block, AES_BLOCK_SIZE); - - /* Test in-place decryption. */ - memcpy(block, ciphertext, AES_BLOCK_SIZE); - AES_decrypt(block, block, &aes_key); - TEST_ASSERT_ARRAY_EQ(plaintext, block, AES_BLOCK_SIZE); - - return EC_SUCCESS; -} - -static int test_aes(void) -{ - /* Test vectors from FIPS-197, Appendix C. */ - static const uint8_t key1[] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - }; - static const uint8_t plain1[] = { - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, - }; - static const uint8_t cipher1[] = { - 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30, - 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a, - }; - - static const uint8_t key2[] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - }; - static const uint8_t plain2[] = { - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, - }; - static const uint8_t cipher2[] = { - 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0, - 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91, - }; - - static const uint8_t key3[] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, - }; - static const uint8_t plain3[] = { - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, - }; - static const uint8_t cipher3[] = { - 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf, - 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89, - }; - - TEST_ASSERT(!test_aes_raw(key1, sizeof(key1), plain1, cipher1)); - TEST_ASSERT(!test_aes_raw(key2, sizeof(key2), plain2, cipher2)); - TEST_ASSERT(!test_aes_raw(key3, sizeof(key3), plain3, cipher3)); - - return EC_SUCCESS; -} - -static void test_aes_speed(void) -{ - int i; - /* Test vectors from FIPS-197, Appendix C. */ - static const uint8_t key[] __aligned(4) = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - }; - const int key_size = sizeof(key); - static const uint8_t plaintext[] __aligned(4) = { - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, - }; - - AES_KEY aes_key; - uint8_t block[AES_BLOCK_SIZE]; - timestamp_t t0, t1; - - AES_set_encrypt_key(key, 8 * key_size, &aes_key); - AES_encrypt(plaintext, block, &aes_key); - t0 = get_time(); - for (i = 0; i < 1000; i++) - AES_encrypt(block, block, &aes_key); - t1 = get_time(); - ccprintf("AES duration %lld us\n", (long long)(t1.val - t0.val)); -} - -void run_test(int argc, char **argv) -{ - watchdog_reload(); - - /* do not check result, just as a benchmark */ - test_aes_speed(); - - watchdog_reload(); - RUN_TEST(test_aes); - - /* do not check result, just as a benchmark */ - test_aes_gcm_speed(); - - watchdog_reload(); - RUN_TEST(test_aes_gcm); - - test_print_result(); -} diff --git a/test/aes.tasklist b/test/aes.tasklist deleted file mode 100644 index 24870f2abb..0000000000 --- a/test/aes.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2018 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST diff --git a/test/base32.c b/test/base32.c deleted file mode 100644 index faaefc266f..0000000000 --- a/test/base32.c +++ /dev/null @@ -1,209 +0,0 @@ -/* Copyright 2017 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. - * - * Test Base-32 encoding/decoding - */ - -#include <stdio.h> -#include "common.h" -#include "base32.h" -#include "test_util.h" -#include "util.h" - -DECLARE_EC_TEST(test_crc5) -{ - uint32_t seen; - int i, j, c; - int errors = 0; - - /* - * For every current CRC value and symbol, new CRC value is unique. - * This guarantees a single-character typo will be detected. - */ - for (i = 0; i < 32; i++) { - seen = 0; - for (j = 0; j < 32; j++) - seen |= 1 << crc5_sym(j, i); - zassert_equal(seen, 0xffffffff, NULL); - } - - /* - * Do the same in the opposite order, to make sure a subsequent - * character doesn't obscure a previous typo. - */ - for (i = 0; i < 32; i++) { - seen = 0; - for (j = 0; j < 32; j++) - seen |= 1 << crc5_sym(i, j); - zassert_equal(seen, 0xffffffff, NULL); - } - - /* Transposing different symbols generates distinct CRCs */ - for (c = 0; c < 32; c++) { - for (i = 0; i < 32; i++) { - for (j = i + 1; j < 32; j++) { - if (crc5_sym(j, crc5_sym(i, c)) == - crc5_sym(i, crc5_sym(j, c))) - errors++; - } - } - } - zassert_equal(errors, 0, NULL); - - return EC_SUCCESS; -} - -static int enctest(const void *src, int srcbits, int crc_every, - const char *enc) -{ - char dest[32]; - - if (base32_encode(dest, sizeof(dest), src, srcbits, crc_every)) - return -1; - if (strlen(dest) != strlen(enc) || strncmp(dest, enc, strlen(dest))) { - fprintf(stderr, "expected encode: \"%s\"\n", enc); - fprintf(stderr, "got encode: \"%s\"\n", dest); - return -2; - } - return 0; -} - -#define ENCTEST(a, b, c, d) zassert_equal(enctest(a, b, c, d), 0, NULL) - -DECLARE_EC_TEST(test_encode) -{ - const uint8_t src1[5] = {0xff, 0x00, 0xff, 0x00, 0xff}; - char enc[32]; - - /* Test for enough space; error produces null string */ - *enc = 1; - zassert_equal(base32_encode(enc, 3, src1, 15, 0), EC_ERROR_INVAL, NULL); - zassert_equal(*enc, 0, NULL); - - /* Empty source */ - ENCTEST("\x00", 0, 0, ""); - - /* Single symbol uses top 5 bits */ - ENCTEST("\x07", 5, 0, "A"); - ENCTEST("\xb8", 5, 0, "Z"); - ENCTEST("\xc0", 5, 0, "2"); - ENCTEST("\xf8", 5, 0, "9"); - - /* Multiples of 5 bits use top bits */ - ENCTEST("\x08\x86", 10, 0, "BC"); - ENCTEST("\x08\x86", 15, 0, "BCD"); - - /* Multiples of 8 bits pad with 0 bits */ - ENCTEST("\xff", 8, 0, "96"); - ENCTEST("\x08\x87", 16, 0, "BCDS"); - - /* Multiples of 40 bits use all the bits */ - ENCTEST("\xff\x00\xff\x00\xff", 40, 0, "96AR8AH9"); - - /* CRC requires exact multiple of symbol count */ - ENCTEST("\xff\x00\xff\x00\xff", 40, 4, "96ARU8AH9D"); - ENCTEST("\xff\x00\xff\x00\xff", 40, 8, "96AR8AH9L"); - zassert_equal( - base32_encode(enc, 16, (uint8_t *)"\xff\x00\xff\x00\xff", - 40, 6), - EC_ERROR_INVAL, NULL); - /* But what matters is symbol count, not bit count */ - ENCTEST("\xff\x00\xff\x00\xfe", 39, 4, "96ARU8AH8P"); - - return EC_SUCCESS; -} - -static int cmpbytes(const uint8_t *expect, const uint8_t *got, int len, - const char *desc) -{ - int i; - - if (!memcmp(expect, got, len)) - return 0; - - fprintf(stderr, "expected %s:", desc); - for (i = 0; i < len; i++) - fprintf(stderr, " %02x", expect[i]); - fprintf(stderr, "\ngot %s: ", desc); - for (i = 0; i < len; i++) - fprintf(stderr, " %02x", got[i]); - fprintf(stderr, "\n"); - - return -2; -} - -static int dectest(const void *dec, int decbits, int crc_every, const char *enc) -{ - uint8_t dest[32]; - int destbits = decbits > 0 ? decbits : sizeof(dest) * 8; - int wantbits = decbits > 0 ? decbits : 5 * strlen(enc); - int gotbits = base32_decode(dest, destbits, enc, crc_every); - - zassert_equal(gotbits, wantbits, NULL); - if (gotbits != wantbits) - return -1; - return cmpbytes(dec, dest, (decbits + 7) / 8, "decode"); -} - -#define DECTEST(a, b, c, d) zassert_equal(dectest(a, b, c, d), 0, NULL) - -DECLARE_EC_TEST(test_decode) -{ - uint8_t dec[32]; - - /* Decode tests, dest-limited */ - DECTEST("\xf8", 5, 0, "97"); - DECTEST("\x08", 5, 0, "BCDS"); - DECTEST("\x08\x80", 10, 0, "BCDS"); - DECTEST("\x08\x86", 15, 0, "BCDS"); - DECTEST("\xff", 8, 0, "96"); - DECTEST("\x08\x87", 16, 0, "BCDS"); - DECTEST("\xff\x00\xff\x00\xff", 40, 0, "96AR8AH9"); - DECTEST("\xff\x00\xff\x00\xfe", 39, 4, "96ARU8AH8P"); - - /* Decode ignores whitespace and dashes */ - DECTEST("\xff\x00\xff\x00\xff", 40, 0, " 96\tA-R\r8A H9\n"); - - /* Invalid symbol fails */ - zassert_equal(base32_decode(dec, 16, "AI", 0), -1, NULL); - - /* If dest buffer is big, use all the source bits */ - DECTEST("", 0, 0, ""); - DECTEST("\xf8", 0, 0, "9"); - DECTEST("\x07\xc0", 0, 0, "A9"); - DECTEST("\x00\x3e", 0, 0, "AA9"); - DECTEST("\x00\x01\xf0", 0, 0, "AAA9"); - DECTEST("\xff\x00\xff\x00\xff", 0, 0, "96AR8AH9"); - - /* Decode always overwrites destination */ - memset(dec, 0xff, sizeof(dec)); - DECTEST("\x00\x00\x00\x00\x00", 0, 0, "AAAAAAAA"); - memset(dec, 0x00, sizeof(dec)); - DECTEST("\xff\xff\xff\xff\xff", 0, 0, "99999999"); - - /* Good CRCs */ - DECTEST("\xff\x00\xff\x00\xff", 40, 4, "96ARU8AH9D"); - DECTEST("\xff\x00\xff\x00\xff", 40, 8, "96AR8AH9L"); - - /* CRC requires exact multiple of symbol count */ - zassert_equal(base32_decode(dec, 40, "96ARL8AH9", 4), -1, NULL); - /* But what matters is symbol count, not bit count */ - DECTEST("\xff\x00\xff\x00\xfe", 39, 4, "96ARU8AH8P"); - - /* Detect errors in data, CRC, and transposition */ - zassert_equal(base32_decode(dec, 40, "96AQL", 4), -1, NULL); - zassert_equal(base32_decode(dec, 40, "96ARM", 4), -1, NULL); - zassert_equal(base32_decode(dec, 40, "96RAL", 4), -1, NULL); - - return EC_SUCCESS; -} - -TEST_MAIN() -{ - ztest_test_suite(test_base32_lib, - ztest_unit_test(test_crc5), - ztest_unit_test(test_encode), - ztest_unit_test(test_decode)); - ztest_run_test_suite(test_base32_lib); -} diff --git a/test/base32.tasklist b/test/base32.tasklist deleted file mode 100644 index 7150f17cbd..0000000000 --- a/test/base32.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2017 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/battery_get_params_smart.c b/test/battery_get_params_smart.c deleted file mode 100644 index 3163fb587e..0000000000 --- a/test/battery_get_params_smart.c +++ /dev/null @@ -1,98 +0,0 @@ -/* Copyright 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. - * - * Test the logic of battery_get_params() to be sure it sets the correct flags - * when i2c reads fail. - */ - -#include "battery.h" -#include "battery_smart.h" -#include "common.h" -#include "console.h" -#include "i2c.h" -#include "test_util.h" -#include "util.h" - -/* Test state */ -static int fail_on_first, fail_on_last; -static int read_count, write_count; -struct batt_params batt; - - -void battery_compensate_params(struct batt_params *batt) -{ -} - -void board_battery_compensate_params(struct batt_params *batt) -{ -} - -static void reset_and_fail_on(int first, int last) -{ - /* We're not initializing the fake battery, so everything reads zero */ - memset(&batt, 0, sizeof(typeof(batt))); - read_count = write_count = 0; - fail_on_first = first; - fail_on_last = last; -} - -/* Mocked functions */ -int sb_read(int cmd, int *param) -{ - read_count++; - if (read_count >= fail_on_first && read_count <= fail_on_last) - return EC_ERROR_UNKNOWN; - - return i2c_read16(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS, - cmd, param); -} -int sb_write(int cmd, int param) -{ - write_count++; - return i2c_write16(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS, - cmd, param); -} - - -/* Tests */ -static int test_param_failures(void) -{ - int i, num_reads; - - /* No failures */ - reset_and_fail_on(0, 0); - battery_get_params(&batt); - TEST_ASSERT(batt.flags & BATT_FLAG_RESPONSIVE); - TEST_ASSERT(!(batt.flags & BATT_FLAG_BAD_ANY)); - num_reads = read_count; - - /* Just a single failure */ - for (i = 1; i <= num_reads; i++) { - reset_and_fail_on(i, i); - battery_get_params(&batt); - TEST_ASSERT(batt.flags & BATT_FLAG_BAD_ANY); - TEST_ASSERT(batt.flags & BATT_FLAG_RESPONSIVE); - } - - /* Once it fails, it keeps failing */ - for (i = 1; i <= num_reads; i++) { - reset_and_fail_on(i, num_reads); - battery_get_params(&batt); - TEST_ASSERT(batt.flags & BATT_FLAG_BAD_ANY); - if (i == 1) - /* If every read fails, it's not responsive */ - TEST_ASSERT(!(batt.flags & BATT_FLAG_RESPONSIVE)); - else - TEST_ASSERT(batt.flags & BATT_FLAG_RESPONSIVE); - } - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - RUN_TEST(test_param_failures); - - test_print_result(); -} diff --git a/test/battery_get_params_smart.tasklist b/test/battery_get_params_smart.tasklist deleted file mode 100644 index c2eb8159a9..0000000000 --- a/test/battery_get_params_smart.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/bklight_lid.c b/test/bklight_lid.c deleted file mode 100644 index 99167a71a6..0000000000 --- a/test/bklight_lid.c +++ /dev/null @@ -1,106 +0,0 @@ -/* Copyright 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. - * - * Test backlight control based on lid - */ - -#include "backlight.h" -#include "common.h" -#include "console.h" -#include "hooks.h" -#include "host_command.h" -#include "lid_switch.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -static int mock_lid = 1; -static int backlight_en; - -int gpio_get_level(enum gpio_signal signal) -{ - if (signal == GPIO_LID_OPEN) - return mock_lid; - return 0; -} - -void gpio_set_level(enum gpio_signal signal, int level) -{ - if (signal == GPIO_ENABLE_BACKLIGHT) - backlight_en = level; -} - -void set_lid_state(int is_open) -{ - mock_lid = is_open; - lid_interrupt(GPIO_LID_OPEN); - msleep(40); -} - -static int send_bklight_hostcmd(int enabled) -{ - struct ec_params_switch_enable_backlight p; - p.enabled = enabled; - - return test_send_host_command(EC_CMD_SWITCH_ENABLE_BKLIGHT, 0, &p, - sizeof(p), NULL, 0); -} - -static int test_passthrough(void) -{ - /* Initial state */ - TEST_ASSERT(mock_lid == 1); - TEST_ASSERT(backlight_en); - - /* Close lid. Backlight should turn off */ - set_lid_state(0); - TEST_ASSERT(!backlight_en); - - /* Open lid. Backlight turns on */ - set_lid_state(1); - TEST_ASSERT(backlight_en); - - return EC_SUCCESS; -} - -static int test_hostcommand(void) -{ - /* Open lid */ - set_lid_state(1); - TEST_ASSERT(backlight_en); - - /* Disable by host command */ - send_bklight_hostcmd(0); - TEST_ASSERT(!backlight_en); - - /* Close and open lid. Backlight should come up */ - set_lid_state(0); - set_lid_state(1); - TEST_ASSERT(backlight_en); - - /* Close lid */ - set_lid_state(0); - TEST_ASSERT(!backlight_en); - - /* Enable by host command */ - send_bklight_hostcmd(1); - TEST_ASSERT(backlight_en); - - /* Disable backlight by lid */ - set_lid_state(1); - set_lid_state(0); - TEST_ASSERT(!backlight_en); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_passthrough); - RUN_TEST(test_hostcommand); - - test_print_result(); -} diff --git a/test/bklight_lid.tasklist b/test/bklight_lid.tasklist deleted file mode 100644 index da0ab6211a..0000000000 --- a/test/bklight_lid.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/bklight_passthru.c b/test/bklight_passthru.c deleted file mode 100644 index 170cc734cd..0000000000 --- a/test/bklight_passthru.c +++ /dev/null @@ -1,140 +0,0 @@ -/* Copyright 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. - * - * Test x86 backlight passthrough. - */ - -#include "backlight.h" -#include "common.h" -#include "console.h" -#include "hooks.h" -#include "host_command.h" -#include "lid_switch.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -static int mock_lid = 1; -static int mock_pch_bklten; -static int backlight_en; - -int gpio_get_level(enum gpio_signal signal) -{ - if (signal == GPIO_LID_OPEN) - return mock_lid; - if (signal == GPIO_PCH_BKLTEN) - return mock_pch_bklten; - return 0; -} - -void gpio_set_level(enum gpio_signal signal, int level) -{ - if (signal == GPIO_ENABLE_BACKLIGHT) - backlight_en = level; -} - -void set_lid_state(int is_open) -{ - mock_lid = is_open; - lid_interrupt(GPIO_LID_OPEN); - msleep(40); -} - -void set_pch_bklten(int enabled) -{ - int orig = mock_pch_bklten; - mock_pch_bklten = enabled; - if (orig != enabled) - backlight_interrupt(GPIO_PCH_BKLTEN); -} - -static int send_bklight_hostcmd(int enabled) -{ - struct ec_params_switch_enable_backlight p; - p.enabled = enabled; - - return test_send_host_command(EC_CMD_SWITCH_ENABLE_BKLIGHT, 0, &p, - sizeof(p), NULL, 0); -} - -static int test_passthrough(void) -{ - /* Initial state */ - TEST_ASSERT(mock_lid == 1 && mock_pch_bklten == 0); - TEST_ASSERT(!backlight_en); - - /* Enable backlight */ - set_pch_bklten(1); - TEST_ASSERT(backlight_en); - - /* Disable backlight */ - set_pch_bklten(0); - TEST_ASSERT(!backlight_en); - - /* Enable backlight again */ - set_pch_bklten(1); - TEST_ASSERT(backlight_en); - - /* Close lid. Backlight should turn off */ - set_lid_state(0); - TEST_ASSERT(!backlight_en); - - /* Open lid. Backlight turns on */ - set_lid_state(1); - TEST_ASSERT(backlight_en); - - /* Close lid and disable backlight */ - set_lid_state(0); - set_pch_bklten(0); - TEST_ASSERT(!backlight_en); - - /* Open lid now. Backlight stays off */ - set_lid_state(1); - TEST_ASSERT(!backlight_en); - - return EC_SUCCESS; -} - -static int test_hostcommand(void) -{ - /* Open lid and enable backlight */ - set_lid_state(1); - set_pch_bklten(1); - TEST_ASSERT(backlight_en); - - /* Disable by host command */ - send_bklight_hostcmd(0); - TEST_ASSERT(!backlight_en); - - /* Close and open lid. Backlight should come up */ - set_lid_state(0); - set_lid_state(1); - TEST_ASSERT(backlight_en); - - /* Close lid and disable backlight */ - set_lid_state(0); - set_pch_bklten(0); - TEST_ASSERT(!backlight_en); - - /* Enable by host command */ - send_bklight_hostcmd(1); - TEST_ASSERT(backlight_en); - - /* Disable backlight by lid */ - set_lid_state(1); - set_lid_state(0); - TEST_ASSERT(!backlight_en); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_passthrough); - RUN_TEST(test_hostcommand); - - test_print_result(); -} diff --git a/test/bklight_passthru.tasklist b/test/bklight_passthru.tasklist deleted file mode 100644 index da0ab6211a..0000000000 --- a/test/bklight_passthru.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/body_detection.c b/test/body_detection.c deleted file mode 100644 index aa131f0a31..0000000000 --- a/test/body_detection.c +++ /dev/null @@ -1,116 +0,0 @@ -/* Copyright 2020 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. - * - * Test body_detection algorithm - */ - -#include "accelgyro.h" -#include "body_detection.h" -#include "body_detection_test_data.h" -#include "common.h" -#include "motion_common.h" -#include "motion_sense.h" -#include "test_util.h" -#include "util.h" - -static struct motion_sensor_t *sensor = &motion_sensors[BASE]; -static const int window_size = 50; /* sensor data rate (Hz) */ - -static int filler(const struct motion_sensor_t *s, const float v) -{ - int resolution = s->drv->get_resolution(s); - int data_1g = BIT(resolution - 1) / s->current_range; - - return (int)(v * data_1g / 9.8); -} - -static void feed_body_detect_data(const struct body_detect_test_data *array, - const int idx) -{ - sensor->xyz[X] = filler(sensor, array[idx].x); - sensor->xyz[Y] = filler(sensor, array[idx].y); - sensor->xyz[Z] = filler(sensor, array[idx].z); -} - -static int get_trigger_time(const struct body_detect_test_data *data, - const size_t size, - const enum body_detect_states target_state) -{ - int i, action_index = -1, target_index = -1; - - body_detect_reset(); - /* - * Clear on-body state when the window is initialized, so - * that we do not need to wait for 15 second if the testcase - * is in off-body initially. - */ - body_detect_change_state(BODY_DETECTION_OFF_BODY, false); - for (i = 0; i < size; ++i) { - enum body_detect_states motion_state; - - if (data[i].action == 1 && action_index == -1) { - cprints(CC_ACCEL, "action start"); - action_index = i; - } - feed_body_detect_data(data, i); - /* run the body detect */ - body_detect(); - /* skip if action not start yet */ - if (action_index == -1) - continue; - - motion_state = body_detect_get_state(); - if (target_index == -1 && motion_state == target_state) - target_index = i; - } - if (target_index == -1) - return -1; - return target_index - action_index; -} - -static int test_body_detect(void) -{ - int ret, trigger_time; - - ret = sensor->drv->set_data_rate(sensor, window_size * 1000, 0); - TEST_ASSERT(ret == EC_SUCCESS); - - body_detect_set_enable(true); - /* Onbody test */ - cprints(CC_ACCEL, "start OnBody test"); - trigger_time = get_trigger_time(kBodyDetectOnBodyTestData, - kBodyDetectOnBodyTestDataLength, - BODY_DETECTION_OFF_BODY); - /* It should not enter off-body state ever */ - TEST_ASSERT(trigger_time == -1); - - /* OffOn test */ - cprints(CC_ACCEL, "start Off to On test"); - trigger_time = get_trigger_time(kBodyDetectOffOnTestData, - kBodyDetectOffOnTestDataLength, - BODY_DETECTION_ON_BODY); - /* It should enter on-body state in 3 seconds */ - TEST_ASSERT(trigger_time >= 0 && trigger_time < 3 * window_size); - - /* OnOff test */ - cprints(CC_ACCEL, "start On to Off test"); - trigger_time = get_trigger_time(kBodyDetectOnOffTestData, - kBodyDetectOnOffTestDataLength, - BODY_DETECTION_OFF_BODY); - /* It should enter off-body state between 15 to 20 seconds */ - TEST_ASSERT(15 * window_size <= trigger_time && - trigger_time < 20 * window_size); - - return EC_SUCCESS; -} - - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_body_detect); - - test_print_result(); -} diff --git a/test/body_detection.tasklist b/test/body_detection.tasklist deleted file mode 100644 index 95a30e9973..0000000000 --- a/test/body_detection.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2020 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(MOTIONSENSE, motion_sense_task, NULL, TASK_STACK_SIZE) diff --git a/test/body_detection_data_literals.c b/test/body_detection_data_literals.c deleted file mode 100644 index 96a0cc2f8f..0000000000 --- a/test/body_detection_data_literals.c +++ /dev/null @@ -1,6214 +0,0 @@ -/* Copyright 2020 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 "body_detection_test_data.h" - -const struct body_detect_test_data kBodyDetectOnBodyTestData[] = { - /* x, y, z, action*/ - {3.233367f, 1.968032f, 8.875299f, 0}, - {3.190272f, 2.127247f, 9.054865f, 0}, - {3.361457f, 2.057815f, 9.054865f, 0}, - {3.377019f, 1.917754f, 9.093172f, 0}, - {3.460816f, 1.817198f, 9.058456f, 0}, - {3.500320f, 1.726218f, 8.900438f, 0}, - {3.715799f, 1.363497f, 8.836992f, 0}, - {3.883393f, 0.884657f, 8.832204f, 0}, - {3.948036f, 0.577002f, 9.016558f, 0}, - {3.600877f, 0.717063f, 9.200911f, 0}, - {3.318361f, 0.854729f, 9.166195f, 0}, - {3.272871f, 0.731428f, 9.149436f, 0}, - {3.452436f, 0.250194f, 9.297876f, 0}, - {3.817552f, -0.353144f, 9.424768f, 0}, - {3.828326f, -0.495599f, 9.284708f, 0}, - {3.312376f, -0.040701f, 9.204502f, 0}, - {3.049014f, 0.515950f, 9.223656f, 0}, - {3.099292f, 0.980425f, 8.882483f, 0}, - {3.153162f, 1.443703f, 8.154645f, 0}, - {3.501518f, 1.487995f, 8.054089f, 0}, - {4.235340f, 1.292868f, 8.480257f, 0}, - {4.284421f, 1.511937f, 8.848964f, 0}, - {3.988737f, 1.928528f, 9.149436f, 0}, - {3.825932f, 2.076969f, 9.576800f, 0}, - {3.903743f, 1.991974f, 10.133451f, 0}, - {3.841494f, 2.000354f, 10.165773f, 0}, - {3.706222f, 1.930922f, 9.649823f, 0}, - {3.949233f, 1.614888f, 9.054865f, 0}, - {4.237734f, 1.272517f, 8.625106f, 0}, - {4.188653f, 1.134851f, 8.268370f, 0}, - {4.242523f, 0.991199f, 8.091199f, 0}, - {4.157528f, 0.970848f, 8.135491f, 0}, - {3.951627f, 0.967257f, 8.353364f, 0}, - {4.073731f, 0.994790f, 8.854949f, 0}, - {3.840297f, 1.124077f, 9.249992f, 0}, - {3.736149f, 1.142033f, 9.491806f, 0}, - {3.809172f, 1.126471f, 9.651020f, 0}, - {3.987540f, 1.173158f, 9.633064f, 0}, - {4.237734f, 1.005564f, 9.467864f, 0}, - {4.308363f, 0.939724f, 9.190137f, 0}, - {4.367021f, 0.986410f, 9.021346f, 0}, - {4.406525f, 1.033097f, 9.074018f, 0}, - {4.185062f, 1.276109f, 9.235627f, 0}, - {3.971978f, 1.363497f, 9.525325f, 0}, - {4.031833f, 1.318007f, 10.833755f, 0}, - {4.214989f, 1.144428f, 10.241191f, 0}, - {4.808751f, 0.590170f, 9.690525f, 0}, - {4.697421f, 0.372298f, 10.245979f, 0}, - {4.490322f, 0.207098f, 9.682145f, 0}, - {4.353853f, 0.494402f, 8.651442f, 0}, - {3.981555f, 1.094149f, 8.230062f, 0}, - {3.933671f, 1.310825f, 8.426387f, 0}, - {4.107250f, 1.189917f, 9.068033f, 0}, - {4.529827f, 0.888248f, 9.501383f, 0}, - {4.699815f, 0.720654f, 9.765942f, 0}, - {4.661508f, 0.647631f, 9.916777f, 0}, - {4.627989f, 0.587776f, 9.925157f, 0}, - {4.413708f, 0.587776f, 9.791081f, 0}, - {4.369415f, 0.466869f, 9.840162f, 0}, - {4.412511f, 0.335188f, 9.932339f, 0}, - {4.234143f, 0.452504f, 9.502580f, 0}, - {3.817552f, 1.055842f, 8.638274f, 0}, - {3.130417f, 1.842337f, 7.748828f, 0}, - {2.511516f, 2.430113f, 7.059299f, 0}, - {2.267308f, 2.840718f, 6.742067f, 0}, - {2.082954f, 3.129220f, 6.706154f, 0}, - {1.653195f, 3.483561f, 6.813893f, 0}, - {1.053448f, 3.797201f, 7.132322f, 0}, - {0.333991f, 4.125207f, 7.364560f, 0}, - {-0.039504f, 4.228158f, 8.018176f, 0}, - {0.403423f, 3.726573f, 8.789108f, 0}, - {1.179144f, 3.120840f, 9.289496f, 0}, - {1.683123f, 2.905362f, 9.911988f, 0}, - {1.442506f, 3.038240f, 10.551240f, 0}, - {1.403001f, 2.936486f, 12.229574f, 0}, - {1.601720f, 2.541443f, 14.815310f, 0}, - {2.233789f, 2.037464f, 14.715951f, 0}, - {2.664745f, 1.736992f, 12.216406f, 0}, - {3.331529f, 1.385045f, 10.475822f, 0}, - {3.337515f, 1.235407f, 9.133873f, 0}, - {3.173512f, 1.292868f, 8.406036f, 0}, - {3.201046f, 1.462856f, 8.306677f, 0}, - {3.157950f, 1.595734f, 9.011769f, 0}, - {2.759315f, 1.777694f, 10.049655f, 0}, - {2.315192f, 2.105699f, 10.682920f, 0}, - {2.063801f, 2.375046f, 10.832559f, 0}, - {2.310403f, 2.485180f, 10.688907f, 0}, - {2.553414f, 2.606087f, 10.153803f, 0}, - {2.475603f, 2.731782f, 9.356534f, 0}, - {2.710234f, 2.529472f, 9.297876f, 0}, - {2.777272f, 2.193087f, 9.394841f, 0}, - {2.938881f, 1.920148f, 9.531310f, 0}, - {3.108869f, 1.635239f, 10.534480f, 0}, - {3.187877f, 1.425746f, 10.899596f, 0}, - {3.448845f, 1.331175f, 10.508144f, 0}, - {3.606862f, 1.470039f, 9.440331f, 0}, - {3.700236f, 1.162384f, 8.781926f, 0}, - {3.713404f, 0.864306f, 8.845372f, 0}, - {3.575738f, 0.404620f, 9.610319f, 0}, - {3.495532f, -0.130484f, 9.526522f, 0}, - {3.403355f, -0.411802f, 8.833401f, 0}, - {3.203440f, -0.380678f, 8.850161f, 0}, - {2.822762f, -0.191536f, 9.560040f, 0}, - {2.488771f, -0.459686f, 9.883258f, 0}, - {3.065773f, -0.764947f, 10.110707f, 0}, - {1.993172f, 1.004367f, 9.798264f, 0}, - {2.426522f, 1.732204f, 10.036487f, 0}, - {3.213017f, 1.238999f, 10.182533f, 0}, - {2.779666f, 2.394200f, 9.916777f, 0}, - {3.187877f, 2.622846f, 9.593559f, 0}, - {4.195836f, 1.867476f, 9.876076f, 0}, - {3.720587f, 2.114079f, 9.998179f, 0}, - {2.948457f, 2.766498f, 9.500186f, 0}, - {3.869027f, 2.822762f, 9.572012f, 0}, - {4.205412f, 2.656365f, 9.753971f, 0}, - {4.151543f, 2.828747f, 9.751576f, 0}, - {4.046198f, 2.905362f, 9.131479f, 0}, - {3.915714f, 3.032254f, 8.237246f, 0}, - {3.864239f, 3.126825f, 8.008599f, 0}, - {3.466802f, 2.999933f, 8.634683f, 0}, - {2.876631f, 2.902968f, 9.473849f, 0}, - {2.329557f, 2.899376f, 10.187322f, 0}, - {2.197876f, 3.608059f, 10.637431f, 0}, - {2.357090f, 4.205412f, 10.235206f, 0}, - {2.716220f, 4.076126f, 9.261963f, 0}, - {3.520671f, 3.847480f, 8.461103f, 0}, - {4.180274f, 3.879801f, 7.758405f, 0}, - {4.691435f, 4.034227f, 7.019794f, 0}, - {4.918884f, 3.915714f, 6.659468f, 0}, - {4.722559f, 4.205412f, 6.113590f, 0}, - {5.349840f, 4.169499f, 5.413286f, 0}, - {6.423639f, 3.742135f, 5.009864f, 0}, - {6.799528f, 3.581723f, 4.843467f, 0}, - {6.915647f, 3.337515f, 4.921278f, 0}, - {7.358574f, 3.173512f, 5.214568f, 0}, - {7.584826f, 2.861069f, 5.182246f, 0}, - {7.077255f, 2.771286f, 5.073310f, 0}, - {7.192177f, 2.306812f, 5.501872f, 0}, - {7.241258f, 2.145203f, 5.888535f, 0}, - {7.599191f, 1.898601f, 6.099225f, 0}, - {7.576446f, 2.138021f, 6.144714f, 0}, - {7.465116f, 1.962047f, 6.021413f, 0}, - {7.677002f, 1.740583f, 5.643129f, 0}, - {7.966701f, 1.648407f, 4.964374f, 0}, - {8.038527f, 1.636436f, 4.419693f, 0}, - {8.176193f, 1.582566f, 4.183865f, 0}, - {8.489834f, 1.460462f, 4.319137f, 0}, - {8.804670f, 1.314416f, 4.444832f, 0}, - {8.803473f, 1.308430f, 4.492716f, 0}, - {8.580813f, 1.392227f, 4.501096f, 0}, - {8.056483f, 1.595734f, 4.428073f, 0}, - {8.418008f, 1.316810f, 4.600455f, 0}, - {8.826219f, 1.170764f, 4.411314f, 0}, - {8.652639f, 1.201888f, 3.910926f, 0}, - {8.285130f, 0.927753f, 3.752909f, 0}, - {8.475469f, 1.027112f, 3.569752f, 0}, - {9.009375f, 0.708683f, 3.605665f, 0}, - {8.797488f, 0.600944f, 3.107672f, 0}, - {8.864526f, 0.620098f, 2.863463f, 0}, - {8.833401f, 0.214281f, 2.640803f, 0}, - {9.212882f, 0.150835f, 2.487574f, 0}, - {9.308650f, 0.226252f, 2.375046f, 0}, - {8.869314f, 0.094571f, 2.142809f, 0}, - {9.208094f, 0.002394f, 2.132035f, 0}, - {9.100354f, 0.015562f, 2.367864f, 0}, - {8.973462f, -0.011971f, 2.602495f, 0}, - {8.872906f, 0.000000f, 2.564188f, 0}, - {8.883679f, 0.092177f, 2.452858f, 0}, - {8.857343f, 0.241814f, 2.480391f, 0}, - {8.919592f, 0.371101f, 2.612072f, 0}, - {9.002192f, 0.483628f, 2.536655f, 0}, - {9.056062f, 0.521936f, 2.335542f, 0}, - {9.023740f, 0.572214f, 2.012325f, 0}, - {9.085989f, 0.592565f, 1.854308f, 0}, - {9.127888f, 0.505176f, 1.783679f, 0}, - {8.968674f, 0.653617f, 1.787270f, 0}, - {8.872906f, 0.650025f, 1.867476f, 0}, - {8.798685f, 0.628478f, 2.148795f, 0}, - {8.841781f, 0.530315f, 2.687490f, 0}, - {8.541308f, 0.642843f, 2.780863f, 0}, - {8.499411f, 0.402226f, 2.566582f, 0}, - {8.734042f, -0.217872f, 2.597707f, 0}, - {8.689749f, -0.295684f, 3.051408f, 0}, - {8.298298f, -0.123301f, 3.968387f, 0}, - {7.545321f, -0.111330f, 4.738122f, 0}, - {6.827062f, -0.112527f, 5.501872f, 0}, - {6.604401f, 0.435744f, 6.827062f, 0}, - {6.572079f, 0.610521f, 7.642287f, 0}, - {6.546940f, 0.383072f, 7.778756f, 0}, - {6.274001f, 0.530315f, 7.600388f, 0}, - {5.847834f, 1.544259f, 7.811078f, 0}, - {5.374979f, 1.781285f, 7.654258f, 0}, - {5.163093f, 1.493981f, 7.372939f, 0}, - {5.104434f, 1.314416f, 7.807487f, 0}, - {5.424060f, 0.847547f, 8.513776f, 0}, - {5.471944f, 0.817619f, 8.461103f, 0}, - {4.618412f, 1.319204f, 8.107959f, 0}, - {4.265267f, 1.634042f, 7.587220f, 0}, - {5.191823f, 1.347935f, 7.196965f, 0}, - {4.748896f, 1.868673f, 7.097606f, 0}, - {4.595667f, 1.187523f, 7.428006f, 0}, - {3.948036f, 1.272517f, 8.262384f, 0}, - {2.280476f, 1.892615f, 8.998601f, 0}, - {2.828747f, 1.725021f, 8.937549f, 0}, - {3.256112f, 1.863885f, 9.101552f, 0}, - {3.264492f, 1.679531f, 8.540112f, 0}, - {3.616439f, 1.237801f, 8.178588f, 0}, - {3.713404f, 1.492784f, 9.411600f, 0}, - {3.654746f, 1.428140f, 10.740381f, 0}, - {3.139993f, 1.246181f, 10.362098f, 0}, - {2.381032f, 1.161187f, 9.357731f, 0}, - {2.602495f, 1.027112f, 11.311399f, 0}, - {2.964020f, 1.120486f, 12.570747f, 0}, - {2.501939f, 1.344343f, 10.244782f, 0}, - {2.152386f, 1.455674f, 9.786293f, 0}, - {1.878250f, 1.450885f, 10.216052f, 0}, - {1.844731f, 1.434126f, 12.245136f, 0}, - {2.011128f, 1.198297f, 13.654123f, 0}, - {1.562216f, 1.192312f, 10.202884f, 0}, - {1.046265f, 1.596931f, 8.796291f, 0}, - {1.344343f, 1.769314f, 9.710876f, 0}, - {1.857899f, 1.845928f, 10.510538f, 0}, - {2.217029f, 1.814804f, 11.314989f, 0}, - {2.341528f, 1.612494f, 11.218024f, 0}, - {2.144006f, 1.527500f, 10.122678f, 0}, - {2.220621f, 1.271320f, 10.222037f, 0}, - {2.487574f, 0.978031f, 10.830164f, 0}, - {2.782060f, 0.950497f, 11.261120f, 0}, - {3.031057f, 0.894234f, 10.802630f, 0}, - {2.880223f, 0.992396f, 9.764745f, 0}, - {2.115276f, 1.447294f, 8.930367f, 0}, - {1.849520f, 1.715444f, 8.956702f, 0}, - {2.313994f, 1.569398f, 9.429557f, 0}, - {2.365470f, 1.504755f, 9.142253f, 0}, - {2.184708f, 1.528697f, 8.570039f, 0}, - {2.346316f, 1.491587f, 8.657428f, 0}, - {2.662350f, 1.338358f, 8.938745f, 0}, - {2.619255f, 1.200691f, 8.894453f, 0}, - {2.372652f, 1.073799f, 8.850161f, 0}, - {2.363075f, 1.012747f, 9.173378f, 0}, - {2.529472f, 1.101332f, 9.485821f, 0}, - {2.730585f, 1.132457f, 9.469061f, 0}, - {2.913742f, 1.120486f, 9.311044f, 0}, - {3.093307f, 1.151610f, 9.610319f, 0}, - {3.087321f, 1.296459f, 10.226826f, 0}, - {2.811988f, 1.377862f, 10.601518f, 0}, - {2.683898f, 1.231816f, 10.516523f, 0}, - {2.584539f, 1.250970f, 10.043670f, 0}, - {2.732979f, 1.283291f, 9.721649f, 0}, - {2.949655f, 1.004367f, 9.597151f, 0}, - {2.908953f, 0.938526f, 9.525325f, 0}, - {2.630029f, 1.124077f, 9.534902f, 0}, - {2.710234f, 0.859518f, 9.769533f, 0}, - {2.574962f, 0.883460f, 9.832980f, 0}, - {2.279279f, 1.092952f, 9.628276f, 0}, - {2.272096f, 1.016338f, 9.598348f, 0}, - {2.448070f, 0.889445f, 9.724044f, 0}, - {2.395397f, 0.984016f, 9.685737f, 0}, - {2.266110f, 1.094149f, 9.788687f, 0}, - {2.366667f, 1.074996f, 9.836571f, 0}, - {2.486377f, 1.023521f, 9.856922f, 0}, - {2.391806f, 1.103726f, 9.935930f, 0}, - {2.179919f, 1.174355f, 9.900018f, 0}, - {2.024296f, 1.203086f, 9.925157f, 0}, - {2.039858f, 1.156399f, 9.900018f, 0}, - {2.087743f, 1.066616f, 9.976632f, 0}, - {2.084151f, 0.975637f, 9.853331f, 0}, - {2.179919f, 0.985213f, 9.618699f, 0}, - {2.300826f, 1.031900f, 9.533705f, 0}, - {2.246957f, 1.083376f, 9.599545f, 0}, - {2.124853f, 0.970848f, 9.703692f, 0}, - {2.005142f, 1.036689f, 9.664188f, 0}, - {2.142809f, 1.047463f, 9.641443f, 0}, - {2.340331f, 0.885854f, 9.666583f, 0}, - {2.238577f, 0.888248f, 9.624684f, 0}, - {2.110487f, 0.960074f, 9.634261f, 0}, - {2.123656f, 1.030703f, 9.668977f, 0}, - {2.196679f, 1.061828f, 9.731226f, 0}, - {2.325965f, 0.931344f, 9.607924f, 0}, - {2.492362f, 0.841561f, 9.391250f, 0}, - {2.663548f, 0.991199f, 9.607924f, 0}, - {2.663548f, 0.933738f, 9.994588f, 0}, - {2.318783f, 0.817619f, 9.791081f, 0}, - {1.841140f, 0.946906f, 9.582786f, 0}, - {1.580172f, 1.162384f, 9.424768f, 0}, - {1.405395f, 1.210268f, 9.209291f, 0}, - {1.625662f, 1.034294f, 9.338577f, 0}, - {1.824380f, 1.120486f, 9.599545f, 0}, - {1.843534f, 1.120486f, 10.004165f, 0}, - {2.057815f, 0.648828f, 10.226826f, 0}, - {2.493559f, 0.673967f, 9.695313f, 0}, - {2.706643f, 0.766144f, 9.198517f, 0}, - {2.315192f, 0.678756f, 8.605952f, 0}, - {1.771708f, 0.752976f, 8.489834f, 0}, - {1.243787f, 0.969651f, 9.085989f, 0}, - {1.102529f, 0.957680f, 9.589969f, 0}, - {0.967257f, 0.730231f, 9.928748f, 0}, - {0.428562f, 0.812831f, 10.267527f, 0}, - {0.254982f, 1.097741f, 10.530889f, 0}, - {0.830787f, 1.238999f, 10.898398f, 0}, - {1.181538f, 1.061828f, 11.079161f, 0}, - {1.320401f, 1.142033f, 11.312595f, 0}, - {1.430535f, 0.967257f, 11.358085f, 0}, - {1.130062f, 0.909796f, 11.218024f, 0}, - {0.805648f, 0.810437f, 11.358085f, 0}, - {0.553060f, 0.751779f, 11.392801f, 0}, - {0.617704f, 0.609324f, 11.170140f, 0}, - {0.879869f, 0.511162f, 11.275485f, 0}, - {0.829590f, 0.587776f, 11.293442f, 0}, - {0.312443f, 0.672770f, 11.064795f, 0}, - {0.293290f, 0.867898f, 10.777492f, 0}, - {0.509965f, 0.920570f, 10.351324f, 0}, - {0.536301f, 1.023521f, 10.133451f, 0}, - {0.774524f, 1.107318f, 10.016136f, 0}, - {1.381453f, 0.903811f, 9.916777f, 0}, - {1.589749f, 0.810437f, 9.695313f, 0}, - {1.593340f, 0.811634f, 9.537296f, 0}, - {1.824380f, 0.887051f, 9.521733f, 0}, - {1.902192f, 0.964863f, 9.576800f, 0}, - {1.674743f, 1.398213f, 9.964661f, 0}, - {1.234210f, 1.440111f, 9.610319f, 0}, - {1.334767f, 1.115697f, 9.568420f, 0}, - {1.393424f, 1.659181f, 9.431952f, 0}, - {1.001973f, 2.656365f, 9.647429f, 0}, - {0.780509f, 3.013101f, 9.451105f, 0}, - {1.270123f, 3.008312f, 9.417586f, 0}, - {1.909375f, 3.031057f, 9.946704f, 0}, - {1.747766f, 3.309982f, 9.271540f, 0}, - {1.356314f, 3.300405f, 8.287523f, 0}, - {0.751779f, 3.156753f, 7.970292f, 0}, - {0.063446f, 3.359063f, 8.893256f, 0}, - {0.136469f, 3.002327f, 8.529338f, 0}, - {0.253785f, 3.015495f, 8.072045f, 0}, - {-0.045490f, 3.882195f, 8.609544f, 0}, - {0.149638f, 4.250902f, 9.435542f, 0}, - {1.071405f, 3.465605f, 9.838965f, 0}, - {1.856702f, 3.051408f, 11.276682f, 0}, - {2.770089f, 2.961626f, 10.789463f, 0}, - {3.514686f, 2.636014f, 7.386107f, 0}, - {3.545810f, 2.828747f, 7.304704f, 0}, - {3.815158f, 3.108869f, 6.725308f, 0}, - {3.323150f, 3.184286f, 4.733334f, 0}, - {2.572568f, 3.155556f, 6.907267f, 0}, - {3.299208f, 2.012325f, 9.501383f, 0}, - {3.531445f, 2.621649f, 8.761575f, 0}, - {4.510673f, 3.228579f, 12.022475f, 0}, - {6.127955f, 1.776496f, 13.516457f, 0}, - {5.631158f, 1.547850f, 11.772282f, 0}, - {5.889732f, -0.058658f, 7.119154f, 0}, - {4.481943f, 1.406592f, 6.591233f, 0}, - {4.230552f, 1.640027f, 9.447514f, 0}, - {4.007891f, 0.654814f, 11.417940f, 0}, - {4.525038f, 0.415394f, 11.757916f, 0}, - {4.125207f, 0.555454f, 10.915158f, 0}, - {3.624819f, 0.526724f, 9.951492f, 0}, - {3.210622f, 0.480037f, 10.086765f, 0}, - {3.298011f, 1.221042f, 9.670174f, 0}, - {3.142388f, 1.479616f, 9.212882f, 0}, - {2.955640f, 1.448491f, 8.816642f, 0}, - {3.101686f, 2.088940f, 9.536098f, 0}, - {3.215411f, 2.460041f, 9.319424f, 0}, - {3.247732f, 2.573765f, 8.180982f, 0}, - {3.251324f, 2.348710f, 8.084017f, 0}, - {3.372231f, 2.255337f, 9.076412f, 0}, - {3.545810f, 2.310403f, 9.700102f, 0}, - {3.739741f, 2.173934f, 9.156618f, 0}, - {3.809172f, 1.825577f, 9.087187f, 0}, - {3.727770f, 1.434126f, 9.709679f, 0}, - {3.596088f, 1.175552f, 10.115496f, 0}, - {3.452436f, 1.128865f, 9.888046f, 0}, - {3.217805f, 1.009155f, 9.366111f, 0}, - {3.197454f, 1.152807f, 9.042893f, 0}, - {3.360260f, 1.312022f, 8.710100f, 0}, - {3.630804f, 1.417366f, 8.561660f, 0}, - {3.858253f, 1.345540f, 8.723268f, 0}, - {4.018665f, 1.070207f, 9.018951f, 0}, - {4.181470f, 0.847547f, 9.135071f, 0}, - {4.359838f, 0.720654f, 9.123099f, 0}, - {4.487928f, 0.720654f, 9.082398f, 0}, - {4.380189f, 0.676362f, 9.085989f, 0}, - {4.357444f, 0.766144f, 9.149436f, 0}, - {4.260479f, 0.820014f, 8.944732f, 0}, - {4.271253f, 0.809240f, 9.156618f, 0}, - {4.315546f, 0.563834f, 9.089581f, 0}, - {4.484337f, 0.366313f, 8.816642f, 1}, - {4.460395f, 0.489614f, 8.925578f, 0}, - {4.448424f, 0.270545f, 9.436740f, 0}, - {4.559754f, 0.149638f, 9.291890f, 0}, - {4.551374f, 0.318429f, 8.737633f, 0}, - {4.523841f, 0.301669f, 8.877694f, 0}, - {4.411314f, 0.075417f, 9.094369f, 0}, - {4.203018f, -0.062249f, 9.162603f, 0}, - {4.171894f, -0.029928f, 8.957899f, 0}, - {4.235340f, -0.195127f, 9.186545f, 0}, - {4.386175f, -0.499191f, 9.753971f, 0}, - {4.505885f, -0.679953f, 10.381251f, 0}, - {4.586090f, -0.547075f, 10.471034f, 0}, - {4.892548f, -0.622492f, 9.931142f, 0}, - {5.498281f, -0.993593f, 9.714467f, 0}, - {5.907689f, -1.383848f, 9.782701f, 0}, - {6.193796f, -1.279700f, 9.963464f, 0}, - {6.526589f, -1.408987f, 8.862131f, 0}, - {6.619963f, -2.099714f, 7.775165f, 0}, - {6.324279f, -2.311600f, 7.964306f, 0}, - {5.984303f, -2.063801f, 9.196122f, 0}, - {5.639538f, -1.571792f, 8.735239f, 0}, - {5.276817f, -1.029506f, 7.680594f, 0}, - {5.011061f, -0.629675f, 7.769179f, 0}, - {4.618412f, -0.131681f, 8.444344f, 0}, - {4.189850f, 0.440533f, 8.780728f, 0}, - {4.214989f, 1.012747f, 8.608346f, 0}, - {4.211398f, 1.684320f, 8.520958f, 0}, - {4.193441f, 2.132035f, 9.264358f, 0}, - {4.256888f, 2.742556f, 9.690525f, 0}, - {4.542994f, 3.782836f, 9.542085f, 0}, - {5.335475f, 4.732136f, 8.649048f, 0}, - {5.679042f, 5.600034f, 7.328646f, 0}, - {5.938813f, 6.015428f, 5.878958f, 0}, - {5.702984f, 5.841848f, 3.946839f, 0}, - {5.978318f, 4.942826f, 2.680307f, 0}, - {6.204569f, 4.444832f, 3.429692f, 0}, - {6.102816f, 4.230552f, 4.288013f, 0}, - {6.244074f, 4.173091f, 4.954797f, 0}, - {6.355404f, 3.830720f, 5.212173f, 0}, - {7.004232f, 3.655943f, 4.850649f, 0}, - {7.965504f, 2.867055f, 4.497505f, 0}, - {8.603558f, 3.070562f, 4.267662f, 0}, - {9.105143f, 4.338291f, 4.809948f, 0}, - {8.657428f, 4.848255f, 3.834311f, 0}, - {7.819458f, 5.075704f, 0.330400f, 0}, - {7.815866f, 5.650312f, -3.190272f, 0}, - {7.144293f, 6.502647f, -10.860091f, 0}, - {7.374136f, 4.941629f, -7.758405f, 0}, - {8.832204f, 3.672703f, 0.448913f, 0}, - {9.153027f, 3.536233f, 0.270545f, 0}, - {8.880088f, 4.343079f, 0.025139f, 0}, - {8.923183f, 4.811145f, -0.472855f, 0}, - {9.080004f, 4.722559f, -0.604536f, 0}, - {9.029726f, 4.490322f, -0.079009f, 0}, - {9.149436f, 4.181470f, -0.168791f, 0}, - {9.192532f, 4.162317f, -0.488417f, 0}, - {9.105143f, 4.446030f, -0.647631f, 0}, - {9.289496f, 4.550177f, -0.691924f, 0}, - {9.198517f, 4.359838f, -0.305261f, 0}, - {8.995009f, 4.213792f, 0.192733f, 0}, - {8.955505f, 4.545389f, -0.177171f, 0}, - {8.451527f, 5.149924f, -1.136048f, 0}, - {7.418429f, 5.443214f, 0.033519f, 0}, - {6.846215f, 5.254072f, 2.087743f, 0}, - {7.192177f, 4.586090f, 3.452436f, 0}, - {7.727281f, 3.658338f, 3.614045f, 0}, - {8.420402f, 3.105278f, 2.424128f, 0}, - {9.446317f, 2.968808f, 1.719036f, 0}, - {9.706087f, 2.862266f, 2.051830f, 0}, - {9.520536f, 2.778469f, 2.466026f, 0}, - {9.439134f, 2.862266f, 3.065773f, 0}, - {8.769955f, 3.287237f, 3.415326f, 0}, - {8.048103f, 3.784033f, 2.977188f, 0}, - {7.817063f, 3.926488f, 1.849520f, 0}, - {8.365335f, 3.857056f, 0.901416f, 0}, - {8.749604f, 3.778048f, 0.855927f, 0}, - {7.741646f, 4.425679f, 1.212662f, 0}, - {6.775586f, 5.135559f, 1.638830f, 0}, - {7.811078f, 4.550177f, 3.052605f, 0}, - {8.285130f, 4.247311f, 3.077744f, 0}, - {8.590390f, 4.511870f, 2.555809f, 0}, - {8.787911f, 4.813539f, 2.319980f, 0}, - {8.252808f, 4.928461f, 1.952470f, 0}, - {7.679397f, 4.880577f, 1.568201f, 0}, - {7.946350f, 4.525038f, 1.531091f, 0}, - {8.236049f, 4.353853f, 1.537076f, 0}, - {8.593981f, 4.235340f, 1.843534f, 0}, - {8.511381f, 4.062957f, 1.691502f, 0}, - {8.268370f, 4.389766f, 1.649604f, 0}, - {8.129506f, 5.080492f, 1.691502f, 0}, - {8.280341f, 5.632356f, 1.444900f, 0}, - {8.936352f, 5.948390f, 1.972821f, 0}, - {10.184927f, 5.974726f, 3.705025f, 0}, - {11.186900f, 5.440820f, 3.477576f, 0}, - {11.239573f, 4.985922f, 1.543062f, 0}, - {11.077964f, 4.748896f, 1.107318f, 0}, - {10.912764f, 4.514264f, 1.528697f, 0}, - {10.890019f, 3.810369f, 1.624465f, 0}, - {9.329000f, 2.948457f, 1.057039f, 0}, - {7.509408f, 2.424128f, 1.201888f, 0}, - {7.207739f, 1.965638f, 1.035492f, 0}, - {7.030569f, 1.936908f, 0.076614f, 0}, - {6.907267f, 2.347513f, -0.646434f, 0}, - {7.483072f, 2.871843f, -0.088585f, 0}, - {8.190558f, 3.590103f, 1.675940f, 0}, - {8.498213f, 3.961204f, 1.974018f, 0}, - {8.552083f, 3.774457f, 1.284488f, 0}, - {8.402445f, 3.895364f, 2.099714f, 0}, - {8.273158f, 4.100068f, 2.432507f, 0}, - {8.030147f, 4.141966f, 1.668757f, 0}, - {7.900860f, 4.010285f, 1.027112f, 0}, - {7.912831f, 3.936065f, 0.803254f, 0}, - {7.878115f, 4.007891f, 0.687135f, 0}, - {7.789530f, 4.050986f, 0.326808f, 0}, - {8.213304f, 3.869027f, 0.050278f, 0}, - {8.558068f, 3.667914f, 0.016759f, 0}, - {8.617923f, 3.523065f, 0.405817f, 0}, - {8.524549f, 3.506306f, 0.683544f, 0}, - {8.438358f, 3.640381f, 0.433350f, 0}, - {8.262384f, 3.952824f, 0.190339f, 0}, - {8.115141f, 4.276042f, 0.306458f, 0}, - {8.386883f, 4.367021f, 0.554257f, 0}, - {8.827415f, 4.244917f, 0.985213f, 0}, - {9.200911f, 4.337093f, 0.806845f, 0}, - {10.524903f, 4.668690f, -0.792480f, 0}, - {11.640601f, 4.612426f, -1.328781f, 0}, - {11.060007f, 4.495111f, -0.488417f, 0}, - {9.582786f, 5.093661f, 0.833182f, 0}, - {9.582786f, 5.696999f, 1.917754f, 0}, - {10.176547f, 5.428849f, 1.911769f, 0}, - {10.186124f, 5.148727f, 2.031479f, 0}, - {9.921565f, 4.803962f, 2.525881f, 0}, - {9.082398f, 3.547007f, 2.503136f, 0}, - {8.127112f, 2.201467f, 3.013101f, 0}, - {8.121126f, 2.080560f, 3.895364f, 0}, - {7.538139f, 3.345895f, 3.219002f, 0}, - {7.010218f, 3.763683f, 2.015916f, 0}, - {7.691368f, 3.278857f, 1.988383f, 0}, - {9.029726f, 2.555809f, 2.470814f, 0}, - {9.815023f, 2.255337f, 1.878250f, 0}, - {9.594757f, 2.603693f, 0.724246f, 0}, - {8.785517f, 3.135205f, 0.660799f, 0}, - {8.186967f, 3.447648f, 1.098938f, 0}, - {7.940364f, 3.257309f, 1.605311f, 0}, - {7.721295f, 2.911347f, 1.705868f, 0}, - {7.763194f, 2.804805f, 1.307233f, 0}, - {8.137886f, 2.965217f, 1.130062f, 0}, - {8.329422f, 3.266886f, 1.200691f, 0}, - {8.224077f, 3.472787f, 1.547850f, 0}, - {7.841005f, 3.687068f, 1.614888f, 0}, - {7.527365f, 4.015073f, 1.435323f, 0}, - {7.979869f, 4.304772f, 1.449688f, 0}, - {6.466734f, 4.948812f, 0.798466f, 0}, - {5.912477f, 5.204991f, 0.487220f, 0}, - {8.413219f, 5.108026f, 3.270477f, 0}, - {9.945507f, 5.396527f, 3.342303f, 0}, - {10.691300f, 5.128376f, 2.308009f, 0}, - {10.842135f, 4.801568f, 1.601720f, 0}, - {9.938325f, 4.821919f, 1.177946f, 0}, - {8.507790f, 4.671084f, 1.237801f, 0}, - {8.838189f, 4.602849f, 2.097319f, 0}, - {10.510538f, 4.817131f, 2.170342f, 0}, - {12.216406f, 4.753684f, 1.561018f, 0}, - {12.654545f, 3.897758f, 0.378284f, 0}, - {11.204856f, 1.860294f, -0.105345f, 0}, - {8.844175f, 0.367510f, 1.064222f, 0}, - {7.511803f, 0.355539f, 1.830366f, 0}, - {7.447159f, 0.761356f, 1.376665f, 0}, - {7.492649f, 1.477221f, 1.074996f, 0}, - {7.439977f, 1.969230f, 1.636436f, 0}, - {8.178588f, 2.361878f, 2.212241f, 0}, - {9.138661f, 2.566582f, 3.772062f, 0}, - {8.628697f, 3.113657f, 5.457579f, 0}, - {7.310690f, 3.958810f, 4.115630f, 0}, - {6.605598f, 3.852268f, -0.732625f, 0}, - {7.333435f, 2.907756f, -0.568623f, 0}, - {7.597994f, 2.693475f, 1.482010f, 0}, - {7.583629f, 2.049435f, 0.691924f, 0}, - {9.470259f, 0.593762f, -0.951695f, 0}, - {10.658978f, 0.784101f, -0.517147f, 0}, - {10.287878f, 1.835154f, 0.626083f, 0}, - {9.807840f, 2.612072f, 1.288080f, 0}, - {8.984236f, 2.947260f, 0.714669f, 0}, - {8.761575f, 2.649182f, -0.256179f, 0}, - {8.923183f, 2.196679f, -0.543483f, 0}, - {8.926775f, 1.908177f, -0.259771f, 0}, - {8.783123f, 2.282870f, 0.343568f, 0}, - {8.637076f, 2.968808f, 0.847547f, 0}, - {9.196122f, 2.409762f, 1.001973f, 0}, - {10.965436f, 2.219424f, -0.040701f, 0}, - {12.228376f, 2.415748f, -2.486377f, 0}, - {11.583140f, 2.370258f, -2.585736f, 0}, - {10.394420f, 2.659956f, -0.113724f, 0}, - {9.483426f, 3.004721f, 1.859096f, 0}, - {9.071624f, 3.149570f, 2.835930f, 0}, - {9.080004f, 3.254915f, 3.105278f, 0}, - {9.205699f, 3.192666f, 3.260900f, 0}, - {9.168590f, 2.627635f, 3.888181f, 0}, - {8.310268f, 1.988383f, 3.989934f, 0}, - {6.813893f, 1.753752f, 3.471590f, 0}, - {6.712140f, 1.843534f, 3.975569f, 0}, - {7.686579f, 1.092952f, 4.849452f, 0}, - {8.225274f, -0.057461f, 5.044580f, 0}, - {9.645035f, -1.168370f, 5.014652f, 0}, - {10.184927f, -1.946485f, 5.219356f, 0}, - {9.691722f, -2.285264f, 4.790794f, 0}, - {9.776716f, -2.582145f, 4.147952f, 0}, - {9.946704f, -2.756921f, 3.651155f, 0}, - {9.209291f, -2.138021f, 3.199848f, 0}, - {8.215697f, -1.181538f, 2.749739f, 0}, - {7.557292f, -0.480037f, 2.457646f, 0}, - {7.584826f, -0.227449f, 2.263716f, 0}, - {8.142674f, 0.092177f, 1.337161f, 0}, - {8.587996f, 0.541089f, -0.260968f, 0}, - {9.088384f, 0.393846f, -1.416169f, 0}, - {9.514551f, 0.010774f, -0.566228f, 0}, - {9.374491f, 0.046687f, 0.678756f, 0}, - {9.302665f, 0.275333f, 0.553060f, 0}, - {9.515748f, 0.501585f, 0.005986f, 0}, - {9.652218f, 0.667982f, -0.077812f, 0}, - {9.983814f, 0.775721f, 0.123301f, 0}, - {10.466246f, 0.855927f, 0.921767f, 0}, - {11.034868f, 0.636857f, 1.392227f, 0}, - {11.848896f, -0.166397f, 0.960074f, 0}, - {12.391183f, -1.085770f, 0.053870f, 0}, - {12.482162f, -1.602917f, -0.912190f, 0}, - {12.077542f, -1.947682f, -1.058236f, 0}, - {11.311399f, -1.833957f, -0.653617f, 0}, - {10.664965f, -1.778891f, 0.350750f, 0}, - {9.764745f, -2.568977f, 2.135627f, 0}, - {8.580813f, -3.081336f, 2.833536f, 0}, - {7.436386f, -2.665942f, 2.202664f, 0}, - {6.769601f, -1.289277f, 2.110487f, 0}, - {7.038948f, 0.441730f, 3.216608f, 0}, - {8.155843f, 1.883038f, 4.080914f, 0}, - {9.284708f, 1.380256f, 3.860648f, 0}, - {9.452302f, -0.167594f, 2.287658f, 0}, - {9.560040f, -0.761356f, 0.659602f, 0}, - {9.497791f, -0.784101f, -0.830787f, 0}, - {9.290693f, -0.700303f, -1.665166f, 0}, - {8.920790f, -0.146046f, -1.515529f, 0}, - {8.766363f, 0.034716f, -0.599747f, 0}, - {8.348576f, -0.287304f, -0.076614f, 0}, - {8.081622f, -0.591367f, 0.045490f, 0}, - {7.095212f, -1.157596f, 1.143231f, 0}, - {6.483494f, -1.507149f, 0.781706f, 0}, - {6.980290f, -1.605311f, 0.519541f, 0}, - {8.282735f, -1.045068f, 1.046265f, 0}, - {7.284354f, -1.468842f, 0.658405f, 0}, - {8.409628f, -2.402580f, -0.105345f, 0}, - {10.058035f, -2.456449f, 2.020705f, 0}, - {11.830939f, -2.476800f, 2.808397f, 0}, - {12.722779f, -1.401804f, 0.846350f, 0}, - {11.550818f, -0.071826f, -3.417721f, 0}, - {10.788265f, -0.575805f, -7.012612f, 0}, - {10.037683f, -1.229422f, -8.307875f, 0}, - {9.273934f, -0.415394f, -6.815091f, 0}, - {9.394841f, 0.909796f, -5.343854f, 0}, - {8.586799f, 1.194706f, -2.789243f, 0}, - {8.435964f, 0.617704f, -0.373495f, 0}, - {8.913607f, -0.415394f, 0.533907f, 0}, - {8.986629f, -1.616085f, 0.727837f, 0}, - {8.663413f, -2.105699f, 1.237801f, 0}, - {8.337802f, -2.239774f, 1.921346f, 0}, - {8.827415f, -2.661153f, 2.705446f, 0}, - {9.233232f, -3.117249f, 3.457225f, 0}, - {9.272737f, -2.991553f, 3.994723f, 0}, - {8.706509f, -2.610875f, 4.343079f, 0}, - {7.984657f, -2.519896f, 4.351459f, 0}, - {8.218092f, -3.441663f, 4.805160f, 0}, - {9.825797f, -4.513067f, 4.161120f, 0}, - {10.711651f, -6.089648f, 4.596864f, 0}, - {11.142607f, -7.103591f, 3.855859f, 0}, - {10.658978f, -6.648694f, 3.931277f, 0}, - {10.046063f, -5.696999f, 4.780020f, 0}, - {9.539690f, -4.680661f, 5.057748f, 0}, - {7.566869f, -3.590103f, 4.860226f, 0}, - {6.440398f, -3.344697f, 4.193441f, 0}, - {6.586444f, -3.541022f, 3.108869f, 0}, - {7.125139f, -3.699039f, 0.994790f, 0}, - {8.431175f, -4.952403f, -2.618058f, 0}, - {9.090777f, -5.112814f, -7.767982f, 0}, - {8.908818f, -3.330332f, -9.904806f, 0}, - {8.309072f, -1.798044f, -7.811078f, 0}, - {8.213304f, -1.308430f, -7.665031f, 0}, - {8.283933f, -1.283291f, -4.946417f, 0}, - {8.704114f, -1.482010f, -1.357511f, 0}, - {8.904030f, -1.138442f, -0.214281f, 0}, - {9.314635f, -1.148019f, -0.150835f, 0}, - {9.588771f, -0.961271f, -1.286883f, 0}, - {9.983814f, -0.888248f, -3.894166f, 0}, - {10.663767f, -0.937329f, -6.470325f, 0}, - {11.098314f, -0.972045f, -6.862975f, 0}, - {10.899596f, -1.125274f, -5.509054f, 0}, - {10.278301f, -1.490390f, -3.240550f, 0}, - {9.907200f, -1.777694f, -0.620098f, 0}, - {8.779531f, -2.339134f, 1.922543f, 0}, - {7.435188f, -2.651577f, 4.188653f, 0}, - {6.859383f, -2.463632f, 5.175064f, 0}, - {6.631934f, -2.347513f, 5.786782f, 0}, - {6.870157f, -2.407368f, 6.654679f, 0}, - {7.872130f, -2.549823f, 6.404485f, 0}, - {9.375688f, -3.722981f, 3.958810f, 0}, - {11.268303f, -5.311533f, -0.108936f, 0}, - {12.009308f, -6.212949f, -5.847834f, 0}, - {10.462654f, -5.131968f, -11.382027f, 0}, - {7.885298f, -2.762907f, -11.698062f, 0}, - {7.011415f, -1.878250f, -9.295482f, 0}, - {6.627146f, -1.376665f, -6.520604f, 0}, - {7.509408f, -1.753752f, -3.491941f, 0}, - {8.297100f, -1.997960f, -0.979228f, 0}, - {8.939943f, -1.666363f, -0.052672f, 0}, - {8.857343f, -0.831985f, 0.451307f, 0}, - {8.007402f, -0.197522f, 1.444900f, 0}, - {7.693762f, 0.035913f, 3.700236f, 0}, - {7.378925f, -0.505176f, 3.415326f, 0}, - {5.979515f, -1.707065f, -0.325611f, 0}, - {7.726084f, -3.241747f, -5.707773f, 0}, - {8.884876f, -3.162738f, -12.425899f, 0}, - {9.512156f, 0.045490f, -13.029237f, 0}, - {8.766363f, 1.078587f, -6.048946f, 0}, - {8.428782f, -0.650025f, -1.023521f, 0}, - {8.790305f, -0.999579f, 1.993172f, 0}, - {9.354139f, -0.804451f, 2.904165f, 0}, - {10.168168f, -1.060631f, -0.969651f, 0}, - {11.595111f, -1.048660f, -4.067746f, 0}, - {13.030434f, -0.831985f, -6.460749f, 0}, - {11.122256f, 0.191536f, -7.928393f, 0}, - {9.040500f, 0.798466f, -6.001062f, 0}, - {8.956702f, 0.328005f, -1.649604f, 0}, - {9.064442f, 0.119710f, 0.561440f, 0}, - {9.356534f, 0.306458f, 0.186748f, 0}, - {10.399208f, -0.664391f, -0.585382f, 0}, - {11.281470f, -1.975215f, -2.223015f, 0}, - {10.011348f, -1.996763f, -4.955994f, 0}, - {9.003389f, -2.169145f, -6.757630f, 0}, - {8.583207f, -2.082954f, -5.573698f, 0}, - {8.798685f, -1.921346f, -2.810791f, 0}, - {8.974659f, -1.520317f, -1.250970f, 0}, - {8.078031f, -0.515950f, 0.366313f, 0}, - {6.692986f, 0.751779f, 2.220621f, 0}, - {6.210555f, 1.480813f, 1.197100f, 0}, - {7.131125f, 0.602141f, -2.041055f, 0}, - {8.007402f, 0.234632f, -4.835087f, 0}, - {8.462300f, 0.919373f, -5.451593f, 0}, - {7.928393f, 1.326387f, -4.395751f, 0}, - {6.871354f, 1.467645f, -2.835930f, 0}, - {6.029793f, 1.558624f, -0.976834f, 0}, - {5.135559f, 1.978806f, 0.028730f, 0}, - {7.839808f, 1.517923f, 0.440533f, 0}, - {11.483781f, 0.501585f, -0.684741f, 0}, - {9.314635f, 0.493205f, -3.245338f, 0}, - {8.585602f, 0.633266f, -4.395751f, 0}, - {9.229641f, 0.914584f, -4.349064f, 0}, - {9.064442f, 0.970848f, -3.658338f, 0}, - {9.977829f, 0.555454f, -2.989159f, 0}, - {9.810235f, 0.744596f, -3.434480f, 0}, - {9.325409f, 1.397016f, -3.568555f, 0}, - {9.496594f, 1.741781f, -3.239353f, 0}, - {10.398011f, 1.367088f, -3.130417f, 0}, - {10.730804f, 0.985213f, -2.704249f, 0}, - {10.894808f, 1.125274f, -1.823183f, 0}, - {11.997336f, 0.918176f, -2.120064f, 0}, - {12.749115f, 0.508767f, -3.248930f, 0}, - {12.022475f, 0.416591f, -3.471590f, 0}, - {10.839741f, 0.440533f, -5.136756f, 0}, - {10.629051f, 0.883460f, -8.376109f, 0}, - {11.104300f, 1.051054f, -8.720874f, 0}, - {10.903187f, 0.842758f, -5.995077f, 0}, - {11.470613f, 0.239420f, -2.959231f, 0}, - {11.871641f, -0.373495f, -0.988805f, 0}, - {9.727634f, -0.487220f, 1.842337f, 0}, - {6.479902f, -0.034716f, 3.007115f, 0}, - {4.198230f, 0.515950f, 3.420115f, 0}, - {2.959231f, 1.742978f, 3.507503f, 0}, - {3.488349f, 2.468420f, 2.369061f, 0}, - {5.433637f, 2.197876f, -2.054224f, 0}, - {6.564897f, 2.667139f, -4.945220f, 0}, - {7.331040f, 3.190272f, -2.327163f, 0}, - {10.497370f, 3.070562f, 0.073023f, 0}, - {10.967831f, 1.744175f, -2.159569f, 0}, - {10.575182f, 0.481234f, -3.937262f, 0}, - {10.111904f, 0.632069f, -2.493559f, 0}, - {9.317030f, 1.003170f, -0.973242f, 0}, - {8.687355f, 1.310825f, -0.208295f, 0}, - {8.713691f, 1.209071f, -0.918176f, 0}, - {8.810657f, 1.183932f, -2.063801f, 0}, - {8.763969f, 1.406592f, -2.553414f, 0}, - {8.019373f, 1.916557f, -2.993947f, 0}, - {7.505817f, 2.184708f, -3.209425f, 0}, - {7.550110f, 2.245760f, -2.833536f, 0}, - {7.843400f, 2.250548f, -2.468420f, 0}, - {8.210909f, 2.315192f, -2.410959f, 0}, - {8.468286f, 2.409762f, -3.126825f, 0}, - {8.376109f, 2.358287f, -3.925291f, 0}, - {8.769955f, 2.191890f, -3.524262f, 0}, - {9.360126f, 2.389412f, -3.094504f, 0}, - {10.235206f, 2.645591f, -4.356247f, 0}, - {10.369281f, 3.308784f, -5.960361f, 0}, - {9.583982f, 3.739741f, -6.137532f, 0}, - {9.226050f, 3.244141f, -4.029438f, 0}, - {9.249992f, 3.345895f, -1.376665f, 0}, - {9.409206f, 3.989934f, 0.690727f, 0}, - {9.866499f, 4.723757f, 1.246181f, 0}, - {11.179717f, 3.829523f, -0.788889f, 0}, - {12.655742f, 2.403777f, -3.202243f, 0}, - {12.897555f, 0.988805f, -4.781218f, 0}, - {11.311399f, 0.092177f, -4.595667f, 0}, - {8.464694f, 0.628478f, -2.196679f, 0}, - {6.581656f, 1.258152f, -0.107739f, 0}, - {6.366178f, 1.856702f, 0.781706f, 0}, - {6.930012f, 1.881841f, 0.209493f, 0}, - {7.776362f, 0.798466f, -0.858321f, 0}, - {8.432373f, -0.011971f, -1.729810f, 0}, - {8.836992f, -0.251391f, -2.906559f, 0}, - {8.950717f, -0.007183f, -3.992329f, 0}, - {8.702917f, 0.239420f, -3.590103f, 0}, - {8.307875f, 0.493205f, -2.304418f, 0}, - {7.890086f, 1.065419f, -1.701079f, 0}, - {7.886495f, 1.557427f, -1.941696f, 0}, - {8.344984f, 1.771708f, -2.163160f, 0}, - {8.882483f, 2.037464f, -2.286461f, 0}, - {8.996207f, 2.401383f, -2.816776f, 0}, - {9.011769f, 2.549823f, -3.086124f, 0}, - {9.118311f, 2.431310f, -3.043028f, 0}, - {9.022543f, 2.371455f, -3.132811f, 0}, - {8.949520f, 2.278081f, -3.059788f, 0}, - {9.159013f, 2.190693f, -2.688687f, 0}, - {9.372096f, 2.074574f, -2.284067f, 0}, - {9.406812f, 2.118867f, -1.695094f, 0}, - {9.403221f, 2.088940f, -1.282094f, 0}, - {9.539690f, 2.345119f, -1.448491f, 0}, - {9.548070f, 2.826353f, -2.069786f, 0}, - {9.326607f, 3.178301f, -2.748542f, 0}, - {9.295482f, 3.290828f, -2.521093f, 0}, - {10.214854f, 3.190272f, -2.946063f, 0}, - {11.439487f, 3.104080f, -4.429270f, 0}, - {12.179296f, 2.619255f, -5.501872f, 0}, - {12.650953f, 1.750160f, -4.109644f, 0}, - {11.921919f, 0.913387f, -1.047463f, 0}, - {10.370478f, 0.256179f, 0.997184f, 0}, - {9.369702f, -0.351947f, 2.355893f, 0}, - {7.855371f, -0.039504f, 2.788046f, 0}, - {6.522998f, 0.343568f, 1.185129f, 0}, - {6.356601f, 0.954089f, -0.673967f, 0}, - {6.839033f, 1.606508f, -1.197100f, 0}, - {8.453920f, 1.814804f, -0.993593f, 0}, - {9.556450f, 1.889024f, -0.434547f, 0}, - {9.387658f, 2.385820f, -0.804451f, 0}, - {9.039303f, 2.761710f, -1.951273f, 0}, - {8.828612f, 2.579751f, -2.316389f, 0}, - {8.649048f, 2.282870f, -2.097319f, 0}, - {8.495819f, 2.323571f, -1.842337f, 0}, - {8.274356f, 2.814382f, -1.483207f, 0}, - {8.022964f, 3.214214f, -1.207874f, 0}, - {7.991840f, 3.224988f, -1.155202f, 0}, - {8.200135f, 3.023875f, -1.380256f, 0}, - {8.465892f, 2.995144f, -1.857899f, 0}, - {8.471877f, 3.099292f, -2.273293f, 0}, - {8.388080f, 3.125628f, -2.305615f, 0}, - {8.433570f, 3.105278f, -2.064998f, 0}, - {8.494622f, 3.213017f, -1.946485f, 0}, - {8.669398f, 3.210622f, -2.211044f, 0}, - {8.773546f, 3.099292f, -2.907756f, 0}, - {8.705312f, 3.130417f, -3.394976f, 0}, - {8.570039f, 3.405750f, -1.821986f, 0}, - {8.820233f, 3.371034f, -1.948879f, 0}, - {9.376884f, 3.290828f, -4.145557f, 0}, - {9.933537f, 3.511094f, -5.504266f, 0}, - {10.266330f, 3.343500f, -4.606441f, 0}, - {10.199292f, 3.286040f, -2.880223f, 0}, - {10.279498f, 3.457225f, -2.645591f, 0}, - {10.939100f, 3.313573f, -3.344697f, 0}, - {11.617856f, 1.872265f, -3.330332f, 0}, - {11.283865f, 0.302866f, -2.816776f, 0}, - {8.844175f, 0.647631f, -0.970848f, 0}, - {6.621161f, 1.608902f, 0.426168f, 0}, - {6.217738f, 2.564188f, 0.738611f, 0}, - {6.973108f, 3.286040f, -0.644040f, 0}, - {8.750801f, 2.173934f, -1.210268f, 0}, - {10.366886f, 0.428562f, -1.189917f, 0}, - {10.743973f, 0.110133f, -1.969230f, 0}, - {10.110707f, 0.746990f, -2.530669f, 0}, - {8.839387f, 1.630450f, -2.548626f, 0}, - {7.795516f, 2.329557f, -2.692278f, 0}, - {7.451948f, 2.700658f, -2.602495f, 0}, - {7.606374f, 2.907756f, -2.309206f, 0}, - {8.056483f, 3.023875f, -2.039858f, 0}, - {8.440752f, 3.139993f, -1.945288f, 0}, - {8.403643f, 3.387793f, -1.736992f, 0}, - {8.280341f, 3.640381f, -1.544259f, 0}, - {8.359349f, 3.767274f, -1.551442f, 0}, - {8.535323f, 3.780442f, -1.817198f, 0}, - {8.860934f, 3.679886f, -2.035070f, 0}, - {9.190137f, 3.599680f, -2.019508f, 0}, - {9.193728f, 3.535036f, -2.249351f, 0}, - {8.997404f, 3.507503f, -2.041055f, 0}, - {8.646653f, 3.554190f, -1.903389f, 0}, - {8.368926f, 3.604468f, -1.539471f, 0}, - {8.249216f, 3.761288f, -1.181538f, 0}, - {8.482651f, 3.960007f, -1.823183f, 0}, - {8.767561f, 3.967190f, -2.565385f, 0}, - {8.783123f, 3.831917f, -3.102883f, 0}, - {8.614332f, 3.810369f, -3.654746f, 0}, - {8.664610f, 3.786427f, -4.390963f, 0}, - {8.987827f, 4.016271f, -5.419272f, 0}, - {9.724044f, 4.271253f, -6.058523f, 0}, - {10.873260f, 3.715799f, -6.293155f, 0}, - {12.078739f, 3.123234f, -5.191823f, 0}, - {12.312174f, 2.310403f, -2.348710f, 0}, - {11.079161f, 1.405395f, 1.435323f, 0}, - {9.323015f, 1.150413f, 2.363075f, 0}, - {7.666229f, 0.990002f, 1.956061f, 0}, - {6.414062f, 1.784876f, 2.576159f, 0}, - {5.781993f, 3.196257f, 2.535458f, 0}, - {6.141123f, 3.886984f, 0.312443f, 0}, - {7.559687f, 3.445254f, -1.547850f, 0}, - {9.400826f, 2.853886f, -1.867476f, 0}, - {9.509763f, 3.022678f, -3.046620f, 0}, - {8.577222f, 3.954021f, -4.252100f, 0}, - {8.172602f, 3.744529f, -3.657140f, 0}, - {8.269567f, 3.207031f, -2.509122f, 0}, - {8.135491f, 3.442860f, -1.326387f, 0}, - {7.990643f, 3.718193f, -0.969651f, 0}, - {8.020570f, 3.763683f, -1.307233f, 0}, - {8.246822f, 3.590103f, -1.707065f, 0}, - {8.331817f, 3.252521f, -1.964441f, 0}, - {8.212107f, 2.896982f, -2.375046f, 0}, - {8.174996f, 2.774878f, -2.712629f, 0}, - {8.511381f, 2.673124f, -2.576159f, 0}, - {8.957899f, 2.570174f, -2.475603f, 0}, - {9.176969f, 2.637211f, -2.371455f, 0}, - {9.011769f, 2.729388f, -2.279279f, 0}, - {8.756786f, 2.636014f, -2.651577f, 0}, - {8.678975f, 2.534261f, -3.602074f, 0}, - {8.603558f, 2.598904f, -3.883393f, 0}, - {8.331817f, 2.859872f, -3.414129f, 0}, - {8.225274f, 3.234564f, -3.913320f, 0}, - {8.254004f, 3.434480f, -4.692632f, 0}, - {7.493846f, 3.796004f, -4.635171f, 0}, - {7.006627f, 4.036621f, -3.604468f, 0}, - {6.774389f, 4.210201f, -2.053027f, 0}, - {7.364560f, 4.368218f, -1.525105f, 0}, - {9.597151f, 3.620030f, -1.552639f, 0}, - {11.402378f, 1.831563f, -2.977188f, 0}, - {12.288232f, 0.525527f, -4.697421f, 0}, - {11.234784f, 0.181959f, -4.031833f, 0}, - {9.607924f, 0.386663f, -1.760934f, 0}, - {9.303862f, 0.387860f, -0.899022f, 0}, - {9.464272f, 0.622492f, -1.006761f, 0}, - {9.558844f, 1.036689f, -1.015141f, 0}, - {9.920368f, 0.829590f, -1.874659f, 0}, - {10.107116f, 0.355539f, -3.119643f, 0}, - {9.897623f, -0.099359f, -4.199427f, 0}, - {9.185349f, -0.276530f, -4.827904f, 0}, - {8.003811f, 0.396240f, -4.807554f, 0}, - {7.156264f, 0.701501f, -5.153516f, 0}, - {7.101197f, 0.053870f, -4.508279f, 0}, - {7.503423f, -0.792480f, -3.005918f, 0}, - {8.105564f, -1.297656f, -1.985989f, 0}, - {8.426387f, -1.464053f, -1.731007f, 0}, - {8.543703f, -1.358709f, -1.970427f, 0}, - {8.645456f, -1.344343f, -2.333148f, 0}, - {8.863329f, -1.558624f, -2.579751f, 0}, - {8.951914f, -1.918951f, -3.125628f, 0}, - {8.690947f, -1.860294f, -3.743332f, 0}, - {8.432373f, -1.956061f, -4.167105f, 0}, - {8.066060f, -2.053027f, -4.120419f, 0}, - {7.721295f, -2.195482f, -3.816355f, 0}, - {8.643063f, -2.871843f, -3.706222f, 0}, - {9.257174f, -3.336318f, -3.749317f, 0}, - {8.542506f, -3.499123f, -4.060563f, 0}, - {7.796712f, -4.046198f, -3.117249f, 0}, - {9.125494f, -4.362233f, -1.403001f, 0}, - {10.022121f, -4.328714f, 0.181959f, 0}, - {9.467864f, -4.274844f, 0.749385f, 0}, - {8.961491f, -3.708616f, -0.160411f, 0}, - {9.466667f, -3.045423f, -1.674743f, 0}, - {10.119086f, -2.406171f, -2.686292f, 0}, - {10.562014f, -1.898601f, -3.098095f, 0}, - {10.864880f, -1.751357f, -2.885011f, 0}, - {11.161760f, -1.505952f, -2.561794f, 0}, - {11.179717f, -1.201888f, -3.112460f, 0}, - {10.089159f, -1.221042f, -4.156332f, 0}, - {7.001838f, -0.794874f, -3.333924f, 0}, - {5.855016f, -0.556652f, -2.070983f, 0}, - {5.731715f, -0.816422f, -1.926134f, 0}, - {5.664677f, -0.999579f, -2.529472f, 0}, - {5.078098f, -0.949300f, -3.558978f, 0}, - {4.414905f, -0.963666f, -4.428073f, 0}, - {4.523841f, -1.501163f, -5.098449f, 0}, - {4.826707f, -2.104502f, -5.495886f, 0}, - {5.408498f, -2.646788f, -4.911702f, 0}, - {7.024583f, -3.204637f, -3.964795f, 0}, - {8.048103f, -3.580526f, -2.898179f, 0}, - {8.647851f, -4.011482f, -2.421733f, 0}, - {8.653836f, -3.981555f, -2.619255f, 0}, - {8.593981f, -3.761288f, -2.304418f, 0}, - {9.291890f, -3.605665f, -1.768117f, 0}, - {10.421953f, -3.653549f, -2.403777f, 0}, - {10.747564f, -4.040213f, -3.653549f, 0}, - {11.080358f, -4.187456f, -3.568555f, 0}, - {11.591519f, -4.479548f, -3.045423f, 0}, - {12.521667f, -4.991907f, -3.197454f, 0}, - {12.606661f, -5.301956f, -3.508700f, 0}, - {12.215209f, -5.559332f, -3.132811f, 0}, - {11.514905f, -5.664677f, -2.713826f, 0}, - {10.378858f, -5.208582f, -2.182313f, 0}, - {9.202108f, -4.546586f, -1.216254f, 0}, - {8.280341f, -4.206610f, -0.418985f, 0}, - {7.450751f, -4.313151f, 0.014365f, 0}, - {7.369348f, -4.450818f, 0.191536f, 0}, - {7.760799f, -4.636368f, 0.500388f, 0}, - {8.317451f, -4.886562f, 0.723048f, 0}, - {9.074018f, -4.566936f, 1.207874f, 0}, - {9.854527f, -4.408919f, 1.930922f, 0}, - {9.587574f, -3.520671f, 2.163160f, 0}, - {7.569263f, -1.774102f, 2.106896f, 0}, - {6.695381f, -1.079784f, 3.076547f, 0}, - {6.536166f, -1.090558f, 2.916136f, 0}, - {7.067678f, -1.138442f, 1.533485f, 0}, - {8.107959f, -0.973242f, -2.732979f, 0}, - {9.166195f, -1.021126f, -7.004232f, 0}, - {9.587574f, -1.686714f, -7.388502f, 0}, - {9.416389f, -1.589749f, -5.742489f, 0}, - {8.761575f, -1.954864f, -2.201467f, 0}, - {8.656230f, -2.102108f, -0.766144f, 0}, - {8.858541f, -2.230197f, -0.316034f, 0}, - {9.175772f, -2.531867f, 0.506373f, 0}, - {9.725241f, -2.759315f, 1.114500f, 0}, - {10.110707f, -2.782060f, 0.573411f, 0}, - {9.934733f, -2.370258f, 0.377087f, 0}, - {9.617501f, -2.214635f, -0.361524f, 0}, - {9.494201f, -2.189496f, -1.580172f, 0}, - {9.704890f, -2.115276f, -2.446872f, 0}, - {9.459484f, -2.057815f, -2.561794f, 0}, - {9.435542f, -2.030282f, -2.092531f, 0}, - {9.346957f, -1.996763f, -1.692699f, 0}, - {9.319424f, -2.132035f, -1.470039f, 0}, - {9.446317f, -2.430113f, -1.489192f, 0}, - {9.703692f, -2.687490f, -1.851914f, 0}, - {9.847345f, -2.719811f, -2.027887f, 0}, - {9.732423f, -2.558203f, -2.355893f, 0}, - {9.549267f, -2.409762f, -2.292447f, 0}, - {9.601939f, -2.473209f, -1.733401f, 0}, - {9.971844f, -2.697066f, -1.748963f, 0}, - {10.626657f, -3.017889f, -1.353920f, 0}, - {11.123453f, -3.641578f, -1.219845f, 0}, - {11.133030f, -4.373006f, -1.596931f, 0}, - {10.457866f, -4.733334f, -2.841915f, 0}, - {9.214079f, -4.768049f, -3.096898f, 0}, - {7.812275f, -4.437650f, -1.672349f, 0}, - {6.750447f, -4.045001f, 0.490811f, 0}, - {6.290761f, -3.907335f, 1.800438f, 0}, - {6.235694f, -4.234143f, 1.041477f, 0}, - {7.199359f, -4.850649f, -2.310403f, 0}, - {8.538915f, -4.039015f, -3.203440f, 0}, - {9.186545f, -2.800017f, -4.298786f, 0}, - {9.197320f, -2.372652f, -4.565740f, 0}, - {9.024938f, -1.969230f, -4.732136f, 0}, - {8.607149f, -1.534682f, -4.993104f, 0}, - {7.957124f, -1.502361f, -4.132390f, 0}, - {7.705733f, -1.678334f, -2.855083f, 0}, - {7.752420f, -1.753752f, -1.508346f, 0}, - {8.034935f, -1.557427f, -0.313640f, 0}, - {7.546519f, -1.106120f, 0.447715f, 0}, - {6.752841f, -0.906205f, 1.265335f, 0}, - {6.906070f, -1.195903f, 1.750160f, 0}, - {7.101197f, -1.496375f, 1.381453f, 0}, - {7.223301f, -1.824380f, 0.837970f, 0}, - {7.374136f, -2.153583f, 0.274136f, 0}, - {7.323858f, -2.404974f, -0.490811f, 0}, - {7.491452f, -2.598904f, -1.482010f, 0}, - {7.899663f, -2.819170f, -2.953246f, 0}, - {8.497016f, -3.117249f, -4.119221f, 0}, - {9.168590f, -3.533839f, -6.064509f, 0}, - {9.417586f, -3.632001f, -6.847412f, 0}, - {9.738409f, -3.272871f, -6.969516f, 0}, - {9.919171f, -2.809594f, -6.331462f, 0}, - {9.987406f, -2.677913f, -4.316743f, 0}, - {9.593559f, -2.616861f, -3.142388f, 0}, - {9.325409f, -2.674321f, -3.335121f, 0}, - {9.167392f, -2.829944f, -3.014298f, 0}, - {9.194925f, -3.105278f, -2.008734f, 0}, - {9.613911f, -3.459619f, -2.535458f, 0}, - {10.720031f, -4.271253f, -3.035846f, 0}, - {11.372450f, -5.182246f, -2.151189f, 0}, - {10.842135f, -5.142742f, -0.895431f, 0}, - {9.220064f, -4.575316f, 0.703895f, 0}, - {7.491452f, -4.206610f, 1.714247f, 0}, - {6.665453f, -4.437650f, 2.238577f, 0}, - {7.479481f, -4.993104f, 3.179498f, 0}, - {8.750801f, -5.791570f, 2.965217f, 0}, - {9.563632f, -6.527786f, 1.649604f, 0}, - {9.215276f, -6.408076f, 0.693121f, 0}, - {8.240837f, -5.831074f, -0.050278f, 0}, - {7.832625f, -5.178655f, -0.134075f, 0}, - {6.849806f, -4.006694f, 0.402226f, 0}, - {6.220132f, -3.184286f, -0.293290f, 0}, - {6.138729f, -3.074153f, 0.524330f, 0}, - {7.079649f, -3.414129f, -1.236604f, 0}, - {7.497437f, -3.640381f, -2.803608f, 0}, - {7.586023f, -3.466802f, -3.118446f, 0}, - {7.608768f, -3.038240f, -3.612848f, 0}, - {7.706930f, -2.804805f, -3.219002f, 0}, - {7.848188f, -2.905362f, -3.991132f, 0}, - {8.244428f, -3.093307f, -4.150346f, 0}, - {8.699326f, -2.829944f, -4.168303f, 0}, - {8.613134f, -2.391806f, -3.326741f, 0}, - {8.754393f, -2.479194f, -2.382229f, 0}, - {9.027331f, -2.700658f, -2.299629f, 0}, - {9.117114f, -2.700658f, -2.309206f, 0}, - {9.198517f, -2.815579f, -1.631647f, 0}, - {9.265554f, -2.861069f, -0.093374f, 0}, - {9.057259f, -2.791637f, 0.238223f, 0}, - {9.398433f, -2.922121f, 0.565031f, 0}, - {9.453499f, -2.892194f, 0.474052f, 0}, - {9.267948f, -2.750936f, 0.118513f, 0}, - {9.593559f, -2.905362f, 0.064643f, 0}, - {9.916777f, -3.290828f, 0.547075f, 0}, - {9.968252f, -3.573344f, 0.733822f, 0}, - {10.299849f, -4.295195f, -2.195482f, 0}, - {10.365689f, -5.293576f, -3.512291f, 0}, - {10.035290f, -6.093239f, -3.232170f, 0}, - {9.386461f, -5.595245f, -0.808043f, 0}, - {7.836217f, -5.037397f, -1.355117f, 0}, - {7.586023f, -4.918884f, -0.707486f, 0}, - {8.003811f, -5.001484f, -1.582566f, 0}, - {8.651442f, -5.248086f, -3.233367f, 0}, - {8.804670f, -4.791991f, -2.944866f, 0}, - {7.832625f, -3.906137f, -2.813185f, 0}, - {6.901282f, -3.084927f, -2.161963f, 0}, - {6.792346f, -2.578553f, -1.455674f, 0}, - {7.048525f, -2.341528f, -1.499966f, 0}, - {7.358574f, -2.551020f, -1.587355f, 0}, - {7.480678f, -2.724600f, -2.063801f, 0}, - {7.368151f, -2.518698f, -1.176749f, 0}, - {7.399275f, -2.738965f, -1.344343f, 0}, - {7.823049f, -2.987962f, -1.318007f, 0}, - {7.832625f, -2.798820f, -1.460462f, 0}, - {7.547716f, -2.303221f, -1.837548f, 0}, - {7.366954f, -2.001551f, -2.175131f, 0}, - {7.653060f, -2.163160f, -2.703052f, 0}, - {7.995431f, -2.481588f, -3.134008f, 0}, - {8.619121f, -2.681504f, -3.325544f, 0}, - {8.935155f, -2.726994f, -4.122813f, 0}, - {9.391250f, -2.748542f, -4.546586f, 0}, - {9.763548f, -2.730585f, -4.378992f, 0}, - {10.044867f, -2.233789f, -5.177458f, 0}, - {10.336959f, -2.200270f, -5.360614f, 0}, - {10.339353f, -2.786849f, -4.867409f, 0}, - {10.545254f, -3.339909f, -4.352656f, 0}, - {10.761930f, -3.875013f, -3.894166f, 0}, - {10.625460f, -4.471169f, -3.217805f, 0}, - {9.902411f, -4.558557f, -2.613269f, 0}, - {8.913607f, -3.739741f, -1.416169f, 0}, - {8.100776f, -3.011904f, 1.066616f, 0}, - {7.064087f, -3.003524f, 3.325544f, 0}, - {6.754038f, -3.834311f, 5.176260f, 0}, - {7.175417f, -4.786006f, 7.241258f, 0}, - {7.382516f, -5.288788f, 6.618766f, 0}, - {8.252808f, -5.669466f, 4.605244f, 0}, - {9.193728f, -6.020216f, 2.553414f, 0}, - {9.549267f, -5.853819f, 0.247800f, 0}, - {8.914804f, -5.385753f, -0.512359f, 0}, - {8.572433f, -4.914096f, -1.824380f, 0}, - {8.161828f, -3.992329f, -3.460816f, 0}, - {7.699748f, -2.631226f, -3.369837f, 0}, - {7.472299f, -2.184708f, -1.789665f, 0}, - {7.617147f, -2.147598f, -1.602917f, 0}, - {7.779953f, -1.984792f, -1.983595f, 0}, - {8.039723f, -1.725021f, -2.574962f, 0}, - {8.286326f, -1.487995f, -2.779666f, 0}, - {8.273158f, -1.437717f, -2.838324f, 0}, - {8.219289f, -1.659181f, -2.960428f, 0}, - {8.444344f, -1.786073f, -2.853886f, 0}, - {8.597572f, -1.544259f, -2.703052f, 0}, - {8.681370f, -1.361103f, -2.530669f, 0}, - {8.962687f, -1.437717f, -2.333148f, 0}, - {9.131479f, -1.589749f, -1.939302f, 0}, - {9.050076f, -1.765723f, -1.616085f, 0}, - {9.041697f, -1.929725f, -1.650801f, 0}, - {9.260766f, -2.108093f, -1.804030f, 0}, - {9.653415f, -2.413354f, -2.396594f, 0}, - {9.742000f, -2.288855f, -1.392227f, 0}, - {9.372096f, -1.877053f, -0.934935f, 0}, - {9.860513f, -2.138021f, -1.429337f, 0}, - {10.694892f, -2.595313f, -1.260546f, 0}, - {11.317384f, -2.925713f, -0.727837f, 0}, - {11.739960f, -3.251324f, -0.887051f, 0}, - {11.595111f, -3.508700f, -2.597707f, 0}, - {10.346536f, -4.009088f, -4.683055f, 0}, - {9.039303f, -4.310757f, -4.425679f, 0}, - {8.474271f, -4.114433f, -2.164357f, 0}, - {8.452724f, -3.538628f, -0.290895f, 0}, - {8.659822f, -3.467999f, 0.682347f, 0}, - {8.937549f, -3.530248f, 0.061052f, 0}, - {8.566448f, -2.431310f, -0.852335f, 0}, - {8.067257f, -1.312022f, -1.903389f, 0}, - {8.377306f, -1.103726f, -1.419761f, 0}, - {8.070848f, -1.212662f, -2.258928f, 0}, - {8.067257f, -1.584960f, -2.608481f, 0}, - {7.800304f, -1.910572f, -3.106475f, 0}, - {7.347800f, -2.184708f, -3.384202f, 0}, - {7.348997f, -2.264913f, -2.862266f, 0}, - {7.765588f, -2.091334f, -1.757343f, 0}, - {7.970292f, -1.810015f, -1.043871f, 0}, - {8.240837f, -1.757343f, -0.768538f, 0}, - {8.485045f, -1.801636f, -0.395043f, 0}, - {8.564054f, -1.716641f, -0.083797f, 0}, - {8.844175f, -1.758540f, -0.086191f, 0}, - {9.075215f, -1.959653f, -0.597353f, 0}, - {9.182955f, -2.019508f, -1.362300f, 0}, - {9.318227f, -2.041055f, -1.719036f, 0}, - {9.363716f, -2.062603f, -2.341528f, 0}, - {9.173378f, -1.891418f, -2.298432f, 0}, - {9.066835f, -1.715444f, -2.759315f, 0}, - {9.272737f, -1.723824f, -2.409762f, 0}, - {9.367308f, -1.574187f, -1.908177f, 0}, - {9.205699f, -1.302445f, -1.863885f, 0}, - {9.190137f, -1.492784f, -1.729810f, 0}, - {9.236824f, -1.769314f, -1.782482f, 0}, - {9.534902f, -2.070983f, -2.035070f, 0}, - {10.097539f, -2.543838f, -1.827972f, 0}, - {10.522510f, -2.759315f, -2.231395f, 0}, - {10.928327f, -2.730585f, -2.249351f, 0}, - {11.123453f, -2.719811f, -1.364694f, 0}, - {10.806222f, -2.395397f, -0.016759f, 0}, - {9.789884f, -1.911769f, 0.586579f, 0}, - {8.809459f, -2.251745f, 0.070629f, 0}, - {8.212107f, -3.077744f, 0.161609f, 0}, - {8.462300f, -3.548204f, 1.023521f, 0}, - {8.960294f, -3.872619f, 1.528697f, 0}, - {9.425965f, -4.192245f, 1.470039f, 0}, - {9.999376f, -4.453212f, 1.244984f, 0}, - {9.986209f, -4.420890f, 0.696712f, 0}, - {9.368505f, -4.025847f, 0.286107f, 0}, - {8.735239f, -3.618833f, 0.021548f, 0}, - {8.062469f, -3.245338f, -0.644040f, 0}, - {7.747632f, -2.964020f, -1.055842f, 0}, - {7.532154f, -2.788046f, -0.582988f, 0}, - {7.694959f, -2.956837f, -0.339976f, 0}, - {8.044512f, -3.439268f, -0.831985f, 0}, - {8.398854f, -3.869027f, -1.472433f, 0}, - {8.674187f, -3.954021f, -1.877053f, 0}, - {8.778335f, -3.669111f, -1.696291f, 0}, - {8.744816f, -3.325544f, -2.801214f, 0}, - {9.170983f, -3.161541f, -2.974794f, 0}, - {8.848964f, -2.875434f, -3.779245f, 0}, - {8.207318f, -2.503136f, -4.129995f, 0}, - {8.026556f, -2.263716f, -4.618412f, 0}, - {8.368926f, -2.215832f, -4.732136f, 0}, - {8.961491f, -2.413354f, -3.232170f, 0}, - {9.333789f, -2.713826f, -1.446097f, 0}, - {9.246401f, -2.952049f, -0.226252f, 0}, - {8.790305f, -2.959231f, 0.460884f, 0}, - {8.155843f, -2.730585f, 0.590170f, 0}, - {7.708127f, -2.560597f, 0.263362f, 0}, - {7.612359f, -2.658759f, 0.471657f, 0}, - {8.567645f, -3.356668f, 0.718260f, 0}, - {10.579970f, -4.683055f, 1.223436f, 0}, - {12.627011f, -5.783190f, 2.347513f, 0}, - {11.851291f, -5.154713f, 2.021902f, 0}, - {8.839387f, -3.144782f, -3.478773f, 0}, - {8.154645f, -3.208228f, -8.307875f, 0}, - {9.410403f, -4.708194f, -0.691924f, 0}, - {9.804249f, -4.711786f, 1.703473f, 0}, - {9.985011f, -4.288013f, -2.111685f, 0}, - {9.917974f, -3.863042f, -0.809240f, 0}, - {9.002192f, -3.196257f, -0.214281f, 0}, - {8.477862f, -2.410959f, -0.794874f, 0}, - {8.450329f, -1.956061f, -0.992396f, 0}, - {8.361744f, -1.842337f, -1.545456f, 0}, - {8.178588f, -1.766920f, -1.849520f, 0}, - {8.061272f, -1.640027f, -2.190693f, 0}, - {7.553701f, -1.369482f, -2.219424f, 0}, - {7.180206f, -1.359906f, -2.621649f, 0}, - {7.414838f, -1.776496f, -3.306390f, 0}, - {7.927197f, -1.954864f, -3.851071f, 0}, - {8.195347f, -1.989580f, -4.341882f, 0}, - {8.341393f, -2.115276f, -4.428073f, 0}, - {8.359349f, -2.343922f, -4.118024f, 0}, - {8.401248f, -2.454055f, -3.053802f, 0}, - {8.487439f, -2.311600f, -2.007537f, 0}, - {8.573630f, -2.114079f, -1.933317f, 0}, - {8.593981f, -2.120064f, -2.171540f, 0}, - {8.409628f, -2.209847f, -2.895785f, 0}, - {8.107959f, -2.146400f, -2.240971f, 0}, - {8.183376f, -1.910572f, -1.847125f, 0}, - {8.455117f, -1.956061f, -1.793256f, 0}, - {8.859737f, -2.144006f, -2.002748f, 0}, - {9.208094f, -2.382229f, -2.218226f, 0}, - {9.277525f, -2.410959f, -2.454055f, 0}, - {9.018951f, -2.202664f, -2.607284f, 0}, - {8.807065f, -1.917754f, -3.163935f, 0}, - {8.732844f, -1.766920f, -3.756500f, 0}, - {8.488636f, -1.750160f, -3.998314f, 0}, - {8.299495f, -1.744175f, -3.921700f, 0}, - {8.184573f, -1.738189f, -3.780442f, 0}, - {8.080425f, -1.723824f, -3.687068f, 0}, - {7.970292f, -1.810015f, -3.618833f, 0}, - {7.970292f, -1.811212f, -3.657140f, 0}, - {7.902057f, -1.886630f, -3.809172f, 0}, - {8.113944f, -2.105699f, -4.045001f, 0}, - {8.355759f, -2.325965f, -3.809172f, 0}, - {8.410825f, -2.215832f, -3.554190f, 0}, - {8.657428f, -2.017113f, -3.271674f, 0}, - {8.823824f, -2.086545f, -2.360681f, 0}, - {8.422796f, -2.122458f, -1.601720f, 0}, - {8.717282f, -1.810015f, -1.653195f, 0}, - {9.615108f, -1.516726f, -1.790862f, 0}, - {9.629473f, -1.593340f, -3.891772f, 0}, - {10.530889f, -2.082954f, -6.175839f, 0}, - {10.994166f, -2.302023f, -4.498702f, 0}, - {9.297876f, -1.614888f, -3.004721f, 0}, - {7.264003f, -0.905008f, -0.735019f, 0}, - {7.615951f, -1.219845f, 0.140061f, 0}, - {8.942337f, -1.484404f, -0.383072f, 0}, - {10.296257f, -2.246957f, -0.167594f, 0}, - {11.376041f, -2.970005f, 0.173579f, 0}, - {10.957057f, -2.890997f, -0.011971f, 0}, - {10.125072f, -2.902968f, -0.169988f, 0}, - {9.543282f, -2.770089f, -0.092177f, 0}, - {9.082398f, -2.452858f, 0.432153f, 0}, - {8.699326f, -1.927331f, 0.356736f, 0}, - {8.416810f, -1.535879f, 0.282516f, 0}, - {7.886495f, -0.933738f, -0.872686f, 0}, - {8.098382f, -0.636857f, 1.728612f, 0}, - {8.451527f, -0.509965f, 1.399410f, 0}, - {9.103946f, -0.675164f, 0.752976f, 0}, - {9.591166f, -0.895431f, 0.257377f, 0}, - {9.684539f, -0.997184f, -0.475249f, 0}, - {9.461879f, -0.949300f, -0.150835f, 0}, - {9.260766f, -0.992396f, -0.387860f, 0}, - {9.248795f, -1.278503f, -0.785298f, 0}, - {9.558844f, -1.503558f, -0.909796f, 0}, - {10.126269f, -1.493981f, -0.755370f, 0}, - {10.194504f, -1.428140f, -0.456095f, 0}, - {10.286680f, -1.380256f, -0.415394f, 0}, - {10.317805f, -1.411381f, -0.383072f, 0}, - {10.150211f, -1.398213f, -0.389058f, 0}, - {9.968252f, -1.315613f, -0.265756f, 0}, - {9.878469f, -1.361103f, -0.398634f, 0}, - {9.900018f, -1.498769f, -0.544681f, 0}, - {9.877273f, -1.466448f, -1.072602f, 0}, - {9.799460f, -1.371877f, -1.558624f, 0}, - {9.544478f, -1.285685f, -1.635239f, 0}, - {9.278723f, -1.120486f, -1.229422f, 0}, - {9.204502f, -1.103726f, -0.731428f, 0}, - {9.202108f, -1.182735f, -0.477643f, 0}, - {9.107537f, -1.255758f, 0.050278f, 0}, - {8.898045f, -1.216254f, 0.428562f, 0}, - {8.766363f, -1.130062f, 0.016759f, 0}, - {8.706509f, -1.060631f, -0.681150f, 0}, - {8.720874f, -1.039083f, -1.149216f, 0}, - {9.220064f, -1.296459f, -1.238999f, 0}, - {10.467443f, -1.696291f, -0.963666f, 0}, - {11.536453f, -1.877053f, -1.309627f, 0}, - {11.785450f, -1.964441f, -2.002748f, 0}, - {11.763902f, -2.772484f, -3.430889f, 0}, - {11.314989f, -3.549402f, -5.012258f, 0}, - {9.746788f, -3.913320f, -4.704603f, 0}, - {8.693340f, -4.775232f, -3.177104f, 0}, - {8.215697f, -5.501872f, -1.019929f, 0}, - {7.824246f, -5.450397f, 0.652420f, 0}, - {7.545321f, -4.419693f, 0.913387f, 0}, - {7.720098f, -3.350683f, -0.903811f, 0}, - {7.936773f, -2.221818f, -3.144782f, 0}, - {8.151054f, -1.693897f, -4.214989f, 0}, - {7.918817f, -1.904586f, -3.973175f, 0}, - {7.843400f, -2.130838f, -3.676294f, 0}, - {7.507014f, -2.142809f, -2.937684f, 0}, - {7.426809f, -2.203861f, -2.422930f, 0}, - {7.520183f, -2.273293f, -2.515107f, 0}, - {7.607571f, -2.073377f, -2.264913f, 0}, - {7.933182f, -1.736992f, -2.202664f, 0}, - {8.366532f, -1.519120f, -2.388215f, 0}, - {8.694537f, -1.306036f, -2.293644f, 0}, - {8.757984f, -1.061828f, -1.953667f, 0}, - {8.790305f, -1.007958f, -1.453279f, 0}, - {8.921987f, -1.209071f, -0.818816f, 0}, - {8.914804f, -1.312022f, -0.050278f, 0}, - {8.711297f, -1.246181f, 0.578199f, 0}, - {8.656230f, -1.249772f, 0.275333f, 0}, - {8.939943f, -1.387439f, -0.482431f, 0}, - {9.241612f, -1.586158f, -0.899022f, 0}, - {9.497791f, -1.592143f, -1.055842f, 0}, - {9.671371f, -1.361103f, -1.174355f, 0}, - {9.715664f, -1.000776f, -1.108515f, 0}, - {9.829389f, -0.665588f, -1.197100f, 0}, - {9.860513f, -0.462081f, -1.599326f, 0}, - {9.821009f, -0.490811f, -2.014719f, 0}, - {9.856922f, -0.694318f, -2.319980f, 0}, - {10.049655f, -1.024718f, -2.524684f, 0}, - {10.514130f, -1.493981f, -1.921346f, 0}, - {10.843332f, -1.666363f, -1.532288f, 0}, - {11.147395f, -1.837548f, -1.659181f, 0}, - {11.727989f, -2.455252f, -1.991974f, 0}, - {12.029658f, -3.106475f, -0.149638f, 0}, - {10.973816f, -3.138796f, 2.298432f, 0}, - {9.229641f, -2.894588f, 2.509122f, 0}, - {8.149857f, -2.712629f, 1.924937f, 0}, - {7.643484f, -3.005918f, 1.844731f, 0}, - {7.934379f, -3.333924f, 1.647210f, 0}, - {8.604755f, -3.669111f, 1.010352f, 0}, - {9.069230f, -3.952824f, 0.132878f, 0}, - {9.255978f, -3.986343f, -0.216675f, 0}, - {9.123099f, -3.824735f, 0.580594f, 0}, - {8.698129f, -3.511094f, 0.641646f, 0}, - {8.346182f, -3.187877f, 1.156399f, 0}, - {8.060075f, -2.959231f, 1.389833f, 0}, - {7.915226f, -2.890997f, 1.458068f, 0}, - {8.005008f, -3.084927f, 1.079784f, 0}, - {7.953533f, -3.286040f, -0.043096f, 0}, - {8.371321f, -3.442860f, -2.762907f, 0}, - {8.309072f, -3.312376f, -4.205412f, 0}, - {8.149857f, -2.729388f, -3.705025f, 0}, - {7.922408f, -2.109290f, -3.027466f, 0}, - {7.881707f, -1.766920f, -3.349486f, 0}, - {7.872130f, -1.252167f, -4.329911f, 0}, - {8.201332f, -0.677559f, -3.967190f, 0}, - {8.599967f, -0.760159f, -3.022678f, 0}, - {8.785517f, -1.183932f, -2.488771f, 0}, - {9.235627f, -1.813607f, -1.701079f, 0}, - {9.714467f, -2.225409f, -0.598550f, 0}, - {9.683342f, -2.312797f, 0.444124f, 0}, - {9.585180f, -2.341528f, 0.554257f, 0}, - {9.459484f, -2.260125f, 0.377087f, 0}, - {9.476244f, -2.183511f, 0.265756f, 0}, - {9.752774f, -2.238577f, 0.000000f, 0}, - {10.631446f, -2.571371f, 0.381875f, 0}, - {11.678908f, -2.847901f, 1.048660f, 0}, - {11.956635f, -2.754527f, 1.926134f, 0}, - {11.179717f, -2.287658f, 1.643618f, 0}, - {9.974237f, -1.684320f, -0.531512f, 0}, - {9.130282f, -1.295262f, 0.968454f, 0}, - {8.774743f, -0.958877f, 1.218648f, 0}, - {8.473074f, -0.690727f, 1.455674f, 0}, - {8.464694f, -0.987608f, 0.141258f, 0}, - {9.175772f, -1.808818f, -3.797201f, 0}, - {10.365689f, -2.500742f, -9.164998f, 0}, - {10.453077f, -1.736992f, -3.761288f, 0}, - {9.622290f, -0.969651f, 0.599747f, 0}, - {8.990221f, -0.987608f, -4.253296f, 0}, - {9.148238f, -1.395819f, -3.313573f, 0}, - {8.651442f, -1.607705f, -1.174355f, 0}, - {7.994234f, -1.643618f, -0.547075f, 0}, - {7.620739f, -1.555033f, -0.290895f, 0}, - {7.387304f, -1.526303f, -0.118513f, 0}, - {7.176615f, -1.487995f, -0.105345f, 0}, - {7.222105f, -1.329978f, -0.065841f, 0}, - {7.553701f, -1.047463f, -0.521936f, 0}, - {7.945153f, -0.768538f, -0.612915f, 0}, - {8.386883f, -0.518344f, -0.260968f, 0}, - {8.783123f, -0.316034f, -0.155623f, 0}, - {9.229641f, -0.201113f, -0.294487f, 0}, - {9.470259f, -0.234632f, -0.818816f, 0}, - {9.665385f, -0.349553f, -0.980425f, 0}, - {9.798264f, -0.347159f, -0.960074f, 0}, - {9.586377f, -0.480037f, -1.021126f, 0}, - {9.587574f, -0.565031f, -0.806845f, 0}, - {9.617501f, -0.590170f, -0.330400f, 0}, - {9.609122f, -0.484826f, 0.050278f, 0}, - {9.691722f, -0.368707f, 0.562637f, 0}, - {9.884455f, -0.318429f, 1.296459f, 0}, - {9.916777f, -0.286107f, 1.254561f, 0}, - {10.086765f, -0.414197f, 0.605733f, 0}, - {10.672147f, -0.663193f, -0.056264f, 0}, - {11.547227f, -0.732625f, -1.089361f, 0}, - {12.741933f, -0.981622f, -1.647210f, 0}, - {13.311752f, -1.082178f, -2.098516f, 0}, - {12.233165f, -1.091755f, -1.170764f, 0}, - {9.745591f, -1.782482f, -1.260546f, 0}, - {6.040567f, -2.230197f, -1.437717f, 0}, - {5.289985f, -2.487574f, 0.503979f, 0}, - {6.959939f, -3.001130f, 3.216608f, 0}, - {8.799882f, -4.107250f, 4.249705f, 0}, - {9.941916f, -4.839875f, 4.045001f, 0}, - {9.454696f, -5.104434f, 3.131614f, 0}, - {8.892059f, -5.509054f, 1.795650f, 0}, - {7.688973f, -5.981909f, 0.606930f, 0}, - {7.673411f, -6.725308f, 0.831985f, 0}, - {8.412022f, -7.346603f, 0.257377f, 0}, - {8.220486f, -6.330265f, -0.105345f, 0}, - {7.586023f, -4.578907f, 0.073023f, 0}, - {7.775165f, -3.556584f, -1.447294f, 0}, - {8.498213f, -3.017889f, -4.783612f, 0}, - {8.949520f, -2.546232f, -4.119221f, 0}, - {8.564054f, -2.585736f, -1.102529f, 0}, - {7.644681f, -3.087321f, -0.313640f, 0}, - {8.555674f, -2.998736f, -0.015562f, 0}, - {9.572012f, -2.636014f, -0.071826f, 0}, - {8.997404f, -2.252942f, 1.218648f, 0}, - {7.629118f, -1.496375f, 0.980425f, 0}, - {7.766785f, -1.379059f, 1.416169f, 0}, - {8.343787f, -1.787270f, 1.284488f, 0}, - {8.748407f, -1.811212f, 0.870292f, 0}, - {9.136268f, -2.027887f, 1.131260f, 0}, - {9.615108f, -2.226606f, 1.380256f, 0}, - {10.127466f, -2.141612f, 0.444124f, 0}, - {10.301045f, -1.841140f, -0.062249f, 0}, - {10.163380f, -1.441308f, -2.595313f, 0}, - {9.898820f, -1.045068f, 1.595734f, 0}, - {9.682145f, -1.219845f, 2.372652f, 0}, - {10.177745f, -1.084573f, 1.078587f, 0}, - {11.180914f, -0.885854f, 0.757764f, 0}, - {12.489345f, -1.234210f, 2.330754f, 0}, - {13.658912f, -2.050632f, 2.142809f, 0}, - {13.063952f, -2.145203f, -0.293290f, 0}, - {9.628276f, -1.520317f, -2.880223f, 0}, - {6.360192f, -1.479616f, -3.886984f, 0}, - {5.079296f, -1.917754f, -2.090137f, 0}, - {6.202175f, -3.551796f, -0.855927f, 0}, - {7.969095f, -4.886562f, -0.975637f, 0}, - {11.101906f, -4.876986f, 0.645237f, 0}, - {11.766296f, -4.067746f, 0.531512f, 0}, - {10.569196f, -3.503912f, -0.644040f, 0}, - {10.237599f, -3.076547f, -0.447715f, 0}, - {9.629473f, -2.752133f, -0.193930f, 0}, - {8.340196f, -1.911769f, -0.742202f, 0}, - {7.272383f, -1.003170f, -1.213859f, 0}, - {6.823470f, -0.739808f, -1.057039f, 0}, - {7.050919f, -0.673967f, -0.834379f, 0}, - {7.595600f, -0.442927f, -0.532710f, 0}, - {8.060075f, -0.168791f, -0.527921f, 0}, - {8.573630f, 0.094571f, -1.207874f, 0}, - {8.899241f, 0.466869f, -1.898601f, 0}, - {9.060850f, 0.805648f, -1.408987f, 0}, - {9.222459f, 0.831985f, -0.489614f, 0}, - {9.290693f, 0.647631f, 0.099359f, 0}, - {8.882483f, 0.517147f, -0.029928f, 0}, - {8.628697f, 0.389058f, -0.817619f, 0}, - {9.248795f, 0.234632f, -1.046265f, 0}, - {9.690525f, -0.081403f, -1.126471f, 0}, - {10.071202f, -0.231040f, -0.632069f, 0}, - {10.299849f, -0.039504f, 0.476446f, 0}, - {10.965436f, 0.278924f, 0.920570f, 0}, - {11.526876f, 0.132878f, -0.335188f, 0}, - {11.572366f, 0.118513f, -0.995987f, 0}, - {12.087119f, 0.074220f, 0.064643f, 0}, - {14.025224f, -0.268150f, 0.715866f, 0}, - {13.812140f, -0.075417f, 2.175131f, 0}, - {10.393223f, 0.955286f, 4.447227f, 0}, - {5.740095f, 2.165554f, 5.378571f, 0}, - {2.682701f, 2.470814f, 4.266465f, 0}, - {2.267308f, 1.452082f, 2.970005f, 0}, - {5.784388f, -0.737414f, 2.178722f, 0}, - {8.700523f, -2.176328f, 0.712274f, 0}, - {8.658625f, -2.545035f, -1.139639f, 0}, - {8.984236f, -3.094504f, -0.059855f, 0}, - {10.274710f, -4.108448f, 2.123656f, 0}, - {11.112679f, -5.146333f, 2.748542f, 0}, - {12.083528f, -5.299562f, -0.111330f, 0}, - {11.859670f, -3.488349f, -2.300826f, 0}, - {10.259148f, -1.679531f, -0.063446f, 0}, - {8.656230f, -1.307233f, 1.798044f, 0}, - {7.996628f, -1.447294f, 1.592143f, 0}, - {8.142674f, -1.909375f, 0.881066f, 0}, - {8.282735f, -2.118867f, 0.978031f, 0}, - {8.382094f, -1.970427f, 1.248575f, 0}, - {8.866920f, -1.735795f, 0.386663f, 0}, - {9.623487f, -1.595734f, -0.269348f, 0}, - {9.806643f, -1.525105f, -0.345962f, 0}, - {9.609122f, -1.367088f, 0.299275f, 0}, - {9.714467f, -1.388636f, 1.693897f, 0}, - {9.576800f, -1.092952f, 2.396594f, 0}, - {9.296679f, -1.480813f, 2.565385f, 0}, - {9.323015f, -0.742202f, 2.341528f, 0}, - {9.384068f, -1.109712f, 1.960850f, 0}, - {9.868893f, -1.590946f, 2.421733f, 0}, - {10.109509f, -1.939302f, 2.955640f, 0}, - {9.973041f, -2.006340f, 3.324347f, 0}, - {9.859316f, -1.581369f, 3.942050f, 0}, - {9.793475f, -0.999579f, 3.818749f, 0}, - {8.820233f, -0.578199f, 2.885011f, 0}, - {7.404064f, -0.547075f, 1.671152f, 0}, - {6.730096f, -0.906205f, 0.976834f, 0}, - {8.153448f, -2.236183f, 0.503979f, 0}, - {9.867696f, -4.234143f, -0.254982f, 0}, - {7.984657f, -2.888602f, -1.261743f, 0}, - {9.093172f, -3.695448f, -2.171540f, 0}, - {9.166195f, -3.958810f, -1.365891f, 0}, - {9.483426f, -4.307166f, -1.432929f, 0}, - {9.564829f, -4.777626f, -2.000354f, 0}, - {9.548070f, -5.154713f, -2.106896f, 0}, - {9.175772f, -5.427651f, -1.608902f, 0}, - {8.127112f, -6.010639f, -1.829169f, 0}, - {8.129506f, -6.432018f, -1.207874f, 0}, - {7.790727f, -5.821497f, 0.189142f, 0}, - {7.073664f, -4.104856f, 2.110487f, 0}, - {7.091620f, -3.636790f, 1.745372f, 0}, - {7.758405f, -3.837903f, 0.458489f, 0}, - {8.832204f, -3.739741f, 0.357933f, 0}, - {9.786293f, -3.177104f, 0.160411f, 0}, - {9.618699f, -2.337936f, -0.683544f, 0}, - {9.124296f, -1.669955f, -0.986410f, 0}, - {8.815445f, -1.297656f, 0.074220f, 0}, - {8.663413f, -1.192312f, 0.752976f, 0}, - {8.526943f, -1.224633f, 0.095768f, 0}, - {8.671793f, -1.508346f, -0.044293f, 0}, - {9.041697f, -1.966835f, -1.302445f, 0}, - {9.320621f, -2.434901f, -0.640449f, 0}, - {9.319424f, -2.719811f, -0.933738f, 0}, - {9.598348f, -2.252942f, 0.096965f, 0}, - {9.272737f, -2.086545f, -0.335188f, 0}, - {9.397235f, -1.977609f, -0.829590f, 0}, - {9.585180f, -1.861491f, -0.963666f, 0}, - {9.563632f, -1.543062f, -1.194706f, 0}, - {9.265554f, -1.262941f, -1.276109f, 0}, - {8.941140f, -0.998381f, -1.148019f, 0}, - {8.711297f, -0.948103f, -1.108515f, 0}, - {8.803473f, -1.259349f, -1.027112f, 0}, - {9.475047f, -2.545035f, -0.591367f, 0}, - {10.941494f, -4.028242f, -0.374692f, 0}, - {11.295835f, -3.961204f, 0.489614f, 0}, - {9.697707f, -2.606087f, 1.587355f, 0}, - {8.414416f, -2.354696f, 1.309627f, 0}, - {8.408431f, -3.039437f, 0.598550f, 0}, - {8.759181f, -3.227382f, 0.460884f, 0}, - {9.191334f, -3.215411f, 0.717063f, 0}, - {9.106340f, -3.286040f, -1.228225f, 0}, - {9.215276f, -3.016692f, -0.532710f, 0}, - {9.226050f, -2.573765f, 1.215057f, 0}, - {9.278723f, -2.743753f, 0.444124f, 0}, - {9.779110f, -3.204637f, 1.349132f, 0}, - {9.914383f, -3.223790f, 1.940499f, 0}, - {9.907200f, -2.806002f, 1.668757f, 0}, - {10.375266f, -2.416945f, 2.098516f, 0}, - {11.027685f, -2.161963f, 2.414551f, 0}, - {11.603491f, -1.948879f, 2.486377f, 0}, - {11.531665f, -1.472433f, 2.813185f, 0}, - {10.983393f, -0.723048f, 2.525881f, 0}, - {9.938325f, 0.086191f, 2.130838f, 0}, - {8.816642f, 0.365116f, 2.731782f, 0}, - {10.491385f, 0.019154f, 3.318361f, 0}, - {10.913961f, -0.289698f, 4.115630f, 0}, - {9.964661f, 0.154426f, 4.765655f, 0}, - {7.896072f, 1.101332f, 4.291604f, 0}, - {7.783545f, 1.666363f, 4.158726f, 0}, - {8.256399f, 1.159990f, 4.963177f, 0}, - {8.441950f, 0.727837f, 5.633553f, 0}, - {7.973883f, 0.981622f, 5.418075f, 0}, - {7.131125f, 1.492784f, 4.759670f, 0}, - {7.067678f, 1.640027f, 4.987119f, 0}, - {7.246047f, 1.323993f, 5.380965f, 0}, - {7.788333f, 1.154004f, 5.783190f, 0}, - {8.256399f, 1.544259f, 6.980290f, 0}, - {8.076834f, 2.169145f, 7.654258f, 0}, - {7.649469f, 2.182313f, 7.368151f, 0}, - {7.462722f, 2.094925f, 6.817485f, 0}, - {6.956348f, 1.817198f, 6.009442f, 0}, - {6.156685f, 1.295262f, 5.595245f, 0}, - {5.171472f, 1.101332f, 5.043383f, 0}, - {4.614820f, 1.007958f, 4.921278f, 0}, - {4.693829f, 0.915781f, 5.402513f, 0}, - {4.863817f, 1.090558f, 5.463564f, 0}, - {4.620806f, 1.468842f, 5.919660f, 0}, - {4.741713f, 1.361103f, 6.609190f, 0}, - {4.047395f, 1.677137f, 6.482296f, 0}, - {4.094082f, 1.859096f, 6.527786f, 0}, - {4.349064f, 1.829169f, 6.309914f, 0}, - {4.477154f, 1.816001f, 6.591233f, 0}, - {4.513067f, 1.195903f, 7.651864f, 0}, - {5.130771f, 0.706289f, 8.787911f, 0}, - {5.143939f, 0.804451f, 8.456315f, 0}, - {4.619609f, 0.244208f, 7.931985f, 0}, - {3.963598f, -0.852335f, 8.146266f, 0}, - {4.163514f, -1.314416f, 8.972264f, 0}, - {4.601653f, -1.395819f, 9.185349f, 0}, - {4.854240f, -1.686714f, 8.943534f, 0}, - {4.542994f, -2.023099f, 8.414416f, 0}, - {3.835509f, -2.602495f, 8.085214f, 0}, - {2.978385f, -2.853886f, 8.039723f, 0}, - {2.686292f, -2.522290f, 7.716507f, 0}, - {2.425325f, -2.989159f, 10.263936f, 0}, - {1.680728f, -3.276463f, 12.568354f, 0}, - {1.449688f, -2.462435f, 9.834177f, 0}, - {1.904586f, -2.296038f, 8.819036f, 0}, - {2.072180f, -2.254139f, 9.337380f, 0}, - {2.197876f, -2.144006f, 9.494201f, 0}, - {2.105699f, -1.899798f, 9.169786f, 0}, - {1.717839f, -1.751357f, 9.096764f, 0}, - {1.574187f, -1.813607f, 9.458287f, 0}, - {1.502361f, -1.717839f, 9.576800f, 0}, - {1.379059f, -1.528697f, 9.473849f, 0}, - {1.168370f, -1.182735f, 9.206897f, 0}, - {1.060631f, -1.138442f, 9.701299f, 0}, - {0.893037f, -1.142033f, 10.007756f, 0}, - {0.729034f, -1.097741f, 10.362098f, 0}, - {0.847547f, -1.270123f, 11.415545f, 0}, - {0.700303f, -1.437717f, 11.802209f, 0}, - {0.657208f, -0.940921f, 10.297455f, 0}, - {0.820014f, -0.262165f, 8.865723f, 0}, - {1.120486f, -0.100556f, 9.303862f, 0}, - {1.000776f, -0.172382f, 10.194504f, 0}, - {0.691924f, 0.026336f, 8.984236f, 0}, - {0.712274f, 0.058658f, 8.265976f, 0}, - {0.530315f, -0.462081f, 10.773900f, 0}, - {0.463278f, -0.685938f, 10.289075f, 0}, - {0.442927f, -0.518344f, 7.893678f, 0}, - {0.445321f, -0.438139f, 7.972686f, 0}, - {0.378284f, -0.450110f, 8.655033f, 0}, - {0.043096f, 0.015562f, 8.980644f, 0}, - {0.220266f, 0.984016f, 9.639050f, 0}, - {0.154426f, 1.146822f, 9.488214f, 0}, - {-0.119710f, 1.325190f, 9.168590f, 0}, - {-0.130484f, 1.334767f, 9.746788f, 0}, - {-0.025139f, 1.310825f, 10.338156f, 0}, - {0.028730f, 1.616085f, 9.712072f, 0}, - {0.044293f, 1.892615f, 8.583207f, 0}, - {0.069432f, 1.480813f, 8.564054f, 0}, - {0.033519f, 1.243787f, 8.768758f, 0}, - {0.373495f, 1.514332f, 8.633486f, 0}, - {0.353144f, 1.561018f, 8.446738f, 0}, - {0.129287f, 1.313219f, 8.616726f, 0}, - {-0.028730f, 0.976834f, 9.123099f, 0}, - {-0.076614f, 0.966060f, 9.351746f, 0}, - {-0.161609f, 1.165975f, 8.965082f, 0}, - {-0.343568f, 1.641224f, 8.194150f, 0}, - {-0.442927f, 1.661575f, 8.437161f, 0}, - {-0.363918f, 1.365891f, 9.854527f, 0}, - {-0.282516f, 1.326387f, 10.666162f, 0}, - {-0.314837f, 1.443703f, 10.433924f, 0}, - {-0.644040f, 1.332372f, 9.327804f, 0}, - {-0.999579f, 1.479616f, 8.036133f, 0}, - {-0.799663f, 1.452082f, 8.346182f, 0}, - {-0.858321f, 1.567004f, 9.868893f, 0}, - {-0.938526f, 1.495178f, 11.599899f, 0}, - {-1.193509f, 1.498769f, 11.905160f, 0}, - {-1.556230f, 1.338358f, 10.947480f, 0}, - {-1.557427f, 1.256955f, 11.003743f, 0}, - {-1.413775f, 1.060631f, 11.848896f, 0}, - {-1.280897f, 0.922964f, 12.215209f, 0}, - {-1.132457f, 0.927753f, 11.399983f, 0}, - {-1.037886f, 0.881066f, 10.413573f, 0}, - {-0.605733f, 0.897825f, 10.074794f, 0}, - {-0.149638f, 0.872686f, 10.181335f, 0}, - {0.278924f, 0.933738f, 10.765521f, 0}, - {0.741005f, 1.137245f, 10.898398f, 0}, - {1.114500f, 1.398213f, 10.672147f, 0}, - {1.337161f, 1.841140f, 11.609476f, 0}, - {1.916557f, 1.922543f, 13.679262f, 0}, - {2.594116f, 1.768117f, 13.814534f, 0}, - {3.088518f, 2.280476f, 12.144580f, 0}, - {3.426100f, 2.173934f, 11.726792f, 0}, - {3.564964f, 1.717839f, 11.662148f, 0}, - {3.779245f, 1.653195f, 11.219221f, 0}, - {3.823538f, 1.709459f, 10.377660f, 0}, -}; - -const size_t kBodyDetectOnBodyTestDataLength = - ARRAY_SIZE(kBodyDetectOnBodyTestData); - -const struct body_detect_test_data kBodyDetectOffOnTestData[] = { - {-0.269348, 0.220266, 10.030501, 0}, - {-0.259771, 0.216675, 10.113101, 0}, - {-0.253785, 0.213084, 10.096342, 0}, - {-0.262165, 0.201113, 10.098736, 0}, - {-0.257377, 0.210690, 10.093947, 0}, - {-0.253785, 0.202310, 10.096342, 0}, - {-0.257377, 0.213084, 10.113101, 0}, - {-0.257377, 0.221464, 10.096342, 0}, - {-0.262165, 0.217872, 10.115496, 0}, - {-0.258574, 0.219069, 10.102327, 0}, - {-0.275333, 0.205901, 10.123875, 0}, - {-0.262165, 0.209493, 10.085567, 0}, - {-0.271742, 0.209493, 10.110707, 0}, - {-0.275333, 0.220266, 10.096342, 0}, - {-0.251391, 0.210690, 10.097539, 0}, - {-0.262165, 0.210690, 10.090356, 0}, - {-0.268150, 0.208295, 10.108313, 0}, - {-0.258574, 0.210690, 10.098736, 0}, - {-0.270545, 0.219069, 10.097539, 0}, - {-0.263362, 0.211887, 10.102327, 0}, - {-0.264559, 0.211887, 10.097539, 0}, - {-0.262165, 0.204704, 10.090356, 0}, - {-0.246603, 0.203507, 10.089159, 0}, - {-0.250194, 0.215478, 10.099933, 0}, - {-0.270545, 0.225055, 10.109509, 0}, - {-0.256179, 0.213084, 10.097539, 0}, - {-0.248997, 0.207098, 10.086765, 0}, - {-0.248997, 0.210690, 10.087962, 0}, - {-0.256179, 0.201113, 10.089159, 0}, - {-0.258574, 0.203507, 10.104721, 0}, - {-0.262165, 0.208295, 10.093947, 0}, - {-0.246603, 0.204704, 10.086765, 0}, - {-0.247800, 0.208295, 10.108313, 0}, - {-0.252588, 0.220266, 10.099933, 0}, - {-0.264559, 0.210690, 10.098736, 0}, - {-0.266953, 0.185551, 10.084371, 0}, - {-0.253785, 0.213084, 10.109509, 0}, - {-0.256179, 0.231040, 10.099933, 0}, - {-0.252588, 0.205901, 10.091554, 0}, - {-0.259771, 0.207098, 10.095144, 0}, - {-0.260968, 0.203507, 10.096342, 0}, - {-0.253785, 0.205901, 10.095144, 0}, - {-0.256179, 0.217872, 10.093947, 0}, - {-0.265756, 0.209493, 10.083174, 0}, - {-0.263362, 0.204704, 10.103524, 0}, - {-0.253785, 0.198719, 10.095144, 0}, - {-0.252588, 0.209493, 10.103524, 0}, - {-0.260968, 0.205901, 10.098736, 0}, - {-0.259771, 0.205901, 10.083174, 0}, - {-0.266953, 0.216675, 10.090356, 0}, - {-0.265756, 0.207098, 10.101130, 0}, - {-0.262165, 0.204704, 10.111904, 0}, - {-0.248997, 0.199916, 10.101130, 0}, - {-0.263362, 0.207098, 10.096342, 0}, - {-0.281319, 0.227449, 10.108313, 0}, - {-0.259771, 0.219069, 10.087962, 0}, - {-0.258574, 0.214281, 10.079582, 0}, - {-0.268150, 0.204704, 10.108313, 0}, - {-0.277727, 0.204704, 10.114298, 0}, - {-0.257377, 0.208295, 10.115496, 0}, - {-0.260968, 0.222661, 10.104721, 0}, - {-0.265756, 0.213084, 10.102327, 0}, - {-0.256179, 0.210690, 10.099933, 0}, - {-0.253785, 0.203507, 10.109509, 0}, - {-0.270545, 0.201113, 10.103524, 0}, - {-0.259771, 0.209493, 10.115496, 0}, - {-0.264559, 0.207098, 10.103524, 0}, - {-0.263362, 0.202310, 10.105919, 0}, - {-0.260968, 0.220266, 10.110707, 0}, - {-0.257377, 0.216675, 10.110707, 0}, - {-0.259771, 0.195127, 10.093947, 0}, - {-0.271742, 0.209493, 10.104721, 0}, - {-0.257377, 0.223858, 10.108313, 0}, - {-0.265756, 0.205901, 10.101130, 0}, - {-0.270545, 0.196324, 10.101130, 0}, - {-0.254982, 0.202310, 10.115496, 0}, - {-0.248997, 0.214281, 10.116693, 0}, - {-0.268150, 0.207098, 10.111904, 0}, - {-0.263362, 0.204704, 10.091554, 0}, - {-0.270545, 0.210690, 10.091554, 0}, - {-0.268150, 0.215478, 10.102327, 0}, - {-0.264559, 0.223858, 10.096342, 0}, - {-0.262165, 0.203507, 10.099933, 0}, - {-0.259771, 0.203507, 10.103524, 0}, - {-0.269348, 0.204704, 10.119086, 0}, - {-0.265756, 0.202310, 10.091554, 0}, - {-0.260968, 0.201113, 10.092751, 0}, - {-0.260968, 0.210690, 10.092751, 0}, - {-0.266953, 0.205901, 10.109509, 0}, - {-0.269348, 0.203507, 10.105919, 0}, - {-0.264559, 0.193930, 10.114298, 0}, - {-0.263362, 0.216675, 10.093947, 0}, - {-0.256179, 0.208295, 10.095144, 0}, - {-0.271742, 0.203507, 10.103524, 0}, - {-0.259771, 0.208295, 10.089159, 0}, - {-0.257377, 0.220266, 10.108313, 0}, - {-0.266953, 0.207098, 10.101130, 0}, - {-0.268150, 0.198719, 10.117889, 0}, - {-0.258574, 0.204704, 10.091554, 0}, - {-0.266953, 0.201113, 10.104721, 0}, - {-0.265756, 0.205901, 10.091554, 0}, - {-0.277727, 0.203507, 10.102327, 0}, - {-0.266953, 0.204704, 10.093947, 0}, - {-0.265756, 0.215478, 10.107116, 0}, - {-0.254982, 0.215478, 10.110707, 0}, - {-0.269348, 0.217872, 10.095144, 0}, - {-0.265756, 0.229843, 10.109509, 0}, - {-0.260968, 0.226252, 10.098736, 0}, - {-0.253785, 0.208295, 10.095144, 0}, - {-0.253785, 0.211887, 10.085567, 0}, - {-0.268150, 0.214281, 10.109509, 0}, - {-0.258574, 0.201113, 10.107116, 0}, - {-0.265756, 0.211887, 10.103524, 0}, - {-0.256179, 0.215478, 10.093947, 0}, - {-0.263362, 0.204704, 10.107116, 0}, - {-0.260968, 0.214281, 10.098736, 0}, - {-0.259771, 0.213084, 10.110707, 0}, - {-0.276530, 0.215478, 10.095144, 0}, - {-0.263362, 0.211887, 10.084371, 0}, - {-0.245406, 0.217872, 10.110707, 0}, - {-0.251391, 0.209493, 10.105919, 0}, - {-0.269348, 0.205901, 10.093947, 0}, - {-0.271742, 0.201113, 10.099933, 0}, - {-0.270545, 0.228646, 10.099933, 0}, - {-0.262165, 0.217872, 10.096342, 0}, - {-0.259771, 0.209493, 10.099933, 0}, - {-0.260968, 0.210690, 10.105919, 0}, - {-0.252588, 0.203507, 10.099933, 0}, - {-0.263362, 0.197522, 10.095144, 0}, - {-0.271742, 0.213084, 10.101130, 0}, - {-0.268150, 0.196324, 10.110707, 0}, - {-0.248997, 0.213084, 10.108313, 0}, - {-0.254982, 0.215478, 10.095144, 0}, - {-0.260968, 0.208295, 10.107116, 0}, - {-0.259771, 0.219069, 10.108313, 0}, - {-0.266953, 0.214281, 10.098736, 0}, - {-0.269348, 0.202310, 10.090356, 0}, - {-0.258574, 0.204704, 10.113101, 0}, - {-0.263362, 0.226252, 10.086765, 0}, - {-0.264559, 0.204704, 10.096342, 0}, - {-0.271742, 0.219069, 10.096342, 0}, - {-0.252588, 0.210690, 10.104721, 0}, - {-0.258574, 0.211887, 10.113101, 0}, - {-0.264559, 0.210690, 10.104721, 0}, - {-0.269348, 0.214281, 10.103524, 0}, - {-0.253785, 0.211887, 10.093947, 0}, - {-0.256179, 0.223858, 10.110707, 0}, - {-0.274136, 0.207098, 10.098736, 0}, - {-0.274136, 0.207098, 10.092751, 0}, - {-0.254982, 0.210690, 10.091554, 0}, - {-0.257377, 0.204704, 10.098736, 0}, - {-0.257377, 0.209493, 10.108313, 0}, - {-0.257377, 0.211887, 10.095144, 0}, - {-0.259771, 0.199916, 10.095144, 0}, - {-0.257377, 0.214281, 10.101130, 0}, - {-0.270545, 0.217872, 10.103524, 0}, - {-0.281319, 0.204704, 10.104721, 0}, - {-0.271742, 0.208295, 10.103524, 0}, - {-0.258574, 0.211887, 10.104721, 0}, - {-0.264559, 0.204704, 10.126269, 0}, - {-0.262165, 0.201113, 10.101130, 0}, - {-0.258574, 0.219069, 10.096342, 0}, - {-0.263362, 0.211887, 10.107116, 0}, - {-0.265756, 0.203507, 10.091554, 0}, - {-0.264559, 0.205901, 10.107116, 0}, - {-0.256179, 0.214281, 10.095144, 0}, - {-0.263362, 0.202310, 10.097539, 0}, - {-0.271742, 0.207098, 10.104721, 0}, - {-0.272939, 0.210690, 10.101130, 0}, - {-0.262165, 0.205901, 10.096342, 0}, - {-0.260968, 0.209493, 10.107116, 0}, - {-0.269348, 0.217872, 10.093947, 0}, - {-0.256179, 0.220266, 10.087962, 0}, - {-0.264559, 0.208295, 10.092751, 0}, - {-0.265756, 0.208295, 10.095144, 0}, - {-0.262165, 0.199916, 10.098736, 0}, - {-0.259771, 0.215478, 10.101130, 0}, - {-0.263362, 0.217872, 10.097539, 0}, - {-0.263362, 0.204704, 10.095144, 0}, - {-0.248997, 0.202310, 10.096342, 0}, - {-0.260968, 0.226252, 10.097539, 0}, - {-0.259771, 0.216675, 10.103524, 0}, - {-0.270545, 0.205901, 10.090356, 0}, - {-0.250194, 0.219069, 10.089159, 0}, - {-0.254982, 0.213084, 10.098736, 0}, - {-0.268150, 0.204704, 10.102327, 0}, - {-0.258574, 0.215478, 10.104721, 0}, - {-0.250194, 0.217872, 10.102327, 0}, - {-0.250194, 0.215478, 10.097539, 0}, - {-0.251391, 0.213084, 10.086765, 0}, - {-0.266953, 0.204704, 10.108313, 0}, - {-0.270545, 0.199916, 10.099933, 0}, - {-0.271742, 0.208295, 10.092751, 0}, - {-0.268150, 0.222661, 10.098736, 0}, - {-0.252588, 0.213084, 10.096342, 0}, - {-0.266953, 0.213084, 10.092751, 0}, - {-0.265756, 0.205901, 10.105919, 0}, - {-0.258574, 0.209493, 10.103524, 0}, - {-0.263362, 0.203507, 10.103524, 0}, - {-0.265756, 0.213084, 10.092751, 0}, - {-0.266953, 0.209493, 10.097539, 0}, - {-0.272939, 0.193930, 10.110707, 0}, - {-0.258574, 0.209493, 10.109509, 0}, - {-0.259771, 0.213084, 10.101130, 0}, - {-0.274136, 0.215478, 10.101130, 0}, - {-0.259771, 0.207098, 10.091554, 0}, - {-0.265756, 0.208295, 10.101130, 0}, - {-0.263362, 0.210690, 10.109509, 0}, - {-0.264559, 0.216675, 10.110707, 0}, - {-0.266953, 0.211887, 10.099933, 0}, - {-0.268150, 0.199916, 10.093947, 0}, - {-0.265756, 0.216675, 10.105919, 0}, - {-0.262165, 0.204704, 10.081977, 0}, - {-0.263362, 0.214281, 10.086765, 0}, - {-0.263362, 0.210690, 10.084371, 0}, - {-0.257377, 0.201113, 10.104721, 0}, - {-0.262165, 0.203507, 10.109509, 0}, - {-0.266953, 0.217872, 10.113101, 0}, - {-0.252588, 0.209493, 10.102327, 0}, - {-0.257377, 0.213084, 10.096342, 0}, - {-0.260968, 0.211887, 10.101130, 0}, - {-0.263362, 0.197522, 10.114298, 0}, - {-0.272939, 0.192733, 10.103524, 0}, - {-0.250194, 0.207098, 10.079582, 0}, - {-0.253785, 0.214281, 10.107116, 0}, - {-0.254982, 0.205901, 10.095144, 0}, - {-0.256179, 0.209493, 10.103524, 0}, - {-0.265756, 0.222661, 10.111904, 0}, - {-0.259771, 0.211887, 10.101130, 0}, - {-0.256179, 0.202310, 10.115496, 0}, - {-0.260968, 0.209493, 10.109509, 0}, - {-0.243011, 0.203507, 10.101130, 0}, - {-0.252588, 0.205901, 10.096342, 0}, - {-0.253785, 0.225055, 10.095144, 0}, - {-0.258574, 0.225055, 10.096342, 0}, - {-0.264559, 0.215478, 10.092751, 0}, - {-0.265756, 0.205901, 10.114298, 0}, - {-0.266953, 0.220266, 10.108313, 0}, - {-0.268150, 0.208295, 10.109509, 0}, - {-0.259771, 0.210690, 10.103524, 0}, - {-0.253785, 0.210690, 10.109509, 0}, - {-0.268150, 0.213084, 10.097539, 0}, - {-0.268150, 0.215478, 10.102327, 0}, - {-0.269348, 0.201113, 10.103524, 0}, - {-0.262165, 0.199916, 10.107116, 0}, - {-0.260968, 0.205901, 10.120284, 0}, - {-0.257377, 0.193930, 10.102327, 0}, - {-0.264559, 0.203507, 10.104721, 0}, - {-0.265756, 0.210690, 10.093947, 0}, - {-0.256179, 0.209493, 10.097539, 0}, - {-0.257377, 0.204704, 10.107116, 0}, - {-0.260968, 0.208295, 10.093947, 0}, - {-0.258574, 0.204704, 10.102327, 0}, - {-0.263362, 0.211887, 10.107116, 0}, - {-0.263362, 0.191536, 10.097539, 0}, - {-0.253785, 0.209493, 10.107116, 0}, - {-0.254982, 0.217872, 10.105919, 0}, - {-0.259771, 0.207098, 10.096342, 0}, - {-0.265756, 0.204704, 10.114298, 0}, - {-0.270545, 0.208295, 10.099933, 0}, - {-0.262165, 0.214281, 10.104721, 0}, - {-0.257377, 0.205901, 10.095144, 0}, - {-0.266953, 0.214281, 10.096342, 0}, - {-0.274136, 0.225055, 10.093947, 0}, - {-0.266953, 0.216675, 10.099933, 0}, - {-0.269348, 0.208295, 10.099933, 0}, - {-0.266953, 0.222661, 10.105919, 0}, - {-0.246603, 0.204704, 10.090356, 0}, - {-0.257377, 0.202310, 10.102327, 0}, - {-0.258574, 0.217872, 10.114298, 0}, - {-0.268150, 0.225055, 10.099933, 0}, - {-0.278924, 0.210690, 10.097539, 0}, - {-0.263362, 0.203507, 10.104721, 0}, - {-0.252588, 0.221464, 10.089159, 0}, - {-0.252588, 0.208295, 10.073597, 0}, - {-0.252588, 0.213084, 10.091554, 0}, - {-0.256179, 0.210690, 10.087962, 0}, - {-0.272939, 0.214281, 10.097539, 0}, - {-0.259771, 0.203507, 10.097539, 0}, - {-0.271742, 0.208295, 10.102327, 0}, - {-0.262165, 0.216675, 10.095144, 0}, - {-0.264559, 0.215478, 10.095144, 0}, - {-0.265756, 0.214281, 10.103524, 0}, - {-0.268150, 0.217872, 10.096342, 0}, - {-0.262165, 0.221464, 10.104721, 0}, - {-0.274136, 0.219069, 10.101130, 0}, - {-0.264559, 0.208295, 10.097539, 0}, - {-0.265756, 0.203507, 10.089159, 0}, - {-0.269348, 0.204704, 10.110707, 0}, - {-0.268150, 0.214281, 10.116693, 0}, - {-0.250194, 0.199916, 10.102327, 0}, - {-0.266953, 0.197522, 10.105919, 0}, - {-0.268150, 0.199916, 10.108313, 0}, - {-0.259771, 0.195127, 10.093947, 0}, - {-0.262165, 0.215478, 10.085567, 0}, - {-0.263362, 0.216675, 10.101130, 0}, - {-0.252588, 0.227449, 10.037683, 0}, - {-0.276530, 0.208295, 10.177745, 0}, - {-0.254982, 0.205901, 10.175350, 0}, - {-0.257377, 0.204704, 10.041275, 0}, - {-0.258574, 0.210690, 10.117889, 1}, - {-0.243011, 0.209493, 10.085567, 0}, - {-0.254982, 0.196324, 10.109509, 0}, - {-0.248997, 0.193930, 10.097539, 0}, - {-0.269348, 0.207098, 10.098736, 0}, - {-0.262165, 0.213084, 10.098736, 0}, - {-0.262165, 0.201113, 10.066414, 0}, - {-0.264559, 0.208295, 10.103524, 0}, - {-0.264559, 0.208295, 10.101130, 0}, - {-0.257377, 0.210690, 10.119086, 0}, - {-0.256179, 0.198719, 10.093947, 0}, - {-0.253785, 0.198719, 10.113101, 0}, - {-0.254982, 0.215478, 10.081977, 0}, - {-0.259771, 0.210690, 10.092751, 0}, - {-0.264559, 0.214281, 10.090356, 0}, - {-0.260968, 0.187945, 10.144226, 0}, - {-0.268150, 0.245406, 10.073597, 0}, - {-0.408211, 0.396240, 10.056837, 0}, - {-2.020705, 2.340331, 10.170562, 0}, - {-0.186748, 1.916557, 10.966634, 0}, - {7.234076, -2.675519, 16.133318, 0}, - {7.775165, 0.863109, 11.798618, 0}, - {3.503912, -1.510740, 2.634817, 0}, - {-3.895364, -5.768825, 9.538493, 0}, - {-4.587287, -2.717417, 26.975452, 0}, - {-3.013101, 4.329911, 32.156502, 0}, - {-4.693829, -1.854308, 19.993965, 0}, - {-5.236115, -2.634817, 18.126490, 0}, - {-6.558911, 1.010352, 20.283663, 0}, - {-8.033738, 0.130484, 22.203812, 0}, - {-7.487861, -0.525527, 18.705885, 0}, - {-6.692986, 0.266953, 15.228310, 0}, - {-6.151897, 0.128090, 10.176547, 0}, - {-6.020216, 0.745793, 5.400118, 0}, - {-5.798753, 1.690305, 1.695094, 0}, - {-3.584117, 1.229422, -1.827972, 0}, - {-0.386663, 1.133654, -4.835087, 0}, - {0.955286, 1.742978, -4.969162, 0}, - {3.201046, 1.059434, -6.075283, 0}, - {7.366954, -0.312443, -7.837414, 0}, - {8.429978, -0.656011, -6.296746, 0}, - {6.950363, -0.164003, -3.179498, 0}, - {6.801922, -0.415394, -0.955286, 0}, - {7.827837, -0.814028, 1.152807, 0}, - {7.793121, -0.723048, 3.940853, 0}, - {7.422020, -0.292092, 6.720520, 0}, - {7.978672, -0.298078, 7.856567, 0}, - {8.202530, -0.122104, 7.301113, 0}, - {7.778756, 0.360327, 6.107605, 0}, - {7.892480, 0.318429, 5.987895, 0}, - {8.950717, 0.108936, 6.327871, 0}, - {8.798685, 0.319626, 7.009021, 0}, - {7.748828, 0.839167, 7.133519, 0}, - {7.795516, 0.958877, 6.597219, 0}, - {7.850582, 1.035492, 5.942405, 0}, - {7.547716, 1.152807, 5.074507, 0}, - {7.116760, 1.128865, 4.546586, 0}, - {7.422020, 0.805648, 4.566936, 0}, - {7.937970, 0.517147, 4.827904, 0}, - {8.088805, 0.418985, 5.172669, 0}, - {8.329422, 0.415394, 5.573698, 0}, - {8.099579, 0.739808, 5.117603, 0}, - {7.973883, 0.805648, 4.387372, 0}, - {7.833823, 1.048660, 3.857056, 0}, - {8.100776, 1.177946, 3.950430, 0}, - {8.722071, 1.122880, 4.909307, 0}, - {9.400826, 0.921767, 5.566515, 0}, - {9.440331, 0.920570, 5.175064, 0}, - {8.723268, 1.022323, 4.551374, 0}, - {8.115141, 1.175552, 4.096477, 0}, - {8.135491, 1.387439, 3.754106, 0}, - {8.602361, 1.533485, 3.762486, 0}, - {8.884876, 1.289277, 4.268859, 0}, - {8.775940, 0.867898, 4.517856, 0}, - {8.434767, 0.647631, 4.377795, 0}, - {8.220486, 0.623689, 4.394554, 0}, - {7.817063, 0.945709, 4.226960, 0}, - {8.021768, 1.249772, 3.598483, 0}, - {9.108734, 0.667982, 3.156753, 0}, - {9.658203, 0.177171, 2.748542, 0}, - {9.301467, 0.393846, 2.639606, 0}, - {9.026134, 0.736217, 3.105278, 0}, - {8.865723, 0.814028, 3.799596, 0}, - {8.759181, 0.849941, 4.060563, 0}, - {8.493424, 0.964863, 4.404131, 0}, - {8.276750, 1.033097, 4.540600, 0}, - {8.324634, 0.908599, 4.672281, 0}, - {8.778335, 0.644040, 4.946417, 0}, - {8.558068, 0.827196, 5.007470, 0}, - {8.507790, 0.703895, 4.434059, 0}, - {8.688552, 0.684741, 3.661929, 0}, - {8.784320, 0.820014, 3.207031, 0}, - {8.844175, 0.839167, 3.385399, 0}, - {8.908818, 0.858321, 3.974372, 0}, - {9.044091, 0.907402, 4.442438, 0}, - {8.989024, 0.899022, 4.399343, 0}, - {8.925578, 0.815225, 4.141966, 0}, - {9.033317, 0.615309, 3.840297, 0}, - {9.083595, 0.436942, 3.727770, 0}, - {9.020149, 0.338779, 3.928882, 0}, - {8.930367, 0.299275, 4.174288, 0}, - {8.963885, 0.246603, 4.288013, 0}, - {8.842978, 0.304063, 4.236537, 0}, - {8.641865, 0.396240, 4.152740, 0}, - {8.591587, 0.466869, 4.163514, 0}, - {8.656230, 0.460884, 4.255691, 0}, - {8.836992, 0.398634, 4.118024, 0}, - {8.957899, 0.453701, 3.754106, 0}, - {9.045288, 0.502782, 3.326741, 0}, - {9.083595, 0.586579, 3.045423, 0}, - {9.033317, 0.705092, 3.004721, 0}, - {8.968674, 0.715866, 3.072956, 0}, - {8.899241, 0.684741, 3.071759, 0}, - {8.809459, 0.632069, 3.072956, 0}, - {8.832204, 0.585382, 3.138796, 0}, - {8.825022, 0.575805, 3.143585, 0}, - {8.761575, 0.556652, 3.064576, 0}, - {8.750801, 0.594959, 3.092109, 0}, - {8.817839, 0.633266, 3.129220, 0}, - {8.913607, 0.640449, 3.046620, 0}, - {8.998601, 0.658405, 2.869449, 0}, - {9.095566, 0.684741, 2.670730, 0}, - {9.133873, 0.694318, 2.789243, 0}, - {9.126691, 0.676362, 3.256112, 0}, - {9.041697, 0.723048, 3.632001, 0}, - {8.827415, 0.763750, 3.794807, 0}, - {8.853752, 0.694318, 3.775654, 0}, - {9.000996, 0.618901, 3.673900, 0}, - {9.066835, 0.561440, 3.708616, 0}, - {9.075215, 0.497994, 3.767274, 0}, - {9.064442, 0.417788, 3.775654, 0}, - {9.003389, 0.444124, 3.676294, 0}, - {8.943534, 0.500388, 3.551796, 0}, - {8.961491, 0.505176, 3.343500, 0}, - {8.789108, 0.600944, 3.191469, 0}, - {8.816642, 0.596156, 3.118446, 0}, - {8.889665, 0.549469, 3.131614, 0}, - {8.881285, 0.533907, 3.242944, 0}, - {8.783123, 0.590170, 3.416523, 0}, - {8.716085, 0.642843, 3.600877, 0}, - {8.719677, 0.612915, 3.694251, 0}, - {8.792700, 0.532710, 3.641578, 0}, - {8.895650, 0.470460, 3.475181, 0}, - {8.902833, 0.453701, 3.179498, 0}, - {8.833401, 0.399831, 2.855083, 0}, - {8.759181, 0.278924, 2.383426, 0}, - {8.670595, 0.118513, 1.875856, 0}, - {8.531732, -0.013168, 1.414972, 0}, - {8.376109, -0.057461, 1.115697, 0}, - {8.304283, -0.015562, 1.341949, 0}, - {7.916422, 0.159214, 1.878250, 0}, - {7.595600, 0.270545, 3.086124, 0}, - {7.516591, 0.349553, 4.906913, 0}, - {7.881707, 0.061052, 6.694183, 0}, - {8.112747, -0.235829, 7.243652, 0}, - {8.034935, -0.387860, 7.001838, 0}, - {8.052892, -0.222661, 6.254848, 0}, - {7.948744, 0.203507, 5.623976, 0}, - {7.327449, 0.853532, 5.892127, 0}, - {6.556517, 1.406592, 6.268016, 0}, - {6.993458, 1.375468, 6.548137, 0}, - {7.503423, 1.138442, 6.823470, 0}, - {7.237667, 1.118091, 7.408852, 0}, - {7.144293, 1.031900, 8.170208, 0}, - {7.127533, 0.927753, 8.361744, 0}, - {6.883325, 0.820014, 8.204924, 0}, - {6.708549, 0.644040, 7.923605, 0}, - {6.877340, 0.410605, 7.595600, 0}, - {7.054511, 0.339976, 7.395684, 0}, - {7.176615, 0.295684, 7.271185, 0}, - {7.182600, 0.259771, 7.201754, 0}, - {6.823470, 0.384269, 7.207739, 0}, - {6.624752, 0.464475, 7.419626, 0}, - {6.767207, 0.436942, 7.730872, 0}, - {6.834244, 0.386663, 7.971489, 0}, - {6.795937, 0.344765, 7.827837, 0}, - {6.531378, 0.404620, 7.354982, 0}, - {6.513421, 0.317232, 7.140702, 0}, - {6.649891, 0.192733, 7.065284, 0}, - {6.544546, 0.299275, 6.846215, 0}, - {6.555320, 0.381875, 6.678621, 0}, - {6.630737, 0.332794, 6.690592, 0}, - {6.636723, 0.199916, 6.915647, 0}, - {6.590036, 0.169988, 7.594403, 0}, - {6.248862, 0.393846, 8.506593, 0}, - {6.199781, 0.445321, 8.953111, 0}, - {6.538560, 0.023942, 8.977053, 0}, - {6.251256, 0.074220, 8.766363, 0}, - {6.154291, 0.337582, 8.178588, 0}, - {6.550531, 0.281319, 7.522577, 0}, - {6.397303, 0.652420, 7.284354, 0}, - {6.174642, 0.914584, 7.181403, 0}, - {6.265622, 0.825999, 6.584050, 0}, - {6.449975, 0.812831, 6.244074, 0}, - {6.738476, 0.641646, 6.549335, 0}, - {6.904873, 0.591367, 6.961137, 0}, - {6.669044, 0.671573, 7.244849, 0}, - {6.514618, 0.677559, 7.499832, 0}, - {6.716928, 0.464475, 7.510606, 0}, - {6.792346, 0.463278, 7.596797, 0}, - {6.734885, 0.585382, 7.791924, 0}, - {6.658270, 0.447715, 7.554898, 0}, - {6.463143, 0.486023, 7.091620, 0}, - {6.501450, 0.563834, 6.517013, 0}, - {6.488282, 0.654814, 6.062115, 0}, - {6.436807, 0.670376, 6.069297, 0}, - {6.479902, 0.659602, 6.549335, 0}, - {6.368572, 0.628478, 7.060496, 0}, - {6.446383, 0.487220, 7.497437, 0}, - {6.628343, 0.423773, 7.789530, 0}, - {6.636723, 0.460884, 7.996628, 0}, - {6.369769, 0.560243, 8.149857, 0}, - {6.105210, 0.602141, 8.106761, 0}, - {6.810302, 0.294487, 8.166616, 0}, - {7.140702, 0.201113, 8.110353, 0}, - {6.691789, 0.211887, 7.706930, 0}, - {6.524195, 0.271742, 7.422020, 0}, - {6.406879, 0.363918, 7.422020, 0}, - {6.278790, 0.423773, 7.556096, 0}, - {6.175839, 0.460884, 7.661440, 0}, - {6.229709, 0.451307, 7.507014, 0}, - {6.511027, 0.403423, 6.991064, 0}, - {6.872551, 0.345962, 6.734885, 0}, - {6.777980, 0.488417, 6.701366, 0}, - {6.730096, 0.620098, 6.682212, 0}, - {6.818682, 0.694318, 6.673833, 0}, - {6.897690, 0.634463, 6.702563, 0}, - {6.824667, 0.557849, 6.743265, 0}, - {6.700169, 0.621295, 6.815091, 0}, - {6.441595, 0.687135, 6.744462, 0}, - {6.476311, 0.812831, 6.872551, 0}, - {7.070073, 0.621295, 7.327449, 0}, - {6.791149, 0.446518, 7.169432, 0}, - {6.742067, 0.513556, 7.479481, 0}, - {6.738476, 0.420182, 7.603980, 0}, - {6.797134, 0.195127, 7.705733, 0}, - {6.882128, 0.363918, 7.593205, 0}, - {6.769601, 0.568623, 7.325055, 0}, - {6.915647, 0.465672, 7.016203, 0}, - {7.165841, 0.305261, 6.475114, 0}, - {7.277171, 0.234632, 5.893323, 0}, - {7.274777, 0.275333, 5.352234, 0}, - {6.994656, 0.428562, 5.149924, 0}, - {6.801922, 0.456095, 5.353431, 0}, - {6.751644, 0.354342, 5.864593, 0}, - {6.592430, 0.339976, 6.321885, 0}, - {6.416456, 0.262165, 6.567291, 0}, - {6.847412, -0.142455, 7.101197, 0}, - {7.248441, -0.061052, 7.084438, 0}, - {6.556517, 0.310049, 7.459130, 0}, - {6.555320, 0.251391, 7.558490, 0}, - {6.552926, 0.347159, 7.578840, 0}, - {6.534969, 0.442927, 7.498635, 0}, - {6.439201, 0.484826, 7.303507, 0}, - {6.555320, 0.341173, 7.278368, 0}, - {6.587642, 0.209493, 7.347800, 0}, - {6.563700, 0.135272, 7.492649, 0}, - {6.603204, 0.100556, 7.559687, 0}, - {6.515815, 0.198719, 7.558490, 0}, - {6.441595, 0.270545, 7.536942, 0}, - {6.330265, 0.298078, 7.629118, 0}, - {6.339842, 0.277727, 7.694959, 0}, - {6.260833, 0.245406, 7.636301, 0}, - {6.145912, 0.185551, 7.546519, 0}, - {6.068100, 0.132878, 7.322661, 0}, - {5.987895, 0.122104, 7.220907, 0}, - {5.989091, 0.123301, 7.357377, 0}, - {5.981909, 0.122104, 7.590811, 0}, - {6.020216, 0.088585, 7.677002, 0}, - {6.030990, 0.148440, 7.593205, 0}, - {6.063312, 0.219069, 7.480678, 0}, - {6.089648, 0.265756, 7.527365, 0}, - {6.050144, 0.359130, 7.862553, 0}, - {6.011837, 0.365116, 8.170208, 0}, - {6.011837, 0.265756, 8.222880, 0}, - {5.893323, 0.202310, 8.207318, 0}, - {5.845439, 0.137667, 8.021768, 0}, - {5.822695, 0.196324, 8.021768, 0}, - {5.906492, 0.239420, 8.250414, 0}, - {5.809526, 0.296881, 8.378503, 0}, - {5.810724, 0.222661, 8.389277, 0}, - {5.754460, 0.226252, 8.317451, 0}, - {5.809526, 0.104148, 8.396460, 0}, - {5.810724, 0.187945, 8.570039, 0}, - {6.063312, 0.287304, 8.530535, 0}, - {6.098028, 0.141258, 8.274356, 0}, - {5.651509, 0.290895, 8.311465, 0}, - {5.661086, 0.392649, 8.327028, 0}, - {5.258861, 0.590170, 8.374912, 0}, - {6.062115, 0.117316, 7.928393, 0}, - {6.623555, -0.246603, 7.491452, 0}, - {6.019019, 0.135272, 7.080847, 0}, - {6.084859, 0.463278, 7.062890, 0}, - {5.912477, 0.451307, 7.258018, 0}, - {5.827483, 0.532710, 7.372939, 0}, - {5.821497, 0.537498, 7.540533, 0}, - {5.737700, 0.536301, 7.648272, 0}, - {5.851425, 0.383072, 7.718901, 0}, - {6.072888, 0.365116, 7.699748, 0}, - {5.929236, 0.392649, 7.878115, 0}, - {5.967544, 0.354342, 8.107959, 0}, - {6.045355, 0.253785, 8.421598, 0}, - {5.923251, 0.323217, 8.574827, 0}, - {5.803541, 0.372298, 8.486242, 0}, - {5.785584, 0.416591, 8.215697, 0}, - {5.768825, 0.496797, 7.946350, 0}, - {5.838257, 0.527921, 7.711719, 0}, - {5.963953, 0.471657, 7.472299, 0}, - {5.986697, 0.430956, 7.435188, 0}, - {5.928040, 0.436942, 7.484270, 0}, - {5.907689, 0.472855, 7.449553, 0}, - {5.935222, 0.456095, 7.354982, 0}, - {5.959164, 0.450110, 7.420823, 0}, - {5.960361, 0.391452, 7.717704, 0}, - {5.880156, 0.399831, 7.902057, 0}, - {5.771219, 0.411802, 7.936773, 0}, - {5.997471, 0.266953, 8.137886, 0}, - {5.945996, 0.380678, 8.301888, 0}, - {5.877761, 0.434547, 8.265976, 0}, - {5.904098, 0.408211, 7.947547, 0}, - {5.918463, 0.432153, 7.615951, 0}, - {5.869381, 0.438139, 7.486664, 0}, - {5.837060, 0.451307, 7.556096, 0}, - {5.900506, 0.465672, 7.654258, 0}, - {5.870579, 0.454898, 7.651864, 0}, - {5.875367, 0.454898, 7.615951, 0}, - {5.887338, 0.451307, 7.697353, 0}, - {5.850228, 0.456095, 7.779953, 0}, - {5.858608, 0.477643, 7.884101, 0}, - {5.749671, 0.506373, 7.787136, 0}, - {5.683831, 0.507570, 7.660243, 0}, - {5.740095, 0.469263, 7.811078, 0}, - {5.766431, 0.405817, 8.002614, 0}, - {5.714955, 0.442927, 8.042118, 0}, - {5.723335, 0.399831, 8.002614, 0}, - {5.712561, 0.343568, 7.995431, 0}, - {5.741292, 0.323217, 8.110353, 0}, - {5.766431, 0.349553, 8.237246, 0}, - {5.704182, 0.367510, 8.276750, 0}, - {5.651509, 0.348356, 8.161828, 0}, - {5.655100, 0.367510, 7.977475, 0}, - {5.770022, 0.269348, 8.037330, 0}, - {5.765234, 0.149638, 8.125915, 0}, - {5.671860, 0.073023, 7.973883, 0}, - {5.667071, 0.105345, 7.836217, 0}, - {5.662283, 0.092177, 7.824246, 0}, - {5.702984, 0.031125, 7.970292, 0}, - {5.731715, -0.005986, 8.169010, 0}, - {5.705379, -0.038307, 8.178588, 0}, - {5.635947, -0.082600, 8.060075, 0}, - {5.614399, -0.087388, 7.846991, 0}, - {5.607216, -0.051475, 7.807487, 0}, - {5.610808, -0.033519, 7.864947, 0}, - {5.594049, 0.014365, 7.959518, 0}, - {5.595245, 0.070629, 8.085214, 0}, - {5.577289, 0.046687, 8.267173, 0}, - {5.512646, -0.061052, 8.195347, 0}, - {5.414484, -0.068235, 7.988248, 0}, - {5.358220, 0.023942, 7.862553, 0}, - {5.412089, 0.094571, 7.925999, 0}, - {5.420469, 0.159214, 8.106761, 0}, - {5.276817, 0.208295, 8.341393, 0}, - {5.264846, 0.239420, 8.215697, 0}, - {5.281605, 0.105345, 8.564054, 0}, - {5.311533, -0.020351, 8.683764, 0}, - {5.209779, 0.087388, 8.489834, 0}, - {5.149924, 0.135272, 8.765166, 0}, - {5.169078, 0.017957, 9.282313, 0}, - {5.274423, -0.105345, 9.628276, 0}, - {5.270832, -0.059855, 9.247598, 0}, - {5.166684, 0.098162, 8.629894, 0}, - {5.128376, 0.126893, 8.294706, 0}, - {5.119997, 0.088585, 8.373714, 0}, - {5.146333, 0.090980, 8.540112, 0}, - {5.112814, 0.226252, 8.293509, 0}, - {5.086478, 0.238223, 8.079228, 0}, - {5.076901, 0.137667, 8.086411, 0}, - {5.064930, 0.064643, 8.396460, 0}, - {5.090069, 0.101754, 8.791503, 0}, - {5.090069, 0.272939, 9.018951, 0}, - {5.106829, 0.399831, 8.947125, 0}, - {5.129574, 0.401029, 8.738831, 0}, - {5.143939, 0.233435, 8.713691, 0}, - {5.165487, 0.124498, 8.570039, 0}, - {5.170275, 0.147243, 8.276750, 0}, - {5.114011, 0.207098, 7.818260, 0}, - {5.033806, 0.308852, 7.491452, 0}, - {5.043383, 0.314837, 7.789530, 0}, - {5.061339, 0.219069, 8.386883, 0}, - {5.069719, 0.137667, 8.644259, 0}, - {5.058945, 0.147243, 8.481454, 0}, - {5.007470, 0.186748, 8.107959, 0}, - {4.957191, 0.214281, 8.024161, 0}, - {5.048171, 0.130484, 8.451527, 0}, - {5.088872, 0.058658, 8.924380, 0}, - {5.104434, -0.016759, 9.154224, 0}, - {5.117603, -0.027533, 8.935155, 0}, - {5.018243, 0.071826, 8.637076, 0}, - {4.983528, 0.090980, 8.604755, 0}, - {5.019441, 0.026336, 8.650245, 0}, - {5.030214, -0.013168, 8.646653, 0}, - {4.939235, -0.026336, 8.565250, 0}, - {4.879380, -0.089783, 8.562857, 0}, - {4.832693, -0.186748, 8.906425, 0}, - {4.851846, -0.294487, 9.361322, 0}, - {4.910504, -0.284910, 9.572012, 0}, - {4.920081, -0.166397, 9.233232, 0}, - {4.865015, -0.051475, 8.621514, 0}, - {4.821919, -0.007183, 8.482651, 0}, - {4.851846, -0.021548, 8.792700, 0}, - {4.916490, -0.056264, 9.081201, 0}, - {4.939235, -0.034716, 8.680172, 0}, - {4.878182, 0.039504, 8.130703, 0}, - {4.825510, 0.070629, 8.079228, 0}, - {4.854240, 0.033519, 8.445540, 0}, - {4.932052, -0.016759, 8.767561, 0}, - {4.988316, -0.080206, 8.864526, 0}, - {5.024229, -0.152032, 8.710100, 0}, - {5.026623, -0.175974, 8.593981, 0}, - {5.011061, -0.119710, 8.465892, 0}, - {5.051762, -0.058658, 8.503001, 0}, - {5.104434, 0.028730, 8.389277, 0}, - {5.108026, 0.174777, 8.304283, 0}, - {5.121194, 0.207098, 8.368926, 0}, - {5.137953, 0.177171, 8.186967, 0}, - {5.123588, 0.141258, 8.036133, 0}, - {5.098449, 0.186748, 8.031344, 0}, - {5.036200, 0.240617, 8.049300, 0}, - {4.977542, 0.316034, 8.190558, 0}, - {4.978739, 0.294487, 8.428782, 0}, - {5.046974, 0.195127, 8.704114, 0}, - {5.042185, 0.211887, 8.719677, 0}, - {4.927264, 0.299275, 8.538915, 0}, - {4.918884, 0.241814, 8.495819, 0}, - {4.897336, 0.189142, 8.492228, 0}, - {4.878182, 0.237026, 8.601164, 0}, - {4.818327, 0.262165, 8.705312, 0}, - {4.871000, 0.172382, 8.791503, 0}, - {4.924870, 0.119710, 8.872906, 0}, - {4.873394, 0.243011, 8.825022, 0}, - {4.832693, 0.408211, 8.659822, 0}, - {4.838678, 0.367510, 8.619121, 0}, - {4.904519, 0.169988, 8.809459, 0}, - {4.926067, 0.071826, 9.058456, 0}, - {4.940432, 0.058658, 8.823824, 0}, - {4.930855, 0.167594, 8.331817, 0}, - {4.918884, 0.266953, 8.265976, 0}, - {4.941629, 0.207098, 8.900438, 0}, - {4.957191, 0.129287, 9.339774, 0}, - {4.915293, 0.180762, 9.089581, 0}, - {4.930855, 0.190339, 8.826219, 0}, - {5.080492, 0.038307, 8.766363, 0}, - {5.204991, -0.108936, 8.631091, 0}, - {5.202597, -0.047884, 8.157040, 0}, - {5.157107, 0.095768, 7.870933, 0}, - {5.164289, 0.168791, 8.019373, 0}, - {5.199006, 0.167594, 8.428782, 0}, - {5.215765, 0.180762, 8.804670, 0}, - {5.201400, 0.278924, 8.614332, 0}, - {5.171472, 0.433350, 8.225274, 0}, - {5.199006, 0.466869, 8.068454, 0}, - {5.245692, 0.434547, 8.081622, 0}, - {5.252875, 0.493205, 8.092396, 0}, - {5.194217, 0.633266, 8.359349, 0}, - {5.155910, 0.772130, 8.494622, 0}, - {5.196611, 0.809240, 8.324634, 0}, - {5.245692, 0.724246, 8.206120, 0}, - {5.252875, 0.677559, 8.295903, 0}, - {5.234919, 0.689530, 8.449132, 0}, - {5.256466, 0.666785, 8.635880, 0}, - {5.276817, 0.672770, 8.653836, 0}, - {5.300759, 0.682347, 8.694537, 0}, - {5.352234, 0.640449, 8.677778, 0}, - {5.373782, 0.659602, 8.445540, 0}, - {5.371388, 0.752976, 8.093594, 0}, - {5.348643, 0.889445, 7.916422, 0}, - {5.337869, 0.974439, 8.097184, 0}, - {5.346249, 0.991199, 8.227669, 0}, - {5.382162, 0.978031, 8.289918, 0}, - {5.436031, 0.922964, 8.264779, 0}, - {5.408498, 0.940921, 8.136689, 0}, - {5.376176, 0.939724, 8.165420, 0}, - {5.364205, 0.924161, 8.331817, 0}, - {5.351037, 0.873883, 8.446738, 0}, - {5.334278, 0.855927, 8.334210, 0}, - {5.292379, 0.861912, 8.178588, 0}, - {5.298365, 0.858321, 8.146266, 0}, - {5.319912, 0.841561, 8.136689, 0}, - {5.353431, 0.793677, 8.121126, 0}, - {5.378571, 0.736217, 8.218092, 0}, - {5.397724, 0.694318, 8.354561, 0}, - {5.367796, 0.709880, 8.420402, 0}, - {5.335475, 0.749385, 8.528141, 0}, - {5.313927, 0.818816, 8.493424, 0}, - {5.306745, 0.889445, 8.315057, 0}, - {5.333081, 0.893037, 8.216895, 0}, - {5.345052, 0.899022, 8.208515, 0}, - {5.348643, 0.920570, 8.322240, 0}, - {5.346249, 0.955286, 8.494622, 0}, - {5.325898, 0.984016, 8.801080, 0}, - {5.355825, 0.998381, 9.132676, 0}, - {5.388147, 0.967257, 9.349351, 0}, - {5.489901, 0.889445, 9.421177, 0}, - {5.553347, 0.900219, 9.010572, 0}, - {5.532996, 1.004367, 8.176193, 0}, - {5.509054, 1.109712, 7.471101, 0}, - {5.504266, 1.175552, 7.400473, 0}, - {5.482718, 1.159990, 7.684185, 0}, - {5.443214, 1.177946, 8.027753, 0}, - {5.426455, 1.201888, 8.292312, 0}, - {5.492295, 1.139639, 8.359349, 0}, - {5.532996, 1.092952, 8.263581, 0}, - {5.522223, 1.072602, 7.959518, 0}, - {5.504266, 1.033097, 7.606374, 0}, - {5.524617, 0.958877, 7.461524, 0}, - {5.505463, 0.876277, 7.580038, 0}, - {5.458776, 0.823605, 7.835020, 0}, - {5.432440, 0.756567, 8.016979, 0}, - {5.386950, 0.760159, 8.174996, 0}, - {5.400118, 0.748188, 8.362941, 0}, - {5.449199, 0.687135, 8.324634, 0}, - {5.426455, 0.701501, 7.993037, 0}, - {5.407301, 0.751779, 7.637498, 0}, - {5.455185, 0.737414, 7.868538, 0}, - {5.456382, 0.735019, 8.342590, 0}, - {5.409695, 0.805648, 8.420402, 0}, - {5.379767, 0.878671, 8.323437, 0}, - {5.433637, 0.877474, 8.230062, 0}, - {5.477930, 0.864306, 8.248019, 0}, - {5.511448, 0.831985, 8.370124, 0}, - {5.525814, 0.817619, 8.439555, 0}, - {5.498281, 0.797269, 8.486242, 0}, - {5.485112, 0.806845, 8.465892, 0}, - {5.480324, 0.830787, 8.364138, 0}, - {5.485112, 0.831985, 8.337802, 0}, - {5.487506, 0.854729, 8.340196, 0}, - {5.434834, 0.873883, 8.372518, 0}, - {5.397724, 0.854729, 8.346182, 0}, - {5.392936, 0.869095, 8.216895, 0}, - {5.373782, 0.891840, 8.018176, 0}, - {5.401315, 0.872686, 7.902057, 0}, - {5.448002, 0.833182, 7.929591, 0}, - {5.425257, 0.835576, 8.146266, 0}, - {5.413286, 0.849941, 8.409628, 0}, - {5.421666, 0.837970, 8.495819, 0}, - {5.434834, 0.802057, 8.402445, 0}, - {5.456382, 0.772130, 8.238442, 0}, - {5.482718, 0.749385, 8.231260, 0}, - {5.497083, 0.744596, 8.304283, 0}, - {5.479127, 0.781706, 8.298298, 0}, - {5.432440, 0.882263, 8.295903, 0}, - {5.404907, 0.958877, 8.201332, 0}, - {5.397724, 0.944512, 8.110353, 0}, - {5.394133, 0.920570, 8.216895, 0}, - {5.437228, 0.899022, 8.328225, 0}, - {5.474339, 0.902613, 8.413219, 0}, - {5.529405, 0.889445, 8.447935, 0}, - {5.590457, 0.873883, 8.355759, 0}, - {5.612005, 0.877474, 8.292312, 0}, - {5.613202, 0.870292, 8.209712, 0}, - {5.585669, 0.913387, 8.025358, 0}, - {5.511448, 0.933738, 7.991840, 0}, - {5.475535, 0.949300, 8.026556, 0}, - {5.463564, 0.999579, 8.031344, 0}, - {5.469550, 0.994790, 7.918817, 0}, - {5.504266, 0.974439, 7.881707, 0}, - {5.546165, 0.991199, 7.955927, 0}, - {5.553347, 0.997184, 8.128309, 0}, - {5.567712, 1.010352, 8.230062, 0}, - {5.553347, 1.048660, 8.279144, 0}, - {5.578486, 1.033097, 8.268370, 0}, - {5.571303, 1.016338, 8.101973, 0}, - {5.543770, 0.985213, 7.933182, 0}, - {5.550953, 0.909796, 7.971489, 0}, - {5.547361, 0.855927, 7.951138, 0}, - {5.540179, 0.840364, 7.978672, 0}, - {5.523419, 0.848744, 8.152251, 0}, - {5.491098, 0.853532, 8.298298, 0}, - {5.420469, 0.901416, 8.333014, 0}, - {5.403709, 0.937329, 8.419205, 0}, - {5.440820, 0.964863, 8.601164, 0}, - {5.465959, 0.991199, 8.426387, 0}, - {5.457579, 1.051054, 8.109156, 0}, - {5.437228, 1.104923, 7.977475, 0}, - {5.428849, 1.102529, 8.027753, 0}, - {5.433637, 1.090558, 8.195347, 0}, - {5.432440, 1.100135, 8.276750, 0}, - {5.461170, 1.134851, 8.309072, 0}, - {5.511448, 1.119289, 8.292312, 0}, - {5.540179, 1.089361, 8.316254, 0}, - {5.518631, 1.103726, 8.358152, 0}, - {5.528208, 1.112106, 8.343787, 0}, - {5.527011, 1.094149, 8.257596, 0}, - {5.495886, 1.116894, 8.154645, 0}, - {5.510252, 1.092952, 8.208515, 0}, - {5.538982, 1.058236, 8.158237, 0}, - {5.511448, 1.088164, 7.948744, 0}, - {5.515040, 1.084573, 7.852976, 0}, - {5.507857, 1.104923, 7.959518, 0}, - {5.468353, 1.138442, 8.188165, 0}, - {5.468353, 1.148019, 8.327028, 0}, - {5.481521, 1.133654, 8.289918, 0}, - {5.511448, 1.120486, 8.226472, 0}, - {5.530602, 1.086967, 8.198938, 0}, - {5.529405, 1.065419, 8.166616, 0}, - {5.469550, 1.060631, 8.221684, 0}, - {5.440820, 1.053448, 8.240837, 0}, - {5.396527, 1.053448, 8.213304, 0}, - {5.386950, 1.055842, 8.234851, 0}, - {5.421666, 1.046265, 8.246822, 0}, - {5.431243, 1.029506, 8.155843, 0}, - {5.298365, 1.292868, 5.756854, 0}, - {5.191823, 1.255758, 8.088805, 0}, - {5.204991, 1.169567, 10.260345, 0} -}; - -const size_t kBodyDetectOffOnTestDataLength = - ARRAY_SIZE(kBodyDetectOffOnTestData); - -const struct body_detect_test_data kBodyDetectOnOffTestData[] = { - {-6.536166, 0.264559, 7.560884, 0}, - {-6.253651, 0.108936, 8.167813, 0}, - {-5.890929, -0.029928, 8.061272, 0}, - {-5.833468, -0.045490, 8.250414, 0}, - {-5.932828, 0.038307, 8.573630, 0}, - {-5.995077, 0.104148, 8.634683, 0}, - {-6.080071, 0.181959, 8.317451, 0}, - {-6.069297, 0.177171, 8.151054, 0}, - {-5.978318, 0.113724, 8.407233, 0}, - {-5.895718, 0.033519, 8.592784, 0}, - {-5.828680, -0.022745, 8.299495, 0}, - {-5.768825, -0.070629, 7.958321, 0}, - {-5.770022, -0.089783, 8.028950, 0}, - {-5.832272, -0.074220, 8.360547, 0}, - {-5.880156, -0.067038, 8.488636, 0}, - {-5.987895, -0.017957, 8.342590, 0}, - {-6.148306, 0.014365, 8.317451, 0}, - {-6.337448, 0.102951, 8.492228, 0}, - {-6.411668, 0.148440, 8.571237, 0}, - {-6.341039, 0.099359, 8.250414, 0}, - {-6.232103, 0.067038, 7.899663, 0}, - {-6.172248, 0.100556, 8.152251, 0}, - {-6.095634, 0.111330, 8.632288, 0}, - {-6.033384, 0.126893, 8.614332, 0}, - {-5.936419, 0.131681, 8.136689, 0}, - {-5.931631, 0.205901, 7.739252, 0}, - {-5.986697, 0.271742, 7.870933, 0}, - {-6.040567, 0.250194, 8.099579, 0}, - {-6.077677, 0.244208, 8.191755, 0}, - {-6.071692, 0.277727, 8.146266, 0}, - {-5.953178, 0.292092, 8.025358, 0}, - {-5.847834, 0.330400, 7.942759, 0}, - {-5.776008, 0.392649, 8.036133, 0}, - {-5.680240, 0.417788, 7.892480, 0}, - {-5.617990, 0.458489, 7.609965, 0}, - {-5.550953, 0.496797, 7.418429, 0}, - {-5.301956, 0.369904, 8.050498, 0}, - {-5.276817, 0.290895, 9.167392, 0}, - {-5.890929, 0.215478, 9.044091, 0}, - {-6.495465, 0.108936, 9.111129, 0}, - {-6.545743, -0.049081, 9.390053, 0}, - {-5.966347, -0.161609, 9.362519, 0}, - {-5.325898, -0.117316, 8.969871, 0}, - {-5.263649, 0.105345, 8.404840, 0}, - {-5.620385, 0.336385, 8.085214, 0}, - {-5.886141, 0.472855, 8.037330, 0}, - {-5.704182, 0.427365, 8.032541, 0}, - {-5.359417, 0.301669, 7.813472, 0}, - {-5.331883, 0.329203, 7.632710, 0}, - {-5.483915, 0.433350, 7.621936, 0}, - {-5.862199, 0.703895, 8.079228, 0}, - {-5.808330, 0.616507, 9.142253, 0}, - {-5.513843, 0.481234, 9.751576, 0}, - {-5.365402, 0.470460, 9.706087, 0}, - {-5.378571, 0.440533, 9.333789, 0}, - {-5.637144, 0.565031, 8.905227, 0}, - {-5.776008, 0.560243, 8.019373, 0}, - {-5.779599, 0.676362, 7.132322, 0}, - {-5.549756, 0.760159, 7.116760, 0}, - {-5.303153, 0.730231, 7.817063, 0}, - {-5.206188, 0.831985, 8.506593, 0}, - {-5.151122, 0.725443, 8.941140, 0}, - {-5.292379, 0.556652, 9.176969, 0}, - {-5.622779, 0.563834, 9.362519, 0}, - {-5.481521, 0.433350, 9.410403, 0}, - {-5.045777, -0.074220, 9.109931, 0}, - {-5.035003, -0.328005, 8.900438, 0}, - {-5.307941, -0.389058, 9.000996, 0}, - {-5.561727, -0.269348, 9.169786, 0}, - {-5.603625, 0.213084, 9.216474, 0}, - {-5.357023, 0.697909, 9.339774, 0}, - {-5.081690, 0.764947, 9.429557, 0}, - {-5.063733, 0.520739, 9.349351, 0}, - {-5.212173, 0.463278, 9.210487, 0}, - {-5.079296, 0.622492, 9.057259, 0}, - {-4.827904, 0.758961, 8.755589, 0}, - {-4.689041, 0.723048, 8.749604, 0}, - {-4.681858, 0.731428, 9.129085, 0}, - {-4.598061, 0.723048, 9.536098, 0}, - {-4.378992, 0.730231, 9.668977, 0}, - {-4.214989, 0.672770, 9.102749, 0}, - {-4.241325, 0.641646, 8.643063, 0}, - {-4.289209, 0.708683, 8.941140, 0}, - {-4.304772, 0.984016, 9.394841, 0}, - {-4.106053, 0.980425, 9.239218, 0}, - {-3.926488, 0.615309, 8.754393, 0}, - {-4.012679, 0.414197, 8.646653, 0}, - {-4.191047, 0.730231, 9.080004, 0}, - {-4.211398, 1.057039, 9.763548, 0}, - {-4.055775, 0.944512, 9.933537, 0}, - {-3.976766, 0.493205, 9.303862, 0}, - {-4.319137, 0.397437, 8.835795, 0}, - {-4.368218, 0.577002, 9.014163, 0}, - {-4.213792, 0.700303, 9.281116, 0}, - {-4.164711, 0.563834, 9.527719, 0}, - {-4.132390, 0.458489, 9.472652, 0}, - {-4.106053, 0.392649, 9.238021, 0}, - {-4.090491, 0.524330, 9.093172, 0}, - {-4.052184, 0.738611, 9.153027, 0}, - {-4.015073, 0.524330, 9.047682, 0}, - {-4.149149, 0.454898, 8.930367, 0}, - {-4.250902, 0.724246, 9.131479, 0}, - {-4.231749, 0.701501, 9.166195, 0}, - {-4.356247, 0.757764, 9.208094, 0}, - {-4.443635, 0.785298, 9.235627, 0}, - {-4.355050, 0.804451, 9.149436, 0}, - {-4.307166, 0.567425, 9.187743, 0}, - {-4.550177, 0.476446, 9.249992, 0}, - {-4.790794, 0.457292, 9.175772, 0}, - {-4.935644, 0.417788, 9.200911, 0}, - {-4.940432, 0.588973, 9.419980, 0}, - {-4.709392, 0.357933, 9.624684, 0}, - {-4.763261, 0.093374, 9.773125, 0}, - {-5.021835, 0.171185, 9.756365, 0}, - {-5.087675, 0.294487, 9.680948, 0}, - {-4.916490, 0.357933, 9.610319, 0}, - {-4.729742, 0.360327, 9.296679, 0}, - {-4.635171, 0.266953, 8.780728, 0}, - {-4.843467, 0.410605, 8.383291, 0}, - {-4.898533, 0.500388, 8.177390, 0}, - {-4.692632, 0.489614, 8.313860, 0}, - {-4.566936, 0.451307, 8.595179, 0}, - {-4.624397, 0.457292, 8.774743, 0}, - {-4.781218, 0.441730, 8.777138, 0}, - {-4.916490, 0.410605, 8.816642, 0}, - {-5.014652, 0.482431, 8.795094, 0}, - {-4.830298, 0.306458, 8.991419, 0}, - {-5.154713, 0.448913, 8.974659, 0}, - {-5.114011, 0.424971, 8.789108, 0}, - {-4.894942, 0.238223, 8.692143, 0}, - {-4.979936, 0.184353, 8.980644, 0}, - {-5.267240, 0.381875, 9.326607, 0}, - {-5.289985, 0.413000, 9.498989, 0}, - {-5.128376, 0.320823, 9.273934, 0}, - {-4.978739, 0.312443, 8.930367, 0}, - {-5.054156, 0.391452, 8.816642, 0}, - {-5.224144, 0.409408, 8.898045, 0}, - {-5.287591, 0.392649, 8.862131, 0}, - {-5.182246, 0.426168, 8.808262, 0}, - {-5.039791, 0.471657, 8.797488, 0}, - {-4.969162, 0.490811, 8.793897, 0}, - {-5.032609, 0.511162, 8.804670, 0}, - {-5.021835, 0.465672, 8.822627, 0}, - {-4.967965, 0.496797, 8.820233, 0}, - {-4.969162, 0.571017, 8.796291, 0}, - {-4.904519, 0.560243, 8.785517, 0}, - {-4.750093, 0.547075, 8.775940, 0}, - {-4.687844, 0.500388, 8.554477, 0}, - {-4.741713, 0.487220, 8.224077, 0}, - {-4.880577, 0.569820, 8.147463, 0}, - {-4.959586, 0.610521, 8.506593, 0}, - {-4.977542, 0.555454, 8.856146, 0}, - {-4.910504, 0.424971, 8.870511, 0}, - {-4.947615, 0.316034, 8.845372, 0}, - {-5.177458, 0.336385, 9.156618, 0}, - {-5.345052, 0.371101, 9.455894, 0}, - {-5.370191, 0.402226, 9.381673, 0}, - {-5.357023, 0.372298, 9.232036, 0}, - {-5.309139, 0.289698, 9.148238, 0}, - {-5.236115, 0.247800, 9.085989, 0}, - {-5.159501, 0.211887, 9.010572, 0}, - {-5.081690, 0.173579, 8.878891, 0}, - {-5.049368, 0.208295, 8.710100, 0}, - {-5.026623, 0.229843, 8.664610, 0}, - {-5.032609, 0.237026, 8.772349, 0}, - {-4.967965, 0.233435, 8.868117, 0}, - {-4.844664, 0.164003, 8.799882, 0}, - {-4.906913, 0.155623, 8.500607, 0}, - {-5.141545, 0.264559, 8.359349, 0}, - {-5.264846, 0.310049, 8.640668, 0}, - {-5.348643, 0.306458, 8.961491, 0}, - {-5.366600, 0.301669, 8.968674, 0}, - {-5.404907, 0.298078, 8.802277, 0}, - {-5.386950, 0.259771, 8.801080, 0}, - {-5.335475, 0.208295, 8.759181, 0}, - {-5.300759, 0.174777, 8.723268, 0}, - {-5.237313, 0.147243, 8.762773, 0}, - {-5.303153, 0.185551, 8.772349, 0}, - {-5.394133, 0.204704, 8.888468, 0}, - {-5.383359, 0.167594, 8.965082, 0}, - {-5.257663, 0.110133, 8.893256, 0}, - {-5.116405, 0.039504, 8.738831, 0}, - {-5.194217, 0.044293, 8.644259, 0}, - {-5.336672, 0.111330, 8.772349, 0}, - {-5.389344, 0.132878, 8.972264, 0}, - {-5.400118, 0.136469, 8.959097, 0}, - {-5.455185, 0.185551, 8.850161, 0}, - {-5.519828, 0.210690, 8.804670, 0}, - {-5.555741, 0.210690, 8.898045, 0}, - {-5.507857, 0.222661, 8.835795, 0}, - {-5.402513, 0.205901, 8.598769, 0}, - {-5.368994, 0.257377, 8.353364, 0}, - {-5.437228, 0.366313, 8.394066, 0}, - {-5.401315, 0.345962, 8.656230, 0}, - {-5.341460, 0.350750, 8.723268, 0}, - {-5.272028, 0.362721, 8.585602, 0}, - {-5.282803, 0.387860, 8.337802, 0}, - {-5.285197, 0.420182, 8.268370, 0}, - {-5.250481, 0.415394, 8.337802, 0}, - {-5.185837, 0.379481, 8.416810, 0}, - {-5.161895, 0.356736, 8.468286, 0}, - {-5.203794, 0.344765, 8.577222, 0}, - {-5.272028, 0.306458, 8.719677, 0}, - {-5.315124, 0.271742, 8.868117, 0}, - {-5.337869, 0.296881, 8.939943, 0}, - {-5.376176, 0.299275, 8.894453, 0}, - {-5.442017, 0.318429, 8.793897, 0}, - {-5.452791, 0.331597, 8.714889, 0}, - {-5.412089, 0.289698, 8.700523, 0}, - {-5.406104, 0.251391, 8.773546, 0}, - {-5.368994, 0.252588, 8.866920, 0}, - {-5.323504, 0.240617, 8.942337, 0}, - {-5.333081, 0.231040, 9.015361, 0}, - {-5.377373, 0.231040, 8.980644, 0}, - {-5.450397, 0.292092, 8.865723, 0}, - {-5.483915, 0.336385, 8.750801, 0}, - {-5.474339, 0.355539, 8.653836, 0}, - {-5.404907, 0.342371, 8.593981, 0}, - {-5.243298, 0.234632, 8.598769, 0}, - {-5.164289, 0.198719, 8.635880, 0}, - {-5.214568, 0.248997, 8.646653, 0}, - {-5.316321, 0.288501, 8.589192, 0}, - {-5.452791, 0.343568, 8.579616, 0}, - {-5.509054, 0.366313, 8.670595, 0}, - {-5.474339, 0.319626, 8.686158, 0}, - {-5.384556, 0.275333, 8.689749, 0}, - {-5.365402, 0.268150, 8.750801, 0}, - {-5.437228, 0.357933, 8.748407, 0}, - {-5.470747, 0.402226, 8.730451, 0}, - {-5.386950, 0.362721, 8.672990, 0}, - {-5.339066, 0.363918, 8.700523, 0}, - {-5.295970, 0.398634, 8.793897, 0}, - {-5.307941, 0.413000, 8.899241, 0}, - {-5.295970, 0.392649, 8.924380, 0}, - {-5.287591, 0.405817, 8.936352, 0}, - {-5.269634, 0.417788, 8.896848, 0}, - {-5.342658, 0.471657, 8.640668, 0}, - {-5.464762, 0.557849, 8.434767, 0}, - {-5.467156, 0.575805, 8.456315, 0}, - {-5.443214, 0.561440, 8.497016, 0}, - {-5.440820, 0.574608, 8.524549, 0}, - {-5.438426, 0.598550, 8.480257, 0}, - {-5.348643, 0.553060, 8.530535, 0}, - {-5.238510, 0.509965, 8.638274, 0}, - {-5.155910, 0.445321, 8.657428, 0}, - {-5.111617, 0.395043, 8.583207, 0}, - {-5.115209, 0.365116, 8.610741, 0}, - {-5.176260, 0.344765, 8.625106, 0}, - {-5.254072, 0.373495, 8.711297, 0}, - {-5.267240, 0.379481, 8.808262, 0}, - {-5.238510, 0.329203, 8.795094, 0}, - {-5.266043, 0.282516, 8.694537, 0}, - {-5.410892, 0.308852, 8.599967, 0}, - {-5.538982, 0.337582, 8.520958, 0}, - {-5.544967, 0.344765, 8.590390, 0}, - {-5.458776, 0.276530, 8.730451, 0}, - {-5.408498, 0.211887, 8.729254, 0}, - {-5.450397, 0.195127, 8.633486, 0}, - {-5.509054, 0.216675, 8.659822, 0}, - {-5.483915, 0.190339, 8.823824, 0}, - {-5.430046, 0.169988, 9.004586, 0}, - {-5.392936, 0.186748, 9.078807, 0}, - {-5.406104, 0.197522, 9.024938, 0}, - {-5.462368, 0.269348, 8.857343, 0}, - {-5.462368, 0.290895, 8.724465, 0}, - {-5.409695, 0.284910, 8.667005, 0}, - {-5.389344, 0.288501, 8.643063, 0}, - {-5.354629, 0.284910, 8.577222, 0}, - {-5.329489, 0.287304, 8.591587, 0}, - {-5.280408, 0.282516, 8.658625, 0}, - {-5.206188, 0.225055, 8.695735, 0}, - {-5.169078, 0.235829, 8.741224, 0}, - {-5.181049, 0.256179, 8.693340, 0}, - {-5.245692, 0.262165, 8.619121, 0}, - {-5.334278, 0.257377, 8.613134, 0}, - {-5.388147, 0.248997, 8.681370, 0}, - {-5.376176, 0.240617, 8.742421, 0}, - {-5.360614, 0.199916, 8.707705, 0}, - {-5.443214, 0.190339, 8.631091, 0}, - {-5.489901, 0.172382, 8.549688, 0}, - {-5.524617, 0.192733, 8.529338, 0}, - {-5.518631, 0.189142, 8.562857, 0}, - {-5.479127, 0.158017, 8.555674, 0}, - {-5.499477, 0.140061, 8.599967, 0}, - {-5.519828, 0.130484, 8.643063, 0}, - {-5.493492, 0.090980, 8.652639, 0}, - {-5.458776, 0.074220, 8.610741, 0}, - {-5.483915, 0.107739, 8.635880, 0}, - {-5.445608, 0.087388, 8.746013, 0}, - {-5.422863, 0.052672, 8.787911, 0}, - {-5.402513, 0.032322, 8.768758, 0}, - {-5.373782, -0.007183, 8.802277, 0}, - {-5.371388, -0.031125, 8.772349, 0}, - {-5.416878, -0.052672, 8.682567, 0}, - {-5.614399, -0.032322, 8.693340, 0}, - {-5.582078, 0.015562, 8.038527, 0}, - {-5.532996, -0.019154, 8.003811, 1}, - {-5.451593, -0.088585, 8.389277, 0}, - {-5.433637, -0.120907, 8.461103, 0}, - {-5.456382, -0.082600, 8.352167, 0}, - {-5.480324, -0.110133, 8.429978, 0}, - {-5.503069, -0.126893, 8.602361, 0}, - {-5.524617, -0.173579, 8.689749, 0}, - {-5.519828, -0.161609, 8.710100, 0}, - {-5.448002, -0.165200, 8.803473, 0}, - {-5.337869, -0.209493, 8.835795, 0}, - {-5.226539, -0.217872, 8.792700, 0}, - {-5.204991, -0.144849, 8.779531, 0}, - {-5.155910, -0.038307, 8.741224, 0}, - {-5.038594, 0.025139, 8.692143, 0}, - {-4.826707, 0.129287, 8.741224, 0}, - {-4.588484, 0.221464, 9.275131, 0}, - {-4.413708, 0.146046, 9.674962, 0}, - {-4.571725, 0.420182, 9.512156, 0}, - {-4.693829, 0.806845, 9.115917, 0}, - {-4.513067, 1.146822, 8.775940, 0}, - {-3.907335, 0.906205, 8.744816, 0}, - {-3.440465, 0.709880, 8.558068, 0}, - {-3.076547, 0.870292, 8.097184, 0}, - {-2.567780, 0.849941, 7.629118, 0}, - {-0.930147, -0.430956, 9.020149, 0}, - {0.472855, -1.265335, 13.321329, 0}, - {-0.475249, -0.396240, 11.602294, 0}, - {-2.302023, 0.135272, 10.661373, 0}, - {-2.796426, -0.083797, 11.195279, 0}, - {-2.404974, -0.368707, 10.447092, 0}, - {-1.205480, -0.381875, 9.781505, 0}, - {-0.250194, 0.064643, 9.928748, 0}, - {-0.004788, 0.374692, 9.695313, 0}, - {0.256179, -0.470460, 8.904030, 0}, - {0.268150, -0.964863, 8.276750, 0}, - {0.314837, -0.756567, 8.742421, 0}, - {0.496797, -0.694318, 9.910791, 0}, - {0.828393, -0.748188, 10.779886, 0}, - {0.738611, -0.306458, 11.670528, 0}, - {0.616507, -0.045490, 11.973394, 0}, - {0.690727, -0.164003, 11.194082, 0}, - {0.632069, -0.343568, 10.463851, 0}, - {0.422576, 0.026336, 10.319002, 0}, - {0.520739, 0.468066, 10.074794, 0}, - {0.845153, 0.277727, 9.525325, 0}, - {1.058236, -0.199916, 9.085989, 0}, - {1.198297, -0.499191, 9.630670, 0}, - {1.109712, -0.314837, 10.516523, 0}, - {1.086967, 0.258574, 10.805025, 0}, - {1.313219, 0.523133, 10.685315, 0}, - {1.334767, 0.202310, 10.316608, 0}, - {1.298854, -0.199916, 9.993391, 0}, - {1.471236, -0.282516, 10.037683, 0}, - {1.620873, 0.053870, 9.892835, 0}, - {1.553836, 0.363918, 9.296679, 0}, - {1.425746, 0.114922, 8.937549, 0}, - {1.545456, -0.174777, 9.566027, 0}, - {1.985989, 0.075417, 10.395617, 0}, - {2.272096, 0.312443, 10.295060, 0}, - {2.181116, 0.196324, 9.525325, 0}, - {1.965638, 0.197522, 9.500186, 0}, - {2.054224, -0.038307, 9.800658, 0}, - {1.924937, 0.196324, 9.728832, 0}, - {2.146400, 0.402226, 9.747986, 0}, - {2.321177, 0.282516, 9.983814, 0}, - {2.279279, 0.118513, 7.716507, 0}, - {2.229000, -0.113724, 9.612713, 0}, - {2.345119, 0.343568, 11.982971, 0}, - {2.196679, 0.189142, 9.917974, 0}, - {2.218226, -0.119710, 9.633064, 0}, - {2.020705, 0.239420, 9.703692, 0}, - {1.997960, 0.318429, 9.247598, 0}, - {1.975215, 0.132878, 8.886073, 0}, - {1.841140, 0.253785, 8.754393, 0}, - {1.507149, 0.458489, 8.775940, 0}, - {1.295262, 0.497994, 9.170983, 0}, - {1.291671, 0.102951, 9.712072, 0}, - {1.267729, 0.034716, 9.686934, 0}, - {1.474827, -0.047884, 9.932339, 0}, - {1.121683, -0.041899, 10.319002, 0}, - {0.475249, 0.349553, 11.362873, 0}, - {0.029928, 0.153229, 13.443434, 0}, - {1.442506, -0.270545, 12.089513, 0}, - {0.821211, 0.186748, 10.431530, 0}, - {0.302866, 0.573411, 9.538493, 0}, - {0.973242, -0.051475, 8.095987, 0}, - {1.428140, -1.648407, 7.060496, 0}, - {1.292868, -2.129641, 8.062469, 0}, - {0.068235, 0.414197, 8.157040, 0}, - {-1.018732, 1.418563, 9.985011, 0}, - {-1.479616, 1.746569, 18.444918, 0}, - {0.362721, 0.951695, 11.461036, 0}, - {0.283713, -0.120907, 8.001416, 0}, - {-0.320823, 0.131681, 11.031277, 0}, - {-0.141258, 0.141258, 9.783898, 0}, - {-0.098162, 0.118513, 10.248373, 0}, - {-0.278924, 0.311246, 9.223656, 0}, - {-0.034716, 0.162806, 9.734818, 0}, - {-0.282516, -0.306458, 12.023673, 0}, - {-0.219069, 0.069432, 9.692919, 0}, - {-0.235829, 0.088585, 10.111904, 0}, - {-0.243011, 0.071826, 10.181335, 0}, - {-0.237026, 0.084994, 10.177745, 0}, - {-0.246603, 0.079009, 10.078385, 0}, - {-0.222661, 0.083797, 10.192110, 0}, - {-0.252588, 0.067038, 10.103524, 0}, - {-0.226252, 0.084994, 10.156197, 0}, - {-0.265756, 0.071826, 10.116693, 0}, - {-0.235829, 0.083797, 10.168168, 0}, - {-0.251391, 0.083797, 10.108313, 0}, - {-0.248997, 0.083797, 10.155000, 0}, - {-0.228646, 0.083797, 10.122678, 0}, - {-0.266953, 0.067038, 10.104721, 0}, - {-0.233435, 0.074220, 10.141831, 0}, - {-0.259771, 0.080206, 10.107116, 0}, - {-0.245406, 0.080206, 10.166970, 0}, - {-0.256179, 0.075417, 10.099933, 0}, - {-0.243011, 0.070629, 10.153803, 0}, - {-0.256179, 0.073023, 10.090356, 0}, - {-0.258574, 0.077812, 10.200489, 0}, - {-0.253785, 0.063446, 10.095144, 0}, - {-0.245406, 0.073023, 10.135846, 0}, - {-0.251391, 0.082600, 10.134649, 0}, - {-0.251391, 0.068235, 10.116693, 0}, - {-0.247800, 0.079009, 10.164577, 0}, - {-0.244208, 0.075417, 10.115496, 0}, - {-0.238223, 0.073023, 10.137043, 0}, - {-0.251391, 0.077812, 10.078385, 0}, - {-0.235829, 0.077812, 10.131058, 0}, - {-0.250194, 0.087388, 10.123875, 0}, - {-0.250194, 0.079009, 10.147817, 0}, - {-0.254982, 0.064643, 10.110707, 0}, - {-0.256179, 0.083797, 10.151408, 0}, - {-0.237026, 0.079009, 10.103524, 0}, - {-0.256179, 0.079009, 10.137043, 0}, - {-0.246603, 0.081403, 10.139438, 0}, - {-0.243011, 0.077812, 10.115496, 0}, - {-0.254982, 0.063446, 10.159788, 0}, - {-0.248997, 0.089783, 10.092751, 0}, - {-0.251391, 0.074220, 10.164577, 0}, - {-0.246603, 0.079009, 10.117889, 0}, - {-0.247800, 0.086191, 10.145423, 0}, - {-0.247800, 0.088585, 10.123875, 0}, - {-0.254982, 0.075417, 10.122678, 0}, - {-0.250194, 0.080206, 10.147817, 0}, - {-0.251391, 0.068235, 10.113101, 0}, - {-0.246603, 0.074220, 10.147817, 0}, - {-0.243011, 0.068235, 10.104721, 0}, - {-0.245406, 0.063446, 10.143028, 0}, - {-0.250194, 0.075417, 10.121481, 0}, - {-0.252588, 0.079009, 10.141831, 0}, - {-0.245406, 0.071826, 10.129861, 0}, - {-0.240617, 0.079009, 10.135846, 0}, - {-0.240617, 0.069432, 10.141831, 0}, - {-0.245406, 0.079009, 10.121481, 0}, - {-0.252588, 0.069432, 10.160985, 0}, - {-0.258574, 0.067038, 10.121481, 0}, - {-0.260968, 0.067038, 10.140635, 0}, - {-0.250194, 0.068235, 10.127466, 0}, - {-0.239420, 0.074220, 10.129861, 0}, - {-0.250194, 0.065841, 10.131058, 0}, - {-0.245406, 0.074220, 10.128663, 0}, - {-0.247800, 0.088585, 10.133451, 0}, - {-0.245406, 0.082600, 10.105919, 0}, - {-0.251391, 0.067038, 10.133451, 0}, - {-0.241814, 0.075417, 10.121481, 0}, - {-0.247800, 0.075417, 10.140635, 0}, - {-0.254982, 0.080206, 10.132255, 0}, - {-0.237026, 0.074220, 10.137043, 0}, - {-0.251391, 0.082600, 10.135846, 0}, - {-0.247800, 0.095768, 10.135846, 0}, - {-0.244208, 0.075417, 10.115496, 0}, - {-0.245406, 0.074220, 10.138240, 0}, - {-0.239420, 0.080206, 10.137043, 0}, - {-0.257377, 0.073023, 10.128663, 0}, - {-0.253785, 0.081403, 10.134649, 0}, - {-0.256179, 0.061052, 10.137043, 0}, - {-0.243011, 0.082600, 10.129861, 0}, - {-0.246603, 0.080206, 10.116693, 0}, - {-0.240617, 0.080206, 10.120284, 0}, - {-0.251391, 0.069432, 10.109509, 0}, - {-0.247800, 0.073023, 10.144226, 0}, - {-0.248997, 0.077812, 10.110707, 0}, - {-0.256179, 0.065841, 10.134649, 0}, - {-0.246603, 0.071826, 10.111904, 0}, - {-0.265756, 0.075417, 10.123875, 0}, - {-0.245406, 0.084994, 10.131058, 0}, - {-0.251391, 0.073023, 10.114298, 0}, - {-0.247800, 0.090980, 10.145423, 0}, - {-0.263362, 0.088585, 10.121481, 0}, - {-0.258574, 0.074220, 10.149014, 0}, - {-0.252588, 0.069432, 10.114298, 0}, - {-0.259771, 0.074220, 10.121481, 0}, - {-0.251391, 0.068235, 10.137043, 0}, - {-0.245406, 0.074220, 10.131058, 0}, - {-0.244208, 0.074220, 10.121481, 0}, - {-0.253785, 0.070629, 10.108313, 0}, - {-0.256179, 0.077812, 10.144226, 0}, - {-0.241814, 0.058658, 10.104721, 0}, - {-0.244208, 0.069432, 10.133451, 0}, - {-0.241814, 0.081403, 10.113101, 0}, - {-0.253785, 0.080206, 10.110707, 0}, - {-0.257377, 0.086191, 10.121481, 0}, - {-0.252588, 0.080206, 10.129861, 0}, - {-0.246603, 0.081403, 10.121481, 0}, - {-0.245406, 0.086191, 10.123875, 0}, - {-0.251391, 0.076614, 10.153803, 0}, - {-0.246603, 0.068235, 10.120284, 0}, - {-0.234632, 0.090980, 10.134649, 0}, - {-0.253785, 0.080206, 10.098736, 0}, - {-0.256179, 0.093374, 10.135846, 0}, - {-0.259771, 0.076614, 10.126269, 0}, - {-0.240617, 0.074220, 10.147817, 0}, - {-0.256179, 0.068235, 10.119086, 0}, - {-0.254982, 0.073023, 10.120284, 0}, - {-0.250194, 0.082600, 10.143028, 0}, - {-0.250194, 0.076614, 10.115496, 0}, - {-0.247800, 0.068235, 10.145423, 0}, - {-0.241814, 0.077812, 10.122678, 0}, - {-0.245406, 0.079009, 10.138240, 0}, - {-0.266953, 0.083797, 10.111904, 0}, - {-0.254982, 0.074220, 10.116693, 0}, - {-0.248997, 0.090980, 10.138240, 0}, - {-0.262165, 0.083797, 10.123875, 0}, - {-0.245406, 0.081403, 10.128663, 0}, - {-0.252588, 0.065841, 10.103524, 0}, - {-0.248997, 0.089783, 10.128663, 0}, - {-0.250194, 0.070629, 10.108313, 0}, - {-0.248997, 0.068235, 10.147817, 0}, - {-0.251391, 0.083797, 10.125072, 0}, - {-0.258574, 0.070629, 10.125072, 0}, - {-0.259771, 0.058658, 10.125072, 0}, - {-0.246603, 0.070629, 10.120284, 0}, - {-0.243011, 0.064643, 10.128663, 0}, - {-0.263362, 0.073023, 10.134649, 0}, - {-0.246603, 0.076614, 10.140635, 0}, - {-0.246603, 0.084994, 10.122678, 0}, - {-0.241814, 0.068235, 10.131058, 0}, - {-0.243011, 0.073023, 10.115496, 0}, - {-0.252588, 0.074220, 10.157393, 0}, - {-0.264559, 0.076614, 10.105919, 0}, - {-0.254982, 0.069432, 10.135846, 0}, - {-0.234632, 0.075417, 10.126269, 0}, - {-0.239420, 0.080206, 10.120284, 0}, - {-0.251391, 0.087388, 10.146620, 0}, - {-0.238223, 0.069432, 10.126269, 0}, - {-0.247800, 0.065841, 10.127466, 0}, - {-0.253785, 0.069432, 10.113101, 0}, - {-0.252588, 0.079009, 10.144226, 0}, - {-0.254982, 0.074220, 10.123875, 0}, - {-0.247800, 0.061052, 10.134649, 0}, - {-0.248997, 0.067038, 10.119086, 0}, - {-0.247800, 0.077812, 10.123875, 0}, - {-0.253785, 0.079009, 10.134649, 0}, - {-0.246603, 0.084994, 10.111904, 0}, - {-0.253785, 0.087388, 10.139438, 0}, - {-0.256179, 0.082600, 10.097539, 0}, - {-0.240617, 0.087388, 10.149014, 0}, - {-0.252588, 0.059855, 10.108313, 0}, - {-0.235829, 0.082600, 10.129861, 0}, - {-0.247800, 0.094571, 10.127466, 0}, - {-0.248997, 0.082600, 10.122678, 0}, - {-0.240617, 0.084994, 10.131058, 0}, - {-0.253785, 0.077812, 10.116693, 0}, - {-0.258574, 0.086191, 10.133451, 0}, - {-0.247800, 0.071826, 10.128663, 0}, - {-0.247800, 0.074220, 10.132255, 0}, - {-0.254982, 0.071826, 10.120284, 0}, - {-0.253785, 0.080206, 10.140635, 0}, - {-0.269348, 0.076614, 10.132255, 0}, - {-0.253785, 0.082600, 10.131058, 0}, - {-0.244208, 0.089783, 10.140635, 0}, - {-0.247800, 0.073023, 10.110707, 0}, - {-0.252588, 0.070629, 10.129861, 0}, - {-0.257377, 0.071826, 10.125072, 0}, - {-0.252588, 0.074220, 10.117889, 0}, - {-0.254982, 0.068235, 10.128663, 0}, - {-0.259771, 0.058658, 10.134649, 0}, - {-0.252588, 0.070629, 10.119086, 0}, - {-0.243011, 0.089783, 10.146620, 0}, - {-0.240617, 0.075417, 10.128663, 0}, - {-0.254982, 0.063446, 10.145423, 0}, - {-0.272939, 0.081403, 10.127466, 0}, - {-0.241814, 0.075417, 10.127466, 0}, - {-0.233435, 0.073023, 10.125072, 0}, - {-0.248997, 0.080206, 10.132255, 0}, - {-0.241814, 0.074220, 10.134649, 0}, - {-0.266953, 0.068235, 10.133451, 0}, - {-0.245406, 0.069432, 10.127466, 0}, - {-0.247800, 0.087388, 10.131058, 0}, - {-0.247800, 0.082600, 10.129861, 0}, - {-0.257377, 0.070629, 10.137043, 0}, - {-0.247800, 0.074220, 10.131058, 0}, - {-0.252588, 0.086191, 10.114298, 0}, - {-0.247800, 0.089783, 10.135846, 0}, - {-0.256179, 0.073023, 10.131058, 0}, - {-0.257377, 0.080206, 10.133451, 0}, - {-0.245406, 0.069432, 10.125072, 0}, - {-0.250194, 0.061052, 10.126269, 0}, - {-0.252588, 0.079009, 10.135846, 0}, - {-0.250194, 0.073023, 10.128663, 0}, - {-0.237026, 0.075417, 10.155000, 0}, - {-0.247800, 0.079009, 10.140635, 0}, - {-0.251391, 0.069432, 10.151408, 0}, - {-0.244208, 0.075417, 10.127466, 0}, - {-0.252588, 0.071826, 10.111904, 0}, - {-0.257377, 0.077812, 10.138240, 0}, - {-0.241814, 0.069432, 10.122678, 0}, - {-0.253785, 0.071826, 10.139438, 0}, - {-0.256179, 0.077812, 10.119086, 0}, - {-0.262165, 0.077812, 10.133451, 0}, - {-0.252588, 0.061052, 10.132255, 0}, - {-0.250194, 0.077812, 10.119086, 0}, - {-0.253785, 0.081403, 10.132255, 0}, - {-0.253785, 0.079009, 10.117889, 0}, - {-0.252588, 0.064643, 10.129861, 0}, - {-0.247800, 0.073023, 10.117889, 0}, - {-0.253785, 0.065841, 10.126269, 0}, - {-0.256179, 0.069432, 10.128663, 0}, - {-0.250194, 0.080206, 10.128663, 0}, - {-0.257377, 0.084994, 10.107116, 0}, - {-0.254982, 0.080206, 10.137043, 0}, - {-0.259771, 0.076614, 10.137043, 0}, - {-0.265756, 0.063446, 10.132255, 0}, - {-0.251391, 0.056264, 10.120284, 0}, - {-0.247800, 0.067038, 10.132255, 0}, - {-0.247800, 0.074220, 10.126269, 0}, - {-0.247800, 0.070629, 10.127466, 0}, - {-0.239420, 0.081403, 10.143028, 0}, - {-0.254982, 0.081403, 10.129861, 0}, - {-0.259771, 0.088585, 10.138240, 0}, - {-0.246603, 0.080206, 10.108313, 0}, - {-0.252588, 0.086191, 10.125072, 0}, - {-0.247800, 0.071826, 10.132255, 0}, - {-0.240617, 0.073023, 10.126269, 0}, - {-0.256179, 0.075417, 10.134649, 0}, - {-0.254982, 0.081403, 10.117889, 0}, - {-0.250194, 0.070629, 10.133451, 0}, - {-0.254982, 0.064643, 10.137043, 0}, - {-0.254982, 0.075417, 10.147817, 0}, - {-0.240617, 0.077812, 10.122678, 0}, - {-0.239420, 0.083797, 10.153803, 0}, - {-0.258574, 0.070629, 10.131058, 0}, - {-0.256179, 0.077812, 10.133451, 0}, - {-0.265756, 0.080206, 10.143028, 0}, - {-0.256179, 0.070629, 10.138240, 0}, - {-0.250194, 0.067038, 10.129861, 0}, - {-0.245406, 0.071826, 10.126269, 0}, - {-0.259771, 0.073023, 10.135846, 0}, - {-0.251391, 0.061052, 10.121481, 0}, - {-0.254982, 0.075417, 10.150211, 0}, - {-0.247800, 0.081403, 10.137043, 0}, - {-0.248997, 0.084994, 10.126269, 0}, - {-0.257377, 0.082600, 10.135846, 0}, - {-0.257377, 0.073023, 10.110707, 0}, - {-0.251391, 0.077812, 10.138240, 0}, - {-0.238223, 0.064643, 10.116693, 0}, - {-0.239420, 0.075417, 10.138240, 0}, - {-0.260968, 0.071826, 10.132255, 0}, - {-0.253785, 0.094571, 10.132255, 0}, - {-0.248997, 0.081403, 10.127466, 0}, - {-0.245406, 0.073023, 10.150211, 0}, - {-0.252588, 0.080206, 10.120284, 0}, - {-0.247800, 0.075417, 10.122678, 0}, - {-0.246603, 0.069432, 10.122678, 0}, - {-0.246603, 0.090980, 10.119086, 0}, - {-0.253785, 0.076614, 10.139438, 0}, - {-0.253785, 0.063446, 10.127466, 0}, - {-0.248997, 0.094571, 10.146620, 0}, - {-0.257377, 0.079009, 10.115496, 0}, - {-0.247800, 0.068235, 10.122678, 0}, - {-0.244208, 0.080206, 10.117889, 0}, - {-0.257377, 0.099359, 10.134649, 0}, - {-0.257377, 0.089783, 10.111904, 0}, - {-0.247800, 0.073023, 10.133451, 0}, - {-0.238223, 0.070629, 10.120284, 0}, - {-0.256179, 0.073023, 10.125072, 0}, - {-0.257377, 0.063446, 10.144226, 0}, - {-0.259771, 0.081403, 10.122678, 0}, - {-0.251391, 0.079009, 10.123875, 0}, - {-0.256179, 0.068235, 10.122678, 0}, - {-0.252588, 0.065841, 10.128663, 0}, - {-0.239420, 0.074220, 10.122678, 0}, - {-0.247800, 0.073023, 10.138240, 0}, - {-0.245406, 0.076614, 10.111904, 0}, - {-0.252588, 0.076614, 10.125072, 0}, - {-0.259771, 0.059855, 10.122678, 0}, - {-0.262165, 0.067038, 10.137043, 0}, - {-0.248997, 0.073023, 10.127466, 0}, - {-0.248997, 0.076614, 10.132255, 0}, - {-0.244208, 0.080206, 10.115496, 0}, - {-0.245406, 0.055067, 10.140635, 0}, - {-0.251391, 0.059855, 10.135846, 0}, - {-0.246603, 0.073023, 10.111904, 0}, - {-0.248997, 0.081403, 10.123875, 0}, - {-0.248997, 0.070629, 10.126269, 0}, - {-0.251391, 0.075417, 10.129861, 0}, - {-0.239420, 0.071826, 10.139438, 0}, - {-0.244208, 0.076614, 10.109509, 0}, - {-0.263362, 0.082600, 10.135846, 0}, - {-0.252588, 0.071826, 10.127466, 0}, - {-0.241814, 0.067038, 10.122678, 0}, - {-0.252588, 0.079009, 10.125072, 0}, - {-0.260968, 0.084994, 10.125072, 0}, - {-0.245406, 0.080206, 10.119086, 0}, - {-0.241814, 0.071826, 10.126269, 0}, - {-0.251391, 0.075417, 10.135846, 0}, - {-0.254982, 0.068235, 10.127466, 0}, - {-0.260968, 0.074220, 10.127466, 0}, - {-0.247800, 0.076614, 10.122678, 0}, - {-0.258574, 0.067038, 10.114298, 0}, - {-0.258574, 0.073023, 10.122678, 0}, - {-0.257377, 0.058658, 10.145423, 0}, - {-0.254982, 0.063446, 10.127466, 0}, - {-0.245406, 0.068235, 10.135846, 0}, - {-0.247800, 0.071826, 10.135846, 0}, - {-0.256179, 0.068235, 10.138240, 0}, - {-0.257377, 0.074220, 10.113101, 0}, - {-0.244208, 0.081403, 10.139438, 0}, - {-0.241814, 0.061052, 10.131058, 0}, - {-0.257377, 0.073023, 10.116693, 0}, - {-0.256179, 0.083797, 10.129861, 0}, - {-0.240617, 0.084994, 10.121481, 0}, - {-0.239420, 0.073023, 10.135846, 0}, - {-0.252588, 0.074220, 10.132255, 0}, - {-0.252588, 0.077812, 10.127466, 0}, - {-0.251391, 0.082600, 10.140635, 0}, - {-0.256179, 0.077812, 10.129861, 0}, - {-0.254982, 0.064643, 10.117889, 0}, - {-0.263362, 0.065841, 10.122678, 0}, - {-0.252588, 0.079009, 10.135846, 0}, - {-0.248997, 0.075417, 10.127466, 0}, - {-0.238223, 0.079009, 10.133451, 0}, - {-0.244208, 0.080206, 10.133451, 0}, - {-0.254982, 0.076614, 10.150211, 0}, - {-0.264559, 0.068235, 10.141831, 0}, - {-0.246603, 0.077812, 10.132255, 0}, - {-0.262165, 0.070629, 10.134649, 0}, - {-0.258574, 0.062249, 10.129861, 0}, - {-0.259771, 0.071826, 10.133451, 0}, - {-0.243011, 0.086191, 10.125072, 0}, - {-0.250194, 0.074220, 10.125072, 0}, - {-0.260968, 0.059855, 10.101130, 0}, - {-0.252588, 0.063446, 10.129861, 0}, - {-0.251391, 0.079009, 10.128663, 0}, - {-0.252588, 0.069432, 10.138240, 0}, - {-0.246603, 0.074220, 10.141831, 0}, - {-0.250194, 0.080206, 10.117889, 0}, - {-0.256179, 0.068235, 10.131058, 0}, - {-0.258574, 0.058658, 10.110707, 0}, - {-0.244208, 0.073023, 10.137043, 0}, - {-0.260968, 0.076614, 10.117889, 0}, - {-0.245406, 0.081403, 10.119086, 0}, - {-0.243011, 0.077812, 10.135846, 0}, - {-0.256179, 0.069432, 10.131058, 0}, - {-0.245406, 0.079009, 10.121481, 0}, - {-0.250194, 0.086191, 10.129861, 0}, - {-0.245406, 0.089783, 10.132255, 0}, - {-0.241814, 0.077812, 10.147817, 0}, - {-0.244208, 0.076614, 10.133451, 0}, - {-0.263362, 0.075417, 10.096342, 0}, - {-0.250194, 0.058658, 10.134649, 0}, - {-0.231040, 0.068235, 10.117889, 0}, - {-0.250194, 0.069432, 10.144226, 0}, - {-0.263362, 0.073023, 10.117889, 0}, - {-0.241814, 0.071826, 10.133451, 0}, - {-0.240617, 0.073023, 10.131058, 0}, - {-0.237026, 0.082600, 10.116693, 0}, - {-0.239420, 0.080206, 10.138240, 0}, - {-0.259771, 0.079009, 10.139438, 0}, - {-0.266953, 0.071826, 10.140635, 0}, - {-0.251391, 0.071826, 10.107116, 0}, - {-0.258574, 0.073023, 10.132255, 0}, - {-0.243011, 0.090980, 10.132255, 0}, - {-0.234632, 0.064643, 10.129861, 0}, - {-0.250194, 0.059855, 10.134649, 0}, - {-0.238223, 0.081403, 10.140635, 0}, - {-0.243011, 0.077812, 10.131058, 0}, - {-0.247800, 0.069432, 10.143028, 0}, - {-0.247800, 0.067038, 10.135846, 0}, - {-0.243011, 0.065841, 10.128663, 0}, - {-0.253785, 0.077812, 10.129861, 0}, - {-0.244208, 0.080206, 10.107116, 0}, - {-0.244208, 0.074220, 10.143028, 0}, - {-0.253785, 0.080206, 10.119086, 0}, - {-0.247800, 0.070629, 10.139438, 0}, - {-0.243011, 0.082600, 10.125072, 0}, - {-0.257377, 0.075417, 10.150211, 0}, - {-0.263362, 0.077812, 10.152605, 0}, - {-0.263362, 0.081403, 10.135846, 0}, - {-0.250194, 0.075417, 10.139438, 0}, - {-0.248997, 0.077812, 10.131058, 0}, - {-0.247800, 0.074220, 10.127466, 0}, - {-0.243011, 0.069432, 10.122678, 0}, - {-0.251391, 0.079009, 10.133451, 0}, - {-0.252588, 0.061052, 10.126269, 0}, - {-0.265756, 0.081403, 10.128663, 0}, - {-0.244208, 0.064643, 10.122678, 0}, - {-0.256179, 0.065841, 10.123875, 0}, - {-0.263362, 0.076614, 10.125072, 0}, - {-0.252588, 0.079009, 10.126269, 0}, - {-0.252588, 0.070629, 10.115496, 0}, - {-0.254982, 0.073023, 10.115496, 0}, - {-0.234632, 0.070629, 10.123875, 0}, - {-0.237026, 0.076614, 10.121481, 0}, - {-0.256179, 0.070629, 10.134649, 0}, - {-0.268150, 0.073023, 10.129861, 0}, - {-0.244208, 0.075417, 10.121481, 0}, - {-0.253785, 0.080206, 10.126269, 0}, - {-0.259771, 0.075417, 10.120284, 0}, - {-0.263362, 0.070629, 10.115496, 0}, - {-0.247800, 0.075417, 10.126269, 0}, - {-0.243011, 0.068235, 10.152605, 0}, - {-0.247800, 0.069432, 10.125072, 0}, - {-0.257377, 0.083797, 10.129861, 0}, - {-0.247800, 0.075417, 10.129861, 0}, - {-0.247800, 0.076614, 10.115496, 0}, - {-0.247800, 0.071826, 10.131058, 0}, - {-0.258574, 0.083797, 10.125072, 0}, - {-0.250194, 0.095768, 10.132255, 0}, - {-0.266953, 0.076614, 10.123875, 0}, - {-0.256179, 0.079009, 10.152605, 0}, - {-0.251391, 0.073023, 10.126269, 0}, - {-0.248997, 0.068235, 10.128663, 0}, - {-0.243011, 0.073023, 10.134649, 0}, - {-0.258574, 0.071826, 10.137043, 0}, - {-0.253785, 0.061052, 10.119086, 0}, - {-0.250194, 0.073023, 10.138240, 0}, - {-0.241814, 0.070629, 10.113101, 0}, - {-0.250194, 0.079009, 10.141831, 0}, - {-0.237026, 0.070629, 10.128663, 0}, - {-0.240617, 0.083797, 10.120284, 0}, - {-0.259771, 0.073023, 10.144226, 0}, - {-0.232237, 0.068235, 10.122678, 0}, - {-0.246603, 0.065841, 10.133451, 0}, - {-0.258574, 0.079009, 10.109509, 0}, - {-0.245406, 0.075417, 10.131058, 0}, - {-0.240617, 0.076614, 10.127466, 0}, - {-0.246603, 0.074220, 10.115496, 0}, - {-0.247800, 0.068235, 10.129861, 0}, - {-0.252588, 0.073023, 10.145423, 0}, - {-0.252588, 0.069432, 10.132255, 0}, - {-0.248997, 0.062249, 10.110707, 0}, - {-0.257377, 0.073023, 10.146620, 0}, - {-0.247800, 0.077812, 10.133451, 0}, - {-0.233435, 0.075417, 10.123875, 0}, - {-0.259771, 0.080206, 10.117889, 0}, - {-0.252588, 0.071826, 10.131058, 0}, - {-0.257377, 0.077812, 10.128663, 0}, - {-0.244208, 0.065841, 10.138240, 0}, - {-0.245406, 0.076614, 10.132255, 0}, - {-0.259771, 0.074220, 10.134649, 0}, - {-0.251391, 0.073023, 10.133451, 0}, - {-0.238223, 0.063446, 10.127466, 0}, - {-0.246603, 0.052672, 10.128663, 0}, - {-0.260968, 0.069432, 10.125072, 0}, - {-0.251391, 0.087388, 10.104721, 0}, - {-0.243011, 0.074220, 10.120284, 0}, - {-0.259771, 0.069432, 10.149014, 0}, - {-0.252588, 0.083797, 10.139438, 0}, - {-0.252588, 0.070629, 10.134649, 0}, - {-0.244208, 0.071826, 10.134649, 0}, - {-0.244208, 0.080206, 10.122678, 0}, - {-0.263362, 0.076614, 10.126269, 0}, - {-0.243011, 0.076614, 10.113101, 0}, - {-0.250194, 0.084994, 10.133451, 0}, - {-0.247800, 0.081403, 10.151408, 0}, - {-0.247800, 0.082600, 10.123875, 0}, - {-0.240617, 0.080206, 10.133451, 0}, - {-0.254982, 0.074220, 10.135846, 0}, - {-0.260968, 0.076614, 10.123875, 0}, - {-0.251391, 0.069432, 10.127466, 0}, - {-0.251391, 0.080206, 10.140635, 0}, - {-0.248997, 0.065841, 10.129861, 0}, - {-0.245406, 0.081403, 10.137043, 0}, - {-0.248997, 0.096965, 10.128663, 0}, - {-0.264559, 0.069432, 10.149014, 0}, - {-0.254982, 0.071826, 10.114298, 0}, - {-0.257377, 0.071826, 10.140635, 0}, - {-0.254982, 0.077812, 10.128663, 0}, - {-0.256179, 0.083797, 10.126269, 0}, - {-0.254982, 0.063446, 10.143028, 0}, - {-0.247800, 0.058658, 10.133451, 0}, - {-0.251391, 0.068235, 10.137043, 0}, - {-0.245406, 0.080206, 10.102327, 0}, - {-0.243011, 0.070629, 10.129861, 0}, - {-0.253785, 0.073023, 10.111904, 0}, - {-0.251391, 0.076614, 10.145423, 0}, - {-0.247800, 0.075417, 10.133451, 0}, - {-0.248997, 0.065841, 10.139438, 0}, - {-0.248997, 0.063446, 10.125072, 0}, - {-0.252588, 0.070629, 10.102327, 0}, - {-0.246603, 0.083797, 10.113101, 0}, - {-0.237026, 0.074220, 10.116693, 0}, - {-0.240617, 0.073023, 10.138240, 0}, - {-0.235829, 0.076614, 10.116693, 0}, - {-0.247800, 0.073023, 10.141831, 0}, - {-0.258574, 0.075417, 10.134649, 0}, - {-0.253785, 0.081403, 10.126269, 0}, - {-0.250194, 0.082600, 10.121481, 0}, - {-0.250194, 0.088585, 10.149014, 0}, - {-0.253785, 0.069432, 10.126269, 0}, - {-0.252588, 0.083797, 10.128663, 0}, - {-0.245406, 0.058658, 10.133451, 0}, - {-0.258574, 0.087388, 10.119086, 0}, - {-0.253785, 0.064643, 10.131058, 0}, - {-0.248997, 0.067038, 10.128663, 0}, - {-0.248997, 0.075417, 10.155000, 0}, - {-0.251391, 0.079009, 10.132255, 0}, - {-0.253785, 0.087388, 10.131058, 0}, - {-0.240617, 0.088585, 10.113101, 0}, - {-0.247800, 0.077812, 10.134649, 0}, - {-0.247800, 0.077812, 10.122678, 0}, - {-0.263362, 0.086191, 10.131058, 0}, - {-0.243011, 0.084994, 10.129861, 0}, - {-0.243011, 0.077812, 10.113101, 0}, - {-0.252588, 0.077812, 10.125072, 0}, - {-0.248997, 0.076614, 10.096342, 0}, - {-0.241814, 0.070629, 10.158591, 0}, - {-0.257377, 0.075417, 10.117889, 0}, - {-0.250194, 0.076614, 10.131058, 0}, - {-0.250194, 0.071826, 10.135846, 0}, - {-0.253785, 0.069432, 10.115496, 0}, - {-0.248997, 0.069432, 10.144226, 0}, - {-0.246603, 0.068235, 10.110707, 0}, - {-0.260968, 0.075417, 10.151408, 0}, - {-0.246603, 0.074220, 10.113101, 0}, - {-0.254982, 0.076614, 10.122678, 0}, - {-0.250194, 0.063446, 10.116693, 0}, - {-0.233435, 0.077812, 10.134649, 0}, - {-0.245406, 0.079009, 10.135846, 0}, - {-0.250194, 0.079009, 10.119086, 0}, - {-0.264559, 0.086191, 10.109509, 0}, - {-0.252588, 0.090980, 10.126269, 0}, - {-0.250194, 0.082600, 10.147817, 0}, - {-0.238223, 0.070629, 10.125072, 0}, - {-0.245406, 0.082600, 10.139438, 0}, - {-0.239420, 0.082600, 10.131058, 0}, - {-0.251391, 0.087388, 10.147817, 0}, - {-0.257377, 0.073023, 10.128663, 0}, - {-0.251391, 0.081403, 10.144226, 0}, - {-0.254982, 0.086191, 10.120284, 0}, - {-0.253785, 0.080206, 10.146620, 0}, - {-0.256179, 0.077812, 10.149014, 0}, - {-0.248997, 0.083797, 10.128663, 0}, - {-0.251391, 0.071826, 10.125072, 0}, - {-0.244208, 0.068235, 10.113101, 0}, - {-0.252588, 0.070629, 10.132255, 0}, - {-0.258574, 0.064643, 10.116693, 0}, - {-0.246603, 0.074220, 10.135846, 0}, - {-0.247800, 0.070629, 10.123875, 0}, - {-0.239420, 0.081403, 10.144226, 0}, - {-0.247800, 0.075417, 10.121481, 0}, - {-0.259771, 0.073023, 10.103524, 0}, - {-0.248997, 0.073023, 10.129861, 0}, - {-0.241814, 0.071826, 10.134649, 0}, - {-0.235829, 0.079009, 10.127466, 0}, - {-0.244208, 0.095768, 10.122678, 0}, - {-0.227449, 0.065841, 10.147817, 0}, - {-0.251391, 0.074220, 10.135846, 0}, - {-0.251391, 0.074220, 10.137043, 0}, - {-0.253785, 0.077812, 10.125072, 0}, - {-0.259771, 0.071826, 10.135846, 0}, - {-0.227449, 0.067038, 10.122678, 0}, - {-0.235829, 0.065841, 10.127466, 0}, - {-0.251391, 0.076614, 10.128663, 0}, - {-0.238223, 0.058658, 10.128663, 0}, - {-0.238223, 0.074220, 10.126269, 0}, - {-0.246603, 0.084994, 10.140635, 0}, - {-0.258574, 0.071826, 10.132255, 0}, - {-0.252588, 0.074220, 10.122678, 0}, - {-0.245406, 0.076614, 10.121481, 0}, - {-0.244208, 0.074220, 10.134649, 0}, - {-0.248997, 0.069432, 10.122678, 0}, - {-0.246603, 0.077812, 10.127466, 0}, - {-0.256179, 0.083797, 10.133451, 0}, - {-0.247800, 0.086191, 10.135846, 0}, - {-0.248997, 0.076614, 10.144226, 0}, - {-0.253785, 0.073023, 10.120284, 0}, - {-0.256179, 0.071826, 10.140635, 0}, - {-0.254982, 0.083797, 10.123875, 0}, - {-0.247800, 0.076614, 10.131058, 0}, - {-0.259771, 0.077812, 10.117889, 0}, - {-0.243011, 0.069432, 10.132255, 0}, - {-0.250194, 0.075417, 10.120284, 0}, - {-0.247800, 0.086191, 10.128663, 0}, - {-0.241814, 0.065841, 10.150211, 0}, - {-0.250194, 0.075417, 10.128663, 0}, - {-0.234632, 0.079009, 10.103524, 0}, - {-0.266953, 0.073023, 10.127466, 0}, - {-0.237026, 0.080206, 10.119086, 0}, - {-0.254982, 0.075417, 10.151408, 0}, - {-0.248997, 0.063446, 10.129861, 0}, - {-0.254982, 0.071826, 10.135846, 0}, - {-0.246603, 0.075417, 10.125072, 0}, - {-0.237026, 0.069432, 10.126269, 0}, - {-0.243011, 0.070629, 10.146620, 0}, - {-0.244208, 0.082600, 10.137043, 0}, - {-0.263362, 0.071826, 10.138240, 0}, - {-0.250194, 0.074220, 10.149014, 0}, - {-0.250194, 0.070629, 10.137043, 0}, - {-0.253785, 0.080206, 10.122678, 0}, - {-0.247800, 0.080206, 10.131058, 0}, - {-0.237026, 0.082600, 10.134649, 0}, - {-0.243011, 0.079009, 10.129861, 0}, - {-0.246603, 0.071826, 10.117889, 0}, - {-0.256179, 0.074220, 10.135846, 0}, - {-0.250194, 0.075417, 10.128663, 0}, - {-0.247800, 0.074220, 10.120284, 0}, - {-0.251391, 0.065841, 10.141831, 0}, - {-0.248997, 0.062249, 10.115496, 0}, - {-0.260968, 0.068235, 10.141831, 0}, - {-0.248997, 0.079009, 10.141831, 0}, - {-0.247800, 0.075417, 10.156197, 0}, - {-0.246603, 0.070629, 10.132255, 0}, - {-0.252588, 0.082600, 10.116693, 0}, - {-0.252588, 0.074220, 10.122678, 0}, - {-0.262165, 0.071826, 10.123875, 0}, - {-0.251391, 0.067038, 10.121481, 0}, - {-0.239420, 0.081403, 10.113101, 0}, - {-0.247800, 0.084994, 10.132255, 0}, - {-0.252588, 0.075417, 10.138240, 0}, - {-0.246603, 0.075417, 10.125072, 0}, - {-0.246603, 0.076614, 10.109509, 0}, - {-0.253785, 0.074220, 10.125072, 0}, - {-0.251391, 0.081403, 10.139438, 0}, - {-0.243011, 0.073023, 10.114298, 0}, - {-0.253785, 0.065841, 10.107116, 0}, - {-0.243011, 0.080206, 10.121481, 0}, - {-0.253785, 0.069432, 10.129861, 0}, - {-0.256179, 0.068235, 10.121481, 0}, - {-0.246603, 0.068235, 10.121481, 0}, - {-0.254982, 0.075417, 10.121481, 0}, - {-0.241814, 0.074220, 10.120284, 0}, - {-0.258574, 0.073023, 10.127466, 0}, - {-0.235829, 0.074220, 10.128663, 0}, - {-0.247800, 0.071826, 10.120284, 0}, - {-0.258574, 0.073023, 10.119086, 0}, - {-0.256179, 0.082600, 10.125072, 0}, - {-0.243011, 0.081403, 10.128663, 0}, - {-0.241814, 0.069432, 10.132255, 0}, - {-0.252588, 0.074220, 10.135846, 0}, - {-0.235829, 0.076614, 10.138240, 0}, - {-0.252588, 0.069432, 10.133451, 0}, - {-0.257377, 0.087388, 10.129861, 0}, - {-0.252588, 0.079009, 10.120284, 0}, - {-0.245406, 0.077812, 10.132255, 0}, - {-0.244208, 0.077812, 10.105919, 0}, - {-0.252588, 0.064643, 10.128663, 0}, - {-0.257377, 0.080206, 10.122678, 0}, - {-0.227449, 0.075417, 10.122678, 0}, - {-0.256179, 0.076614, 10.139438, 0}, - {-0.250194, 0.068235, 10.134649, 0}, - {-0.244208, 0.080206, 10.145423, 0}, - {-0.244208, 0.075417, 10.117889, 0}, - {-0.245406, 0.071826, 10.137043, 0}, - {-0.251391, 0.069432, 10.132255, 0}, - {-0.252588, 0.065841, 10.127466, 0}, - {-0.252588, 0.087388, 10.135846, 0}, - {-0.250194, 0.083797, 10.140635, 0}, - {-0.265756, 0.083797, 10.127466, 0}, - {-0.251391, 0.081403, 10.116693, 0}, - {-0.243011, 0.073023, 10.131058, 0}, - {-0.256179, 0.079009, 10.132255, 0}, - {-0.256179, 0.079009, 10.135846, 0}, - {-0.259771, 0.080206, 10.139438, 0}, - {-0.248997, 0.069432, 10.134649, 0}, - {-0.247800, 0.076614, 10.109509, 0}, - {-0.251391, 0.069432, 10.140635, 0}, - {-0.248997, 0.065841, 10.129861, 0}, - {-0.256179, 0.084994, 10.119086, 0}, - {-0.253785, 0.082600, 10.111904, 0}, - {-0.251391, 0.079009, 10.134649, 0}, - {-0.258574, 0.077812, 10.125072, 0}, - {-0.254982, 0.062249, 10.108313, 0}, - {-0.272939, 0.080206, 10.151408, 0}, - {-0.260968, 0.082600, 10.113101, 0}, - {-0.244208, 0.086191, 10.123875, 0}, - {-0.247800, 0.079009, 10.116693, 0}, - {-0.247800, 0.075417, 10.141831, 0}, - {-0.259771, 0.076614, 10.120284, 0}, - {-0.239420, 0.081403, 10.134649, 0}, - {-0.253785, 0.080206, 10.121481, 0}, - {-0.262165, 0.074220, 10.119086, 0}, - {-0.253785, 0.069432, 10.127466, 0}, - {-0.262165, 0.069432, 10.104721, 0}, - {-0.252588, 0.084994, 10.120284, 0}, - {-0.251391, 0.063446, 10.113101, 0}, - {-0.263362, 0.074220, 10.121481, 0}, - {-0.259771, 0.068235, 10.135846, 0}, - {-0.250194, 0.070629, 10.138240, 0}, - {-0.258574, 0.077812, 10.132255, 0}, - {-0.252588, 0.067038, 10.135846, 0}, - {-0.251391, 0.064643, 10.128663, 0}, - {-0.243011, 0.082600, 10.134649, 0}, - {-0.238223, 0.084994, 10.144226, 0}, - {-0.260968, 0.084994, 10.123875, 0}, - {-0.254982, 0.075417, 10.137043, 0}, - {-0.259771, 0.075417, 10.111904, 0}, - {-0.251391, 0.084994, 10.143028, 0}, - {-0.245406, 0.079009, 10.117889, 0}, - {-0.252588, 0.074220, 10.149014, 0}, - {-0.254982, 0.062249, 10.132255, 0}, - {-0.241814, 0.062249, 10.116693, 0}, - {-0.247800, 0.074220, 10.151408, 0}, - {-0.240617, 0.081403, 10.115496, 0}, - {-0.247800, 0.067038, 10.139438, 0}, - {-0.250194, 0.079009, 10.126269, 0}, - {-0.237026, 0.087388, 10.150211, 0}, - {-0.238223, 0.073023, 10.134649, 0}, - {-0.241814, 0.080206, 10.140635, 0}, - {-0.248997, 0.075417, 10.122678, 0}, - {-0.254982, 0.081403, 10.123875, 0}, - {-0.257377, 0.067038, 10.138240, 0}, - {-0.247800, 0.076614, 10.128663, 0}, - {-0.256179, 0.076614, 10.145423, 0}, - {-0.241814, 0.080206, 10.132255, 0}, - {-0.238223, 0.067038, 10.137043, 0}, - {-0.257377, 0.064643, 10.119086, 0}, - {-0.243011, 0.081403, 10.129861, 0}, - {-0.248997, 0.081403, 10.115496, 0}, - {-0.258574, 0.062249, 10.133451, 0}, - {-0.247800, 0.070629, 10.119086, 0}, - {-0.252588, 0.074220, 10.129861, 0}, - {-0.246603, 0.070629, 10.133451, 0}, - {-0.245406, 0.073023, 10.102327, 0}, - {-0.252588, 0.080206, 10.139438, 0}, - {-0.247800, 0.068235, 10.113101, 0}, - {-0.254982, 0.074220, 10.126269, 0}, - {-0.251391, 0.079009, 10.120284, 0}, - {-0.251391, 0.089783, 10.137043, 0}, - {-0.252588, 0.065841, 10.127466, 0}, - {-0.251391, 0.068235, 10.120284, 0}, - {-0.257377, 0.067038, 10.127466, 0}, - {-0.241814, 0.081403, 10.128663, 0}, - {-0.241814, 0.081403, 10.135846, 0}, - {-0.247800, 0.071826, 10.135846, 0}, - {-0.250194, 0.070629, 10.138240, 0}, - {-0.252588, 0.084994, 10.131058, 0}, - {-0.245406, 0.083797, 10.139438, 0}, - {-0.244208, 0.075417, 10.123875, 0}, - {-0.259771, 0.077812, 10.137043, 0}, - {-0.248997, 0.071826, 10.123875, 0}, - {-0.246603, 0.086191, 10.152605, 0}, - {-0.241814, 0.069432, 10.132255, 0}, - {-0.243011, 0.064643, 10.129861, 0}, - {-0.245406, 0.073023, 10.129861, 0}, - {-0.251391, 0.076614, 10.116693, 0}, - {-0.264559, 0.068235, 10.139438, 0}, - {-0.247800, 0.073023, 10.105919, 0}, - {-0.244208, 0.077812, 10.145423, 0}, - {-0.250194, 0.077812, 10.137043, 0}, - {-0.252588, 0.064643, 10.126269, 0}, - {-0.252588, 0.079009, 10.125072, 0}, - {-0.239420, 0.084994, 10.126269, 0}, - {-0.246603, 0.067038, 10.137043, 0}, - {-0.252588, 0.077812, 10.114298, 0}, - {-0.266953, 0.062249, 10.131058, 0}, - {-0.264559, 0.076614, 10.114298, 0}, - {-0.250194, 0.071826, 10.135846, 0}, - {-0.250194, 0.087388, 10.134649, 0}, - {-0.246603, 0.082600, 10.147817, 0}, - {-0.245406, 0.065841, 10.131058, 0}, - {-0.258574, 0.070629, 10.139438, 0}, - {-0.251391, 0.081403, 10.111904, 0}, - {-0.246603, 0.080206, 10.132255, 0}, - {-0.235829, 0.074220, 10.117889, 0}, - {-0.243011, 0.075417, 10.123875, 0}, - {-0.241814, 0.065841, 10.139438, 0}, - {-0.241814, 0.077812, 10.119086, 0}, - {-0.247800, 0.084994, 10.153803, 0}, - {-0.266953, 0.081403, 10.116693, 0}, - {-0.243011, 0.083797, 10.137043, 0}, - {-0.257377, 0.074220, 10.109509, 0}, - {-0.252588, 0.074220, 10.126269, 0}, - {-0.247800, 0.076614, 10.127466, 0}, - {-0.243011, 0.068235, 10.111904, 0}, - {-0.259771, 0.077812, 10.132255, 0}, - {-0.253785, 0.092177, 10.103524, 0}, - {-0.243011, 0.086191, 10.123875, 0}, - {-0.232237, 0.069432, 10.134649, 0}, - {-0.233435, 0.076614, 10.129861, 0}, - {-0.257377, 0.068235, 10.114298, 0}, - {-0.250194, 0.074220, 10.127466, 0}, - {-0.245406, 0.077812, 10.131058, 0}, - {-0.251391, 0.077812, 10.123875, 0}, - {-0.245406, 0.074220, 10.123875, 0}, - {-0.245406, 0.069432, 10.122678, 0}, - {-0.254982, 0.071826, 10.119086, 0}, - {-0.257377, 0.064643, 10.116693, 0}, - {-0.256179, 0.079009, 10.128663, 0}, - {-0.241814, 0.062249, 10.098736, 0}, - {-0.248997, 0.067038, 10.144226, 0}, - {-0.237026, 0.083797, 10.145423, 0}, - {-0.253785, 0.076614, 10.120284, 0}, - {-0.251391, 0.065841, 10.113101, 0}, - {-0.248997, 0.067038, 10.104721, 0}, - {-0.244208, 0.073023, 10.134649, 0}, - {-0.259771, 0.069432, 10.134649, 0}, - {-0.244208, 0.084994, 10.141831, 0}, - {-0.257377, 0.076614, 10.126269, 0}, - {-0.246603, 0.073023, 10.137043, 0}, - {-0.247800, 0.073023, 10.111904, 0}, - {-0.243011, 0.073023, 10.144226, 0}, - {-0.251391, 0.080206, 10.129861, 0}, - {-0.244208, 0.076614, 10.126269, 0}, - {-0.246603, 0.069432, 10.135846, 0}, - {-0.250194, 0.073023, 10.131058, 0}, - {-0.250194, 0.069432, 10.122678, 0}, - {-0.238223, 0.073023, 10.133451, 0}, - {-0.229843, 0.063446, 10.121481, 0}, - {-0.235829, 0.084994, 10.115496, 0}, - {-0.243011, 0.077812, 10.122678, 0}, - {-0.238223, 0.067038, 10.116693, 0}, - {-0.245406, 0.069432, 10.137043, 0}, - {-0.258574, 0.081403, 10.122678, 0}, - {-0.239420, 0.083797, 10.149014, 0}, - {-0.240617, 0.075417, 10.123875, 0}, - {-0.251391, 0.067038, 10.153803, 0}, - {-0.240617, 0.075417, 10.145423, 0}, - {-0.231040, 0.083797, 10.129861, 0}, - {-0.247800, 0.090980, 10.155000, 0}, - {-0.247800, 0.077812, 10.125072, 0}, - {-0.253785, 0.084994, 10.131058, 0}, - {-0.257377, 0.073023, 10.108313, 0}, - {-0.248997, 0.080206, 10.123875, 0}, - {-0.244208, 0.073023, 10.113101, 0}, - {-0.237026, 0.080206, 10.121481, 0}, - {-0.248997, 0.055067, 10.127466, 0}, - {-0.256179, 0.073023, 10.137043, 0}, - {-0.260968, 0.081403, 10.131058, 0}, - {-0.251391, 0.069432, 10.125072, 0}, - {-0.252588, 0.074220, 10.115496, 0}, - {-0.250194, 0.086191, 10.122678, 0}, - {-0.235829, 0.076614, 10.119086, 0}, - {-0.258574, 0.079009, 10.127466, 0}, - {-0.247800, 0.076614, 10.139438, 0}, - {-0.247800, 0.079009, 10.126269, 0}, - {-0.237026, 0.088585, 10.134649, 0}, - {-0.240617, 0.073023, 10.120284, 0}, - {-0.244208, 0.073023, 10.125072, 0}, - {-0.243011, 0.076614, 10.115496, 0}, - {-0.238223, 0.080206, 10.122678, 0}, - {-0.239420, 0.067038, 10.122678, 0}, - {-0.253785, 0.081403, 10.119086, 0}, - {-0.246603, 0.080206, 10.125072, 0}, - {-0.251391, 0.082600, 10.126269, 0}, - {-0.238223, 0.073023, 10.132255, 0}, - {-0.252588, 0.075417, 10.133451, 0}, - {-0.254982, 0.061052, 10.140635, 0}, - {-0.253785, 0.065841, 10.117889, 0}, - {-0.235829, 0.071826, 10.143028, 0}, - {-0.245406, 0.083797, 10.122678, 0}, - {-0.256179, 0.088585, 10.129861, 0}, - {-0.259771, 0.077812, 10.121481, 0}, - {-0.238223, 0.067038, 10.125072, 0}, - {-0.247800, 0.073023, 10.140635, 0}, - {-0.248997, 0.073023, 10.111904, 0}, - {-0.245406, 0.075417, 10.145423, 0}, - {-0.268150, 0.075417, 10.102327, 0}, - {-0.246603, 0.080206, 10.129861, 0}, - {-0.251391, 0.080206, 10.126269, 0}, - {-0.251391, 0.071826, 10.134649, 0}, - {-0.262165, 0.076614, 10.143028, 0}, - {-0.247800, 0.070629, 10.121481, 0}, - {-0.238223, 0.083797, 10.135846, 0}, - {-0.251391, 0.069432, 10.111904, 0}, - {-0.256179, 0.082600, 10.139438, 0}, - {-0.262165, 0.083797, 10.128663, 0}, - {-0.251391, 0.079009, 10.122678, 0}, - {-0.245406, 0.077812, 10.125072, 0}, - {-0.239420, 0.074220, 10.125072, 0}, - {-0.258574, 0.076614, 10.127466, 0}, - {-0.256179, 0.088585, 10.126269, 0}, - {-0.246603, 0.080206, 10.111904, 0}, - {-0.241814, 0.084994, 10.133451, 0}, - {-0.235829, 0.079009, 10.141831, 0}, - {-0.263362, 0.073023, 10.138240, 0}, - {-0.251391, 0.069432, 10.134649, 0}, - {-0.245406, 0.069432, 10.127466, 0}, - {-0.250194, 0.074220, 10.133451, 0}, - {-0.251391, 0.068235, 10.131058, 0}, - {-0.254982, 0.070629, 10.128663, 0}, - {-0.240617, 0.083797, 10.111904, 0}, - {-0.245406, 0.075417, 10.122678, 0}, - {-0.245406, 0.084994, 10.119086, 0}, - {-0.248997, 0.079009, 10.098736, 0}, - {-0.240617, 0.070629, 10.127466, 0}, - {-0.244208, 0.079009, 10.145423, 0}, - {-0.264559, 0.079009, 10.120284, 0}, - {-0.244208, 0.077812, 10.119086, 0}, - {-0.237026, 0.080206, 10.107116, 0}, - {-0.235829, 0.086191, 10.128663, 0}, - {-0.245406, 0.081403, 10.133451, 0}, - {-0.247800, 0.077812, 10.138240, 0}, - {-0.251391, 0.080206, 10.125072, 0}, - {-0.257377, 0.068235, 10.147817, 0}, - {-0.263362, 0.076614, 10.121481, 0}, - {-0.268150, 0.073023, 10.116693, 0}, - {-0.247800, 0.071826, 10.122678, 0}, - {-0.260968, 0.073023, 10.134649, 0}, - {-0.254982, 0.074220, 10.116693, 0}, - {-0.246603, 0.086191, 10.131058, 0}, - {-0.248997, 0.079009, 10.125072, 0}, - {-0.252588, 0.067038, 10.132255, 0}, - {-0.254982, 0.063446, 10.123875, 0}, - {-0.256179, 0.067038, 10.116693, 0}, - {-0.259771, 0.083797, 10.125072, 0}, - {-0.264559, 0.069432, 10.131058, 0}, - {-0.243011, 0.074220, 10.143028, 0}, - {-0.254982, 0.081403, 10.128663, 0}, - {-0.253785, 0.065841, 10.143028, 0}, - {-0.260968, 0.075417, 10.131058, 0}, - {-0.265756, 0.090980, 10.128663, 0}, - {-0.244208, 0.088585, 10.146620, 0}, - {-0.246603, 0.082600, 10.114298, 0}, - {-0.256179, 0.077812, 10.133451, 0}, - {-0.250194, 0.064643, 10.117889, 0}, - {-0.254982, 0.075417, 10.117889, 0}, - {-0.266953, 0.065841, 10.113101, 0}, - {-0.253785, 0.073023, 10.128663, 0}, - {-0.259771, 0.082600, 10.138240, 0}, - {-0.247800, 0.071826, 10.145423, 0}, - {-0.243011, 0.074220, 10.122678, 0}, - {-0.257377, 0.083797, 10.140635, 0}, - {-0.232237, 0.087388, 10.117889, 0}, - {-0.244208, 0.076614, 10.125072, 0}, - {-0.248997, 0.067038, 10.128663, 0}, - {-0.256179, 0.062249, 10.115496, 0}, - {-0.263362, 0.071826, 10.141831, 0}, - {-0.246603, 0.075417, 10.107116, 0}, - {-0.244208, 0.081403, 10.137043, 0}, - {-0.254982, 0.083797, 10.123875, 0}, - {-0.243011, 0.092177, 10.132255, 0}, - {-0.260968, 0.077812, 10.131058, 0}, - {-0.256179, 0.073023, 10.119086, 0}, - {-0.239420, 0.082600, 10.132255, 0}, - {-0.251391, 0.073023, 10.117889, 0}, - {-0.254982, 0.071826, 10.134649, 0}, - {-0.259771, 0.080206, 10.120284, 0}, - {-0.246603, 0.069432, 10.133451, 0}, - {-0.250194, 0.061052, 10.126269, 0}, - {-0.256179, 0.063446, 10.109509, 0}, - {-0.251391, 0.087388, 10.120284, 0}, - {-0.246603, 0.069432, 10.132255, 0}, - {-0.244208, 0.077812, 10.133451, 0}, - {-0.257377, 0.069432, 10.126269, 0}, - {-0.247800, 0.075417, 10.133451, 0}, - {-0.246603, 0.071826, 10.117889, 0}, - {-0.245406, 0.093374, 10.135846, 0}, - {-0.254982, 0.082600, 10.105919, 0}, - {-0.247800, 0.076614, 10.143028, 0}, - {-0.246603, 0.076614, 10.126269, 0}, - {-0.243011, 0.067038, 10.127466, 0}, - {-0.253785, 0.064643, 10.119086, 0}, - {-0.248997, 0.079009, 10.127466, 0}, - {-0.248997, 0.080206, 10.141831, 0}, - {-0.244208, 0.074220, 10.133451, 0}, - {-0.240617, 0.079009, 10.135846, 0}, - {-0.232237, 0.075417, 10.115496, 0}, - {-0.254982, 0.082600, 10.139438, 0}, - {-0.258574, 0.077812, 10.119086, 0}, - {-0.246603, 0.076614, 10.109509, 0}, - {-0.248997, 0.080206, 10.125072, 0}, - {-0.256179, 0.077812, 10.128663, 0}, - {-0.235829, 0.076614, 10.126269, 0}, - {-0.253785, 0.076614, 10.128663, 0}, - {-0.254982, 0.075417, 10.147817, 0}, - {-0.246603, 0.079009, 10.145423, 0}, - {-0.243011, 0.081403, 10.146620, 0}, - {-0.237026, 0.075417, 10.134649, 0}, - {-0.258574, 0.077812, 10.149014, 0}, - {-0.262165, 0.079009, 10.141831, 0}, - {-0.245406, 0.069432, 10.140635, 0}, - {-0.240617, 0.074220, 10.120284, 0}, - {-0.252588, 0.080206, 10.143028, 0}, - {-0.254982, 0.084994, 10.135846, 0}, - {-0.248997, 0.067038, 10.131058, 0}, - {-0.234632, 0.070629, 10.133451, 0}, - {-0.246603, 0.067038, 10.132255, 0}, - {-0.246603, 0.070629, 10.143028, 0}, - {-0.245406, 0.079009, 10.135846, 0}, - {-0.253785, 0.077812, 10.144226, 0}, - {-0.248997, 0.076614, 10.127466, 0}, - {-0.227449, 0.093374, 10.119086, 0}, - {-0.257377, 0.073023, 10.125072, 0}, - {-0.254982, 0.057461, 10.133451, 0}, - {-0.247800, 0.069432, 10.122678, 0}, - {-0.252588, 0.075417, 10.125072, 0}, - {-0.262165, 0.088585, 10.125072, 0}, - {-0.253785, 0.080206, 10.127466, 0}, - {-0.252588, 0.070629, 10.137043, 0}, - {-0.254982, 0.068235, 10.113101, 0}, - {-0.244208, 0.076614, 10.132255, 0}, - {-0.244208, 0.074220, 10.129861, 0}, - {-0.244208, 0.073023, 10.141831, 0}, - {-0.239420, 0.080206, 10.108313, 0}, - {-0.241814, 0.087388, 10.122678, 0}, - {-0.253785, 0.093374, 10.122678, 0}, - {-0.252588, 0.070629, 10.133451, 0}, - {-0.244208, 0.073023, 10.147817, 0}, - {-0.245406, 0.076614, 10.122678, 0}, - {-0.254982, 0.087388, 10.132255, 0}, - {-0.241814, 0.065841, 10.125072, 0}, - {-0.231040, 0.068235, 10.123875, 0}, - {-0.238223, 0.081403, 10.117889, 0}, - {-0.241814, 0.083797, 10.139438, 0}, - {-0.240617, 0.045490, 10.119086, 0}, - {-0.262165, 0.069432, 10.125072, 0}, - {-0.259771, 0.081403, 10.126269, 0}, - {-0.248997, 0.068235, 10.129861, 0}, - {-0.238223, 0.071826, 10.131058, 0}, - {-0.237026, 0.087388, 10.117889, 0}, - {-0.253785, 0.076614, 10.123875, 0}, - {-0.260968, 0.077812, 10.120284, 0}, - {-0.246603, 0.073023, 10.126269, 0}, - {-0.256179, 0.082600, 10.119086, 0}, - {-0.252588, 0.067038, 10.139438, 0}, - {-0.260968, 0.073023, 10.127466, 0}, - {-0.235829, 0.086191, 10.121481, 0}, - {-0.244208, 0.088585, 10.131058, 0}, - {-0.245406, 0.073023, 10.143028, 0}, - {-0.243011, 0.079009, 10.139438, 0}, - {-0.253785, 0.077812, 10.120284, 0}, - {-0.252588, 0.068235, 10.123875, 0}, - {-0.246603, 0.069432, 10.132255, 0}, - {-0.237026, 0.070629, 10.139438, 0}, - {-0.244208, 0.068235, 10.120284, 0}, - {-0.247800, 0.079009, 10.134649, 0}, - {-0.256179, 0.084994, 10.150211, 0}, - {-0.246603, 0.070629, 10.126269, 0}, - {-0.246603, 0.065841, 10.131058, 0}, - {-0.262165, 0.068235, 10.126269, 0}, - {-0.244208, 0.069432, 10.125072, 0}, - {-0.245406, 0.081403, 10.114298, 0}, - {-0.257377, 0.070629, 10.133451, 0}, - {-0.247800, 0.079009, 10.109509, 0}, - {-0.245406, 0.071826, 10.125072, 0}, - {-0.237026, 0.069432, 10.139438, 0}, - {-0.244208, 0.081403, 10.145423, 0}, - {-0.246603, 0.075417, 10.129861, 0}, - {-0.262165, 0.082600, 10.128663, 0}, - {-0.246603, 0.083797, 10.147817, 0}, - {-0.243011, 0.079009, 10.128663, 0}, - {-0.251391, 0.069432, 10.133451, 0}, - {-0.253785, 0.070629, 10.122678, 0}, - {-0.248997, 0.075417, 10.139438, 0}, - {-0.256179, 0.080206, 10.104721, 0}, - {-0.263362, 0.081403, 10.127466, 0}, - {-0.247800, 0.068235, 10.140635, 0}, - {-0.251391, 0.062249, 10.138240, 0}, - {-0.245406, 0.087388, 10.133451, 0}, - {-0.254982, 0.075417, 10.122678, 0}, - {-0.240617, 0.071826, 10.135846, 0}, - {-0.258574, 0.068235, 10.114298, 0}, - {-0.250194, 0.077812, 10.137043, 0}, - {-0.238223, 0.070629, 10.121481, 0}, - {-0.244208, 0.080206, 10.126269, 0}, - {-0.246603, 0.071826, 10.119086, 0}, - {-0.258574, 0.068235, 10.147817, 0}, - {-0.252588, 0.058658, 10.121481, 0}, - {-0.258574, 0.073023, 10.122678, 0}, - {-0.244208, 0.075417, 10.144226, 0}, - {-0.241814, 0.075417, 10.120284, 0}, - {-0.257377, 0.063446, 10.129861, 0}, - {-0.260968, 0.075417, 10.091554, 0}, - {-0.260968, 0.086191, 10.149014, 0}, - {-0.243011, 0.084994, 10.095144, 0}, - {-0.246603, 0.081403, 10.141831, 0}, - {-0.243011, 0.068235, 10.138240, 0}, - {-0.252588, 0.084994, 10.131058, 0}, - {-0.257377, 0.077812, 10.141831, 0}, - {-0.247800, 0.071826, 10.113101, 0}, - {-0.258574, 0.073023, 10.151408, 0}, - {-0.256179, 0.067038, 10.119086, 0}, - {-0.264559, 0.070629, 10.131058, 0}, - {-0.266953, 0.079009, 10.107116, 0}, - {-0.245406, 0.077812, 10.137043, 0}, - {-0.256179, 0.076614, 10.128663, 0}, - {-0.252588, 0.068235, 10.135846, 0}, - {-0.257377, 0.069432, 10.133451, 0}, - {-0.258574, 0.062249, 10.133451, 0}, - {-0.268150, 0.092177, 10.128663, 0}, - {-0.257377, 0.076614, 10.139438, 0}, - {-0.240617, 0.076614, 10.115496, 0}, - {-0.248997, 0.075417, 10.129861, 0}, - {-0.251391, 0.075417, 10.135846, 0}, - {-0.263362, 0.062249, 10.092751, 0}, - {-0.245406, 0.079009, 10.135846, 0}, - {-0.248997, 0.077812, 10.114298, 0}, - {-0.245406, 0.090980, 10.143028, 0}, - {-0.246603, 0.081403, 10.125072, 0}, - {-0.243011, 0.059855, 10.127466, 0}, - {-0.248997, 0.068235, 10.145423, 0}, - {-0.245406, 0.070629, 10.132255, 0}, - {-0.240617, 0.068235, 10.139438, 0}, - {-0.241814, 0.069432, 10.115496, 0}, - {-0.250194, 0.082600, 10.137043, 0}, - {-0.250194, 0.073023, 10.128663, 0}, - {-0.241814, 0.086191, 10.144226, 0}, - {-0.254982, 0.070629, 10.121481, 0}, - {-0.244208, 0.082600, 10.131058, 0}, - {-0.244208, 0.086191, 10.126269, 0}, - {-0.251391, 0.086191, 10.138240, 0}, - {-0.256179, 0.073023, 10.123875, 0}, - {-0.247800, 0.080206, 10.127466, 0}, - {-0.239420, 0.087388, 10.145423, 0}, - {-0.247800, 0.056264, 10.145423, 0}, - {-0.239420, 0.063446, 10.143028, 0}, - {-0.259771, 0.067038, 10.111904, 0}, - {-0.245406, 0.079009, 10.135846, 0}, - {-0.254982, 0.074220, 10.121481, 0}, - {-0.257377, 0.070629, 10.141831, 0}, - {-0.243011, 0.068235, 10.141831, 0}, - {-0.254982, 0.071826, 10.140635, 0}, - {-0.231040, 0.068235, 10.126269, 0}, - {-0.240617, 0.074220, 10.119086, 0}, - {-0.244208, 0.070629, 10.123875, 0}, - {-0.248997, 0.067038, 10.132255, 0}, - {-0.252588, 0.071826, 10.135846, 0}, - {-0.250194, 0.074220, 10.108313, 0}, - {-0.252588, 0.071826, 10.137043, 0}, - {-0.253785, 0.074220, 10.117889, 0}, - {-0.246603, 0.069432, 10.123875, 0}, - {-0.250194, 0.065841, 10.132255, 0}, - {-0.240617, 0.062249, 10.153803, 0}, - {-0.250194, 0.069432, 10.122678, 0}, - {-0.248997, 0.073023, 10.114298, 0}, - {-0.251391, 0.075417, 10.131058, 0}, - {-0.239420, 0.065841, 10.134649, 0}, - {-0.244208, 0.077812, 10.146620, 0}, - {-0.253785, 0.089783, 10.102327, 0}, - {-0.248997, 0.073023, 10.123875, 0}, - {-0.252588, 0.074220, 10.109509, 0}, - {-0.248997, 0.086191, 10.144226, 0}, - {-0.240617, 0.073023, 10.135846, 0}, - {-0.245406, 0.063446, 10.111904, 0}, - {-0.253785, 0.057461, 10.120284, 0}, - {-0.257377, 0.074220, 10.120284, 0}, - {-0.262165, 0.070629, 10.153803, 0}, - {-0.260968, 0.071826, 10.128663, 0}, - {-0.251391, 0.070629, 10.138240, 0}, - {-0.246603, 0.075417, 10.119086, 0}, - {-0.247800, 0.069432, 10.120284, 0}, - {-0.268150, 0.074220, 10.134649, 0}, - {-0.241814, 0.082600, 10.143028, 0}, - {-0.245406, 0.082600, 10.143028, 0}, - {-0.259771, 0.074220, 10.125072, 0}, - {-0.263362, 0.069432, 10.132255, 0}, - {-0.248997, 0.076614, 10.111904, 0}, - {-0.254982, 0.071826, 10.128663, 0}, - {-0.238223, 0.079009, 10.101130, 0}, - {-0.246603, 0.075417, 10.149014, 0}, - {-0.262165, 0.061052, 10.116693, 0}, - {-0.245406, 0.071826, 10.135846, 0}, - {-0.241814, 0.090980, 10.120284, 0}, - {-0.247800, 0.082600, 10.133451, 0}, - {-0.260968, 0.064643, 10.149014, 0}, - {-0.241814, 0.069432, 10.127466, 0}, - {-0.246603, 0.073023, 10.128663, 0}, - {-0.259771, 0.068235, 10.083174, 0}, - {-0.254982, 0.086191, 10.129861, 0}, - {-0.251391, 0.070629, 10.111904, 0}, - {-0.250194, 0.064643, 10.128663, 0}, - {-0.244208, 0.080206, 10.114298, 0}, - {-0.234632, 0.075417, 10.128663, 0}, - {-0.247800, 0.080206, 10.132255, 0}, - {-0.247800, 0.071826, 10.135846, 0}, - {-0.240617, 0.063446, 10.133451, 0}, - {-0.253785, 0.070629, 10.128663, 0}, - {-0.251391, 0.075417, 10.131058, 0}, - {-0.252588, 0.074220, 10.116693, 0}, - {-0.248997, 0.071826, 10.129861, 0}, - {-0.251391, 0.087388, 10.108313, 0}, - {-0.248997, 0.083797, 10.137043, 0}, - {-0.257377, 0.068235, 10.132255, 0}, - {-0.256179, 0.065841, 10.141831, 0}, - {-0.239420, 0.076614, 10.132255, 0}, - {-0.251391, 0.073023, 10.127466, 0}, - {-0.252588, 0.073023, 10.138240, 0}, - {-0.253785, 0.070629, 10.119086, 0}, - {-0.247800, 0.069432, 10.119086, 0}, - {-0.246603, 0.067038, 10.123875, 0}, - {-0.246603, 0.077812, 10.146620, 0}, - {-0.246603, 0.083797, 10.123875, 0}, - {-0.246603, 0.083797, 10.143028, 0}, - {-0.241814, 0.071826, 10.110707, 0}, - {-0.248997, 0.077812, 10.134649, 0}, - {-0.251391, 0.074220, 10.143028, 0}, - {-0.243011, 0.082600, 10.133451, 0}, - {-0.251391, 0.079009, 10.111904, 0}, - {-0.251391, 0.081403, 10.122678, 0}, - {-0.247800, 0.080206, 10.144226, 0}, - {-0.247800, 0.092177, 10.114298, 0}, - {-0.244208, 0.073023, 10.134649, 0}, - {-0.245406, 0.081403, 10.126269, 0}, - {-0.250194, 0.073023, 10.144226, 0}, - {-0.243011, 0.079009, 10.133451, 0}, - {-0.260968, 0.077812, 10.122678, 0}, - {-0.252588, 0.090980, 10.122678, 0}, - {-0.268150, 0.073023, 10.128663, 0}, - {-0.256179, 0.075417, 10.123875, 0}, - {-0.248997, 0.063446, 10.104721, 0}, - {-0.245406, 0.090980, 10.128663, 0}, - {-0.253785, 0.087388, 10.115496, 0}, - {-0.239420, 0.073023, 10.138240, 0}, - {-0.238223, 0.059855, 10.119086, 0}, - {-0.248997, 0.070629, 10.125072, 0}, - {-0.250194, 0.081403, 10.131058, 0}, - {-0.248997, 0.093374, 10.132255, 0}, - {-0.253785, 0.092177, 10.128663, 0}, - {-0.251391, 0.071826, 10.134649, 0}, - {-0.233435, 0.074220, 10.129861, 0}, - {-0.241814, 0.079009, 10.103524, 0}, - {-0.253785, 0.070629, 10.153803, 0}, - {-0.260968, 0.069432, 10.144226, 0}, - {-0.250194, 0.065841, 10.123875, 0}, - {-0.262165, 0.092177, 10.125072, 0}, - {-0.252588, 0.088585, 10.151408, 0}, - {-0.253785, 0.087388, 10.132255, 0}, - {-0.244208, 0.062249, 10.137043, 0}, - {-0.256179, 0.065841, 10.110707, 0}, - {-0.244208, 0.075417, 10.117889, 0}, - {-0.240617, 0.082600, 10.132255, 0}, - {-0.248997, 0.074220, 10.115496, 0}, - {-0.250194, 0.079009, 10.141831, 0}, - {-0.246603, 0.077812, 10.119086, 0}, - {-0.252588, 0.074220, 10.117889, 0}, - {-0.257377, 0.075417, 10.120284, 0}, - {-0.250194, 0.077812, 10.117889, 0}, - {-0.239420, 0.081403, 10.143028, 0}, - {-0.237026, 0.076614, 10.137043, 0}, - {-0.240617, 0.077812, 10.149014, 0}, - {-0.270545, 0.071826, 10.131058, 0}, - {-0.262165, 0.068235, 10.122678, 0}, - {-0.259771, 0.067038, 10.114298, 0}, - {-0.246603, 0.082600, 10.121481, 0}, - {-0.254982, 0.076614, 10.127466, 0}, - {-0.244208, 0.063446, 10.122678, 0}, - {-0.246603, 0.074220, 10.121481, 0}, - {-0.253785, 0.086191, 10.127466, 0}, - {-0.253785, 0.079009, 10.131058, 0}, - {-0.245406, 0.071826, 10.132255, 0}, - {-0.248997, 0.074220, 10.132255, 0}, - {-0.260968, 0.055067, 10.121481, 0}, - {-0.243011, 0.070629, 10.122678, 0}, - {-0.252588, 0.070629, 10.132255, 0}, - {-0.243011, 0.077812, 10.143028, 0}, - {-0.246603, 0.077812, 10.132255, 0}, - {-0.253785, 0.082600, 10.131058, 0}, - {-0.256179, 0.068235, 10.137043, 0}, - {-0.243011, 0.088585, 10.121481, 0}, - {-0.239420, 0.065841, 10.133451, 0}, - {-0.252588, 0.063446, 10.122678, 0}, - {-0.252588, 0.082600, 10.141831, 0}, - {-0.238223, 0.083797, 10.122678, 0}, - {-0.251391, 0.076614, 10.140635, 0}, - {-0.265756, 0.081403, 10.135846, 0}, - {-0.252588, 0.076614, 10.141831, 0}, - {-0.246603, 0.079009, 10.131058, 0}, - {-0.250194, 0.077812, 10.126269, 0}, - {-0.240617, 0.079009, 10.146620, 0}, - {-0.247800, 0.089783, 10.132255, 0}, - {-0.259771, 0.089783, 10.111904, 0}, - {-0.266953, 0.084994, 10.141831, 0}, - {-0.244208, 0.087388, 10.147817, 0}, - {-0.235829, 0.067038, 10.127466, 0}, - {-0.245406, 0.069432, 10.129861, 0}, - {-0.250194, 0.083797, 10.108313, 0}, - {-0.240617, 0.084994, 10.146620, 0}, - {-0.256179, 0.077812, 10.121481, 0}, - {-0.250194, 0.076614, 10.151408, 0}, - {-0.248997, 0.073023, 10.128663, 0}, - {-0.252588, 0.068235, 10.140635, 0}, - {-0.252588, 0.074220, 10.147817, 0}, - {-0.253785, 0.083797, 10.139438, 0}, - {-0.243011, 0.069432, 10.114298, 0}, - {-0.235829, 0.059855, 10.122678, 0}, - {-0.253785, 0.076614, 10.145423, 0}, - {-0.245406, 0.077812, 10.115496, 0}, - {-0.252588, 0.065841, 10.139438, 0}, - {-0.248997, 0.092177, 10.132255, 0}, - {-0.256179, 0.088585, 10.150211, 0}, - {-0.250194, 0.082600, 10.134649, 0}, - {-0.244208, 0.069432, 10.137043, 0}, - {-0.254982, 0.076614, 10.127466, 0}, - {-0.253785, 0.063446, 10.135846, 0}, - {-0.258574, 0.080206, 10.145423, 0}, - {-0.232237, 0.074220, 10.126269, 0}, - {-0.241814, 0.080206, 10.131058, 0}, - {-0.240617, 0.075417, 10.116693, 0}, - {-0.253785, 0.068235, 10.132255, 0}, - {-0.241814, 0.083797, 10.139438, 0}, - {-0.245406, 0.084994, 10.129861, 0}, - {-0.245406, 0.079009, 10.165773, 0}, - {-0.238223, 0.079009, 10.101130, 0}, - {-0.247800, 0.081403, 10.138240, 0}, - {-0.244208, 0.070629, 10.126269, 0}, - {-0.253785, 0.082600, 10.149014, 0}, - {-0.235829, 0.079009, 10.115496, 0}, - {-0.239420, 0.070629, 10.114298, 0}, - {-0.251391, 0.086191, 10.128663, 0}, - {-0.241814, 0.075417, 10.119086, 0}, - {-0.241814, 0.074220, 10.165773, 0}, - {-0.233435, 0.075417, 10.101130, 0}, - {-0.254982, 0.087388, 10.135846, 0}, - {-0.232237, 0.074220, 10.129861, 0}, - {-0.233435, 0.076614, 10.123875, 0}, - {-0.258574, 0.093374, 10.137043, 0}, - {-0.243011, 0.074220, 10.137043, 0}, - {-0.244208, 0.083797, 10.145423, 0}, - {-0.252588, 0.087388, 10.137043, 0}, - {-0.251391, 0.077812, 10.120284, 0}, - {-0.235829, 0.067038, 10.117889, 0}, - {-0.240617, 0.075417, 10.125072, 0}, - {-0.253785, 0.086191, 10.127466, 0}, - {-0.256179, 0.080206, 10.126269, 0}, - {-0.254982, 0.071826, 10.132255, 0}, - {-0.235829, 0.074220, 10.128663, 0}, - {-0.252588, 0.079009, 10.117889, 0}, - {-0.245406, 0.081403, 10.123875, 0}, - {-0.246603, 0.073023, 10.127466, 0}, - {-0.252588, 0.063446, 10.159788, 0}, - {-0.247800, 0.079009, 10.147817, 0}, - {-0.258574, 0.079009, 10.131058, 0}, - {-0.269348, 0.075417, 10.134649, 0}, - {-0.248997, 0.083797, 10.107116, 0}, - {-0.244208, 0.081403, 10.139438, 0}, - {-0.259771, 0.070629, 10.133451, 0}, - {-0.257377, 0.063446, 10.128663, 0}, - {-0.254982, 0.071826, 10.121481, 0}, - {-0.252588, 0.088585, 10.137043, 0}, - {-0.251391, 0.083797, 10.135846, 0}, - {-0.253785, 0.086191, 10.134649, 0}, - {-0.252588, 0.073023, 10.115496, 0}, - {-0.254982, 0.075417, 10.145423, 0}, - {-0.250194, 0.076614, 10.137043, 0}, - {-0.248997, 0.070629, 10.135846, 0}, - {-0.259771, 0.073023, 10.137043, 0}, - {-0.245406, 0.088585, 10.120284, 0}, - {-0.254982, 0.074220, 10.151408, 0}, - {-0.252588, 0.074220, 10.103524, 0}, - {-0.258574, 0.070629, 10.146620, 0}, - {-0.251391, 0.080206, 10.121481, 0}, - {-0.241814, 0.070629, 10.131058, 0}, - {-0.246603, 0.071826, 10.116693, 0}, - {-0.248997, 0.067038, 10.135846, 0}, - {-0.251391, 0.070629, 10.132255, 0}, - {-0.250194, 0.081403, 10.132255, 0}, - {-0.254982, 0.074220, 10.134649, 0}, - {-0.243011, 0.081403, 10.131058, 0}, - {-0.237026, 0.089783, 10.128663, 0}, - {-0.243011, 0.077812, 10.125072, 0}, - {-0.244208, 0.074220, 10.131058, 0}, - {-0.243011, 0.086191, 10.121481, 0}, - {-0.250194, 0.079009, 10.135846, 0}, - {-0.247800, 0.061052, 10.132255, 0}, - {-0.258574, 0.063446, 10.122678, 0}, - {-0.245406, 0.076614, 10.114298, 0}, - {-0.238223, 0.082600, 10.101130, 0}, - {-0.264559, 0.057461, 10.119086, 0}, - {-0.248997, 0.077812, 10.126269, 0}, - {-0.237026, 0.094571, 10.127466, 0}, - {-0.256179, 0.071826, 10.116693, 0}, - {-0.248997, 0.080206, 10.135846, 0}, - {-0.259771, 0.067038, 10.128663, 0}, - {-0.246603, 0.074220, 10.134649, 0}, - {-0.244208, 0.083797, 10.131058, 0}, - {-0.233435, 0.075417, 10.129861, 0}, - {-0.241814, 0.074220, 10.128663, 0}, - {-0.238223, 0.080206, 10.105919, 0}, - {-0.241814, 0.084994, 10.131058, 0}, - {-0.254982, 0.076614, 10.129861, 0}, - {-0.258574, 0.079009, 10.117889, 0}, - {-0.251391, 0.069432, 10.135846, 0}, - {-0.243011, 0.082600, 10.135846, 0}, - {-0.243011, 0.073023, 10.121481, 0}, - {-0.250194, 0.074220, 10.140635, 0}, - {-0.251391, 0.069432, 10.119086, 0}, - {-0.258574, 0.074220, 10.117889, 0}, - {-0.260968, 0.069432, 10.138240, 0}, - {-0.260968, 0.080206, 10.133451, 0}, - {-0.238223, 0.080206, 10.140635, 0}, - {-0.248997, 0.075417, 10.103524, 0}, - {-0.259771, 0.069432, 10.144226, 0}, - {-0.252588, 0.076614, 10.095144, 0}, - {-0.254982, 0.068235, 10.146620, 0}, - {-0.256179, 0.079009, 10.143028, 0}, - {-0.246603, 0.090980, 10.139438, 0}, - {-0.251391, 0.079009, 10.131058, 0}, - {-0.253785, 0.077812, 10.119086, 0}, - {-0.256179, 0.076614, 10.157393, 0}, - {-0.246603, 0.067038, 10.121481, 0}, - {-0.237026, 0.081403, 10.159788, 0}, - {-0.250194, 0.082600, 10.125072, 0}, - {-0.248997, 0.077812, 10.117889, 0}, - {-0.237026, 0.074220, 10.121481, 0}, - {-0.237026, 0.062249, 10.138240, 0}, - {-0.247800, 0.070629, 10.126269, 0}, - {-0.245406, 0.073023, 10.138240, 0}, - {-0.245406, 0.065841, 10.134649, 0}, - {-0.240617, 0.083797, 10.137043, 0}, - {-0.244208, 0.063446, 10.137043, 0}, - {-0.260968, 0.080206, 10.123875, 0}, - {-0.245406, 0.083797, 10.137043, 0}, - {-0.237026, 0.068235, 10.122678, 0}, - {-0.250194, 0.070629, 10.137043, 0}, - {-0.248997, 0.073023, 10.128663, 0}, - {-0.239420, 0.073023, 10.127466, 0}, - {-0.256179, 0.069432, 10.123875, 0}, - {-0.244208, 0.064643, 10.141831, 0}, - {-0.246603, 0.062249, 10.114298, 0}, - {-0.260968, 0.076614, 10.108313, 0}, - {-0.257377, 0.069432, 10.135846, 0}, - {-0.265756, 0.074220, 10.123875, 0}, - {-0.254982, 0.065841, 10.145423, 0}, - {-0.248997, 0.070629, 10.123875, 0}, - {-0.241814, 0.079009, 10.137043, 0}, - {-0.251391, 0.095768, 10.141831, 0}, - {-0.244208, 0.071826, 10.111904, 0}, - {-0.243011, 0.075417, 10.132255, 0}, - {-0.246603, 0.090980, 10.131058, 0}, - {-0.252588, 0.071826, 10.135846, 0}, - {-0.248997, 0.065841, 10.120284, 0}, - {-0.248997, 0.082600, 10.116693, 0}, - {-0.263362, 0.075417, 10.138240, 0}, - {-0.247800, 0.061052, 10.129861, 0}, - {-0.250194, 0.059855, 10.132255, 0}, - {-0.251391, 0.069432, 10.152605, 0}, - {-0.247800, 0.068235, 10.129861, 0}, - {-0.240617, 0.062249, 10.138240, 0}, - {-0.264559, 0.070629, 10.120284, 0}, - {-0.253785, 0.071826, 10.151408, 0}, - {-0.246603, 0.074220, 10.125072, 0}, - {-0.256179, 0.070629, 10.160985, 0}, - {-0.247800, 0.061052, 10.131058, 0}, - {-0.246603, 0.070629, 10.125072, 0}, - {-0.258574, 0.086191, 10.135846, 0}, - {-0.253785, 0.077812, 10.120284, 0}, - {-0.235829, 0.074220, 10.133451, 0}, - {-0.239420, 0.083797, 10.122678, 0}, - {-0.258574, 0.071826, 10.139438, 0}, - {-0.259771, 0.084994, 10.110707, 0}, - {-0.243011, 0.077812, 10.131058, 0}, - {-0.240617, 0.077812, 10.134649, 0}, - {-0.244208, 0.059855, 10.128663, 0}, - {-0.239420, 0.068235, 10.122678, 0}, - {-0.258574, 0.076614, 10.119086, 0}, - {-0.258574, 0.075417, 10.147817, 0}, - {-0.248997, 0.062249, 10.117889, 0}, - {-0.248997, 0.076614, 10.135846, 0}, - {-0.241814, 0.076614, 10.109509, 0}, - {-0.257377, 0.068235, 10.144226, 0}, - {-0.264559, 0.064643, 10.096342, 0}, - {-0.241814, 0.068235, 10.139438, 0}, - {-0.250194, 0.088585, 10.114298, 0}, - {-0.259771, 0.079009, 10.159788, 0}, - {-0.247800, 0.071826, 10.138240, 0}, - {-0.245406, 0.073023, 10.117889, 0}, - {-0.246603, 0.070629, 10.137043, 0}, - {-0.248997, 0.069432, 10.108313, 0}, - {-0.254982, 0.077812, 10.144226, 0}, - {-0.254982, 0.088585, 10.108313, 0}, - {-0.245406, 0.082600, 10.135846, 0}, - {-0.245406, 0.095768, 10.125072, 0}, - {-0.232237, 0.083797, 10.133451, 0}, - {-0.243011, 0.069432, 10.089159, 0}, - {-0.237026, 0.082600, 10.152605, 0}, - {-0.241814, 0.065841, 10.116693, 0}, - {-0.262165, 0.067038, 10.138240, 0}, - {-0.262165, 0.081403, 10.150211, 0}, - {-0.257377, 0.079009, 10.109509, 0}, - {-0.257377, 0.084994, 10.131058, 0}, - {-0.238223, 0.090980, 10.107116, 0}, - {-0.231040, 0.093374, 10.151408, 0}, - {-0.250194, 0.069432, 10.108313, 0}, - {-0.244208, 0.067038, 10.166970, 0}, - {-0.244208, 0.074220, 10.105919, 0}, - {-0.247800, 0.076614, 10.145423, 0}, - {-0.237026, 0.071826, 10.122678, 0}, - {-0.244208, 0.070629, 10.127466, 0}, - {-0.243011, 0.074220, 10.119086, 0}, - {-0.246603, 0.073023, 10.121481, 0}, - {-0.245406, 0.084994, 10.129861, 0}, - {-0.237026, 0.082600, 10.128663, 0}, - {-0.229843, 0.074220, 10.127466, 0}, - {-0.250194, 0.076614, 10.116693, 0}, - {-0.240617, 0.074220, 10.138240, 0}, - {-0.240617, 0.074220, 10.117889, 0}, - {-0.245406, 0.075417, 10.126269, 0}, - {-0.241814, 0.077812, 10.129861, 0}, - {-0.251391, 0.081403, 10.139438, 0}, - {-0.227449, 0.075417, 10.127466, 0}, - {-0.239420, 0.079009, 10.119086, 0}, - {-0.238223, 0.087388, 10.120284, 0}, - {-0.243011, 0.057461, 10.122678, 0}, - {-0.250194, 0.056264, 10.145423, 0}, - {-0.233435, 0.075417, 10.119086, 0}, - {-0.237026, 0.061052, 10.137043, 0}, - {-0.240617, 0.084994, 10.123875, 0}, - {-0.245406, 0.088585, 10.151408, 0}, - {-0.234632, 0.081403, 10.128663, 0}, - {-0.240617, 0.086191, 10.123875, 0}, - {-0.237026, 0.080206, 10.119086, 0}, - {-0.234632, 0.067038, 10.134649, 0}, - {-0.241814, 0.070629, 10.138240, 0}, - {-0.248997, 0.065841, 10.134649, 0}, - {-0.238223, 0.081403, 10.143028, 0}, - {-0.243011, 0.079009, 10.121481, 0}, - {-0.240617, 0.079009, 10.128663, 0}, - {-0.251391, 0.069432, 10.131058, 0}, - {-0.244208, 0.063446, 10.138240, 0}, - {-0.240617, 0.058658, 10.117889, 0}, - {-0.239420, 0.081403, 10.145423, 0}, - {-0.245406, 0.080206, 10.114298, 0}, - {-0.240617, 0.075417, 10.127466, 0}, - {-0.243011, 0.077812, 10.127466, 0}, - {-0.250194, 0.065841, 10.119086, 0}, - {-0.232237, 0.064643, 10.120284, 0}, - {-0.239420, 0.065841, 10.131058, 0}, - {-0.251391, 0.071826, 10.143028, 0}, - {-0.246603, 0.080206, 10.125072, 0}, - {-0.238223, 0.075417, 10.123875, 0}, - {-0.245406, 0.081403, 10.132255, 0}, - {-0.241814, 0.083797, 10.117889, 0}, - {-0.251391, 0.070629, 10.135846, 0}, - {-0.262165, 0.075417, 10.120284, 0}, - {-0.251391, 0.086191, 10.145423, 0}, - {-0.239420, 0.087388, 10.131058, 0}, - {-0.246603, 0.077812, 10.126269, 0}, - {-0.246603, 0.073023, 10.135846, 0}, - {-0.264559, 0.079009, 10.120284, 0}, - {-0.264559, 0.074220, 10.125072, 0}, - {-0.229843, 0.067038, 10.127466, 0}, - {-0.231040, 0.077812, 10.131058, 0}, - {-0.245406, 0.075417, 10.128663, 0}, - {-0.240617, 0.071826, 10.116693, 0}, - {-0.234632, 0.081403, 10.128663, 0}, - {-0.228646, 0.063446, 10.132255, 0}, - {-0.227449, 0.057461, 10.139438, 0}, - {-0.251391, 0.075417, 10.120284, 0}, - {-0.231040, 0.092177, 10.122678, 0}, - {-0.240617, 0.077812, 10.137043, 0}, - {-0.252588, 0.075417, 10.132255, 0}, - {-0.248997, 0.077812, 10.120284, 0}, - {-0.248997, 0.080206, 10.117889, 0}, - {-0.252588, 0.063446, 10.113101, 0}, - {-0.247800, 0.069432, 10.133451, 0}, - {-0.246603, 0.092177, 10.108313, 0}, - {-0.240617, 0.088585, 10.134649, 0}, - {-0.239420, 0.076614, 10.125072, 0}, - {-0.248997, 0.070629, 10.128663, 0}, - {-0.243011, 0.073023, 10.128663, 0}, - {-0.243011, 0.084994, 10.115496, 0}, - {-0.243011, 0.087388, 10.141831, 0}, - {-0.237026, 0.070629, 10.144226, 0}, - {-0.247800, 0.081403, 10.113101, 0}, - {-0.234632, 0.096965, 10.133451, 0}, - {-0.258574, 0.069432, 10.132255, 0}, - {-0.258574, 0.077812, 10.116693, 0}, - {-0.243011, 0.079009, 10.135846, 0}, - {-0.253785, 0.082600, 10.102327, 0}, - {-0.240617, 0.075417, 10.144226, 0}, - {-0.247800, 0.074220, 10.123875, 0}, - {-0.256179, 0.079009, 10.120284, 0}, - {-0.254982, 0.077812, 10.141831, 0}, - {-0.257377, 0.076614, 10.143028, 0}, - {-0.250194, 0.086191, 10.137043, 0}, - {-0.238223, 0.081403, 10.116693, 0}, - {-0.238223, 0.084994, 10.139438, 0}, - {-0.247800, 0.080206, 10.126269, 0}, - {-0.263362, 0.074220, 10.131058, 0}, - {-0.260968, 0.077812, 10.123875, 0}, - {-0.238223, 0.059855, 10.128663, 0}, - {-0.245406, 0.062249, 10.134649, 0}, - {-0.257377, 0.080206, 10.131058, 0}, - {-0.244208, 0.083797, 10.131058, 0}, - {-0.232237, 0.080206, 10.134649, 0}, - {-0.244208, 0.076614, 10.119086, 0}, - {-0.241814, 0.073023, 10.141831, 0}, - {-0.257377, 0.067038, 10.138240, 0}, - {-0.241814, 0.086191, 10.133451, 0}, - {-0.246603, 0.079009, 10.133451, 0}, - {-0.248997, 0.067038, 10.125072, 0}, - {-0.239420, 0.082600, 10.122678, 0}, - {-0.244208, 0.084994, 10.129861, 0}, - {-0.233435, 0.073023, 10.147817, 0}, - {-0.250194, 0.069432, 10.133451, 0}, - {-0.254982, 0.070629, 10.146620, 0}, - {-0.231040, 0.083797, 10.117889, 0}, - {-0.245406, 0.081403, 10.119086, 0}, - {-0.256179, 0.093374, 10.131058, 0}, - {-0.241814, 0.084994, 10.138240, 0}, - {-0.252588, 0.073023, 10.137043, 0}, - {-0.251391, 0.081403, 10.126269, 0}, - {-0.235829, 0.069432, 10.137043, 0}, - {-0.247800, 0.080206, 10.132255, 0}, - {-0.238223, 0.064643, 10.144226, 0}, - {-0.234632, 0.076614, 10.127466, 0}, - {-0.245406, 0.069432, 10.137043, 0}, - {-0.241814, 0.082600, 10.116693, 0}, - {-0.233435, 0.101754, 10.132255, 0}, - {-0.240617, 0.086191, 10.132255, 0}, - {-0.235829, 0.081403, 10.120284, 0}, - {-0.239420, 0.076614, 10.128663, 0}, - {-0.251391, 0.079009, 10.117889, 0}, - {-0.256179, 0.081403, 10.149014, 0}, - {-0.238223, 0.079009, 10.105919, 0}, - {-0.234632, 0.079009, 10.125072, 0}, - {-0.254982, 0.071826, 10.115496, 0}, - {-0.263362, 0.082600, 10.151408, 0}, - {-0.243011, 0.075417, 10.109509, 0}, - {-0.222661, 0.073023, 10.129861, 0}, - {-0.246603, 0.074220, 10.133451, 0}, - {-0.248997, 0.086191, 10.129861, 0}, - {-0.252588, 0.086191, 10.149014, 0}, - {-0.238223, 0.071826, 10.104721, 0}, - {-0.237026, 0.071826, 10.135846, 0}, - {-0.243011, 0.086191, 10.111904, 0}, - {-0.244208, 0.093374, 10.141831, 0}, - {-0.253785, 0.063446, 10.123875, 0}, - {-0.244208, 0.083797, 10.134649, 0}, - {-0.244208, 0.090980, 10.128663, 0}, - {-0.258574, 0.065841, 10.134649, 0}, - {-0.256179, 0.070629, 10.128663, 0}, - {-0.243011, 0.071826, 10.137043, 0}, - {-0.225055, 0.074220, 10.134649, 0}, - {-0.245406, 0.069432, 10.116693, 0}, - {-0.237026, 0.077812, 10.133451, 0}, - {-0.245406, 0.073023, 10.104721, 0}, - {-0.253785, 0.081403, 10.159788, 0}, - {-0.245406, 0.086191, 10.113101, 0}, - {-0.243011, 0.081403, 10.126269, 0}, - {-0.241814, 0.065841, 10.108313, 0}, - {-0.240617, 0.057461, 10.131058, 0}, - {-0.241814, 0.065841, 10.144226, 0}, - {-0.237026, 0.073023, 10.128663, 0}, - {-0.250194, 0.090980, 10.145423, 0}, - {-0.254982, 0.070629, 10.119086, 0}, - {-0.244208, 0.063446, 10.131058, 0}, - {-0.235829, 0.077812, 10.121481, 0}, - {-0.248997, 0.076614, 10.137043, 0}, - {-0.262165, 0.076614, 10.123875, 0}, - {-0.250194, 0.064643, 10.119086, 0}, - {-0.239420, 0.077812, 10.116693, 0}, - {-0.245406, 0.080206, 10.128663, 0}, - {-0.243011, 0.084994, 10.123875, 0}, - {-0.244208, 0.077812, 10.125072, 0}, - {-0.237026, 0.089783, 10.122678, 0}, - {-0.235829, 0.065841, 10.137043, 0}, - {-0.245406, 0.065841, 10.150211, 0}, - {-0.252588, 0.074220, 10.111904, 0}, - {-0.241814, 0.068235, 10.146620, 0}, - {-0.229843, 0.069432, 10.120284, 0}, - {-0.240617, 0.079009, 10.131058, 0}, - {-0.240617, 0.084994, 10.095144, 0}, - {-0.239420, 0.067038, 10.133451, 0}, - {-0.247800, 0.083797, 10.128663, 0}, - {-0.252588, 0.075417, 10.135846, 0}, - {-0.252588, 0.068235, 10.131058, 0}, - {-0.243011, 0.087388, 10.102327, 0}, - {-0.247800, 0.088585, 10.132255, 0}, - {-0.243011, 0.086191, 10.127466, 0}, - {-0.229843, 0.080206, 10.123875, 0}, - {-0.245406, 0.073023, 10.134649, 0}, - {-0.233435, 0.081403, 10.132255, 0}, - {-0.245406, 0.082600, 10.126269, 0}, - {-0.233435, 0.073023, 10.137043, 0}, - {-0.235829, 0.070629, 10.140635, 0}, - {-0.241814, 0.076614, 10.121481, 0}, - {-0.244208, 0.069432, 10.123875, 0}, - {-0.252588, 0.075417, 10.140635, 0}, - {-0.253785, 0.080206, 10.133451, 0}, - {-0.237026, 0.075417, 10.121481, 0}, - {-0.227449, 0.065841, 10.129861, 0}, - {-0.245406, 0.077812, 10.131058, 0}, - {-0.229843, 0.094571, 10.129861, 0}, - {-0.237026, 0.068235, 10.105919, 0}, - {-0.260968, 0.073023, 10.120284, 0}, - {-0.241814, 0.076614, 10.131058, 0}, - {-0.250194, 0.077812, 10.126269, 0}, - {-0.254982, 0.068235, 10.135846, 0}, - {-0.240617, 0.071826, 10.108313, 0}, - {-0.258574, 0.083797, 10.125072, 0}, - {-0.254982, 0.081403, 10.132255, 0}, - {-0.251391, 0.079009, 10.135846, 0}, - {-0.245406, 0.069432, 10.121481, 0}, - {-0.232237, 0.069432, 10.122678, 0}, - {-0.234632, 0.083797, 10.131058, 0}, - {-0.234632, 0.089783, 10.129861, 0}, - {-0.238223, 0.079009, 10.127466, 0}, - {-0.246603, 0.083797, 10.121481, 0}, - {-0.247800, 0.074220, 10.121481, 0}, - {-0.247800, 0.075417, 10.117889, 0}, - {-0.235829, 0.065841, 10.129861, 0}, - {-0.241814, 0.075417, 10.111904, 0}, - {-0.239420, 0.081403, 10.129861, 0}, - {-0.247800, 0.087388, 10.128663, 0}, - {-0.243011, 0.079009, 10.126269, 0}, - {-0.245406, 0.067038, 10.137043, 0}, - {-0.257377, 0.059855, 10.122678, 0}, - {-0.250194, 0.068235, 10.147817, 0}, - {-0.243011, 0.074220, 10.129861, 0}, - {-0.237026, 0.086191, 10.129861, 0}, - {-0.246603, 0.107739, 10.131058, 0}, - {-0.241814, 0.082600, 10.141831, 0}, - {-0.245406, 0.064643, 10.119086, 0}, - {-0.258574, 0.075417, 10.129861, 0}, - {-0.237026, 0.071826, 10.123875, 0}, - {-0.243011, 0.075417, 10.101130, 0}, - {-0.253785, 0.083797, 10.125072, 0}, - {-0.241814, 0.081403, 10.119086, 0}, - {-0.234632, 0.089783, 10.137043, 0}, - {-0.245406, 0.070629, 10.132255, 0}, - {-0.251391, 0.067038, 10.131058, 0}, - {-0.250194, 0.069432, 10.139438, 0}, - {-0.237026, 0.086191, 10.123875, 0}, - {-0.235829, 0.086191, 10.147817, 0}, - {-0.248997, 0.074220, 10.123875, 0}, - {-0.251391, 0.079009, 10.114298, 0}, - {-0.246603, 0.081403, 10.122678, 0}, - {-0.235829, 0.079009, 10.119086, 0}, - {-0.240617, 0.087388, 10.127466, 0}, - {-0.239420, 0.077812, 10.133451, 0}, - {-0.247800, 0.087388, 10.108313, 0}, - {-0.245406, 0.087388, 10.111904, 0}, - {-0.237026, 0.073023, 10.147817, 0}, - {-0.241814, 0.079009, 10.135846, 0}, - {-0.241814, 0.074220, 10.121481, 0}, - {-0.258574, 0.063446, 10.146620, 0}, - {-0.243011, 0.079009, 10.123875, 0}, - {-0.225055, 0.073023, 10.122678, 0}, - {-0.234632, 0.075417, 10.119086, 0}, - {-0.246603, 0.068235, 10.134649, 0}, - {-0.235829, 0.071826, 10.141831, 0}, - {-0.234632, 0.069432, 10.137043, 0}, - {-0.244208, 0.064643, 10.126269, 0}, - {-0.239420, 0.068235, 10.125072, 0}, - {-0.246603, 0.087388, 10.131058, 0}, - {-0.241814, 0.071826, 10.128663, 0}, - {-0.241814, 0.083797, 10.140635, 0}, - {-0.252588, 0.070629, 10.119086, 0}, - {-0.243011, 0.070629, 10.117889, 0}, - {-0.265756, 0.077812, 10.125072, 0}, - {-0.248997, 0.083797, 10.129861, 0}, - {-0.248997, 0.082600, 10.122678, 0}, - {-0.247800, 0.083797, 10.133451, 0}, - {-0.260968, 0.086191, 10.141831, 0}, - {-0.244208, 0.075417, 10.132255, 0}, - {-0.232237, 0.080206, 10.135846, 0}, - {-0.244208, 0.077812, 10.131058, 0}, - {-0.239420, 0.077812, 10.143028, 0}, - {-0.238223, 0.077812, 10.127466, 0}, - {-0.235829, 0.089783, 10.140635, 0}, - {-0.239420, 0.070629, 10.111904, 0}, - {-0.253785, 0.064643, 10.129861, 0}, - {-0.250194, 0.065841, 10.127466, 0}, - {-0.251391, 0.073023, 10.110707, 0}, - {-0.240617, 0.069432, 10.098736, 0}, - {-0.246603, 0.074220, 10.122678, 0}, - {-0.243011, 0.077812, 10.141831, 0}, - {-0.243011, 0.074220, 10.131058, 0}, - {-0.247800, 0.081403, 10.125072, 0}, - {-0.256179, 0.057461, 10.134649, 0}, - {-0.243011, 0.068235, 10.144226, 0}, - {-0.228646, 0.095768, 10.125072, 0}, - {-0.250194, 0.083797, 10.135846, 0}, - {-0.246603, 0.062249, 10.122678, 0}, - {-0.245406, 0.073023, 10.119086, 0}, - {-0.246603, 0.081403, 10.122678, 0}, - {-0.246603, 0.080206, 10.129861, 0}, - {-0.231040, 0.067038, 10.116693, 0}, - {-0.228646, 0.074220, 10.129861, 0}, - {-0.235829, 0.073023, 10.134649, 0}, - {-0.246603, 0.093374, 10.123875, 0}, - {-0.252588, 0.080206, 10.127466, 0}, - {-0.233435, 0.061052, 10.133451, 0}, - {-0.243011, 0.070629, 10.137043, 0}, - {-0.250194, 0.077812, 10.108313, 0}, - {-0.235829, 0.083797, 10.121481, 0}, - {-0.247800, 0.081403, 10.141831, 0}, - {-0.252588, 0.081403, 10.131058, 0}, - {-0.243011, 0.080206, 10.126269, 0}, - {-0.235829, 0.070629, 10.109509, 0}, - {-0.237026, 0.073023, 10.135846, 0}, - {-0.237026, 0.074220, 10.123875, 0}, - {-0.253785, 0.089783, 10.117889, 0}, - {-0.248997, 0.087388, 10.123875, 0}, - {-0.228646, 0.073023, 10.128663, 0}, - {-0.233435, 0.073023, 10.137043, 0}, - {-0.247800, 0.080206, 10.123875, 0}, - {-0.254982, 0.074220, 10.132255, 0}, - {-0.234632, 0.081403, 10.113101, 0}, - {-0.241814, 0.074220, 10.149014, 0}, - {-0.244208, 0.064643, 10.119086, 0}, - {-0.235829, 0.069432, 10.121481, 0}, - {-0.237026, 0.071826, 10.123875, 0}, - {-0.241814, 0.065841, 10.134649, 0}, - {-0.237026, 0.065841, 10.153803, 0}, - {-0.239420, 0.077812, 10.135846, 0}, - {-0.244208, 0.073023, 10.125072, 0}, - {-0.246603, 0.065841, 10.117889, 0}, - {-0.237026, 0.073023, 10.129861, 0}, - {-0.254982, 0.080206, 10.111904, 0}, - {-0.241814, 0.076614, 10.140635, 0}, - {-0.243011, 0.057461, 10.123875, 0}, - {-0.241814, 0.081403, 10.139438, 0}, - {-0.246603, 0.070629, 10.131058, 0}, - {-0.251391, 0.075417, 10.147817, 0}, - {-0.251391, 0.070629, 10.120284, 0}, - {-0.234632, 0.086191, 10.137043, 0}, - {-0.235829, 0.079009, 10.119086, 0}, - {-0.235829, 0.086191, 10.119086, 0}, - {-0.234632, 0.069432, 10.121481, 0}, - {-0.246603, 0.069432, 10.126269, 0}, - {-0.245406, 0.083797, 10.145423, 0}, - {-0.245406, 0.077812, 10.116693, 0}, - {-0.240617, 0.079009, 10.144226, 0}, - {-0.237026, 0.073023, 10.134649, 0}, - {-0.238223, 0.077812, 10.140635, 0}, - {-0.227449, 0.082600, 10.127466, 0}, - {-0.233435, 0.092177, 10.122678, 0}, - {-0.246603, 0.083797, 10.140635, 0}, - {-0.229843, 0.065841, 10.134649, 0}, - {-0.227449, 0.080206, 10.138240, 0}, - {-0.243011, 0.077812, 10.138240, 0}, - {-0.240617, 0.076614, 10.119086, 0}, - {-0.241814, 0.073023, 10.125072, 0}, - {-0.240617, 0.071826, 10.123875, 0}, - {-0.250194, 0.079009, 10.117889, 0}, - {-0.243011, 0.080206, 10.145423, 0}, - {-0.252588, 0.081403, 10.119086, 0}, - {-0.240617, 0.068235, 10.132255, 0}, - {-0.244208, 0.065841, 10.114298, 0}, - {-0.235829, 0.073023, 10.125072, 0}, - {-0.248997, 0.076614, 10.117889, 0}, - {-0.250194, 0.059855, 10.121481, 0}, - {-0.239420, 0.095768, 10.147817, 0}, - {-0.262165, 0.081403, 10.116693, 0}, - {-0.253785, 0.065841, 10.149014, 0}, - {-0.244208, 0.067038, 10.115496, 0}, - {-0.238223, 0.074220, 10.122678, 0}, - {-0.235829, 0.075417, 10.149014, 0}, - {-0.243011, 0.062249, 10.144226, 0}, - {-0.244208, 0.073023, 10.123875, 0}, - {-0.239420, 0.084994, 10.132255, 0}, - {-0.238223, 0.074220, 10.120284, 0}, - {-0.256179, 0.063446, 10.137043, 0}, - {-0.243011, 0.061052, 10.117889, 0}, - {-0.235829, 0.064643, 10.119086, 0}, - {-0.235829, 0.079009, 10.133451, 0}, - {-0.237026, 0.082600, 10.119086, 0}, - {-0.238223, 0.079009, 10.139438, 0}, - {-0.247800, 0.065841, 10.117889, 0}, - {-0.243011, 0.069432, 10.158591, 0}, - {-0.246603, 0.080206, 10.122678, 0}, - {-0.256179, 0.083797, 10.141831, 0}, - {-0.235829, 0.092177, 10.108313, 0}, - {-0.237026, 0.061052, 10.132255, 0}, - {-0.237026, 0.058658, 10.156197, 0}, - {-0.244208, 0.059855, 10.117889, 0}, - {-0.237026, 0.087388, 10.144226, 0}, - {-0.257377, 0.094571, 10.110707, 0}, - {-0.256179, 0.080206, 10.132255, 0}, - {-0.243011, 0.089783, 10.133451, 0}, - {-0.238223, 0.080206, 10.133451, 0}, - {-0.240617, 0.067038, 10.114298, 0}, - {-0.246603, 0.064643, 10.133451, 0}, - {-0.245406, 0.075417, 10.128663, 0}, - {-0.240617, 0.071826, 10.122678, 0}, - {-0.229843, 0.068235, 10.126269, 0}, - {-0.240617, 0.081403, 10.123875, 0}, - {-0.244208, 0.079009, 10.138240, 0}, - {-0.237026, 0.065841, 10.145423, 0}, - {-0.239420, 0.069432, 10.133451, 0}, - {-0.253785, 0.076614, 10.127466, 0}, - {-0.256179, 0.082600, 10.125072, 0}, - {-0.232237, 0.081403, 10.113101, 0}, - {-0.239420, 0.065841, 10.139438, 0}, - {-0.241814, 0.084994, 10.128663, 0}, - {-0.252588, 0.071826, 10.122678, 0}, - {-0.243011, 0.067038, 10.157393, 0}, - {-0.251391, 0.081403, 10.134649, 0}, - {-0.251391, 0.083797, 10.127466, 0}, - {-0.265756, 0.074220, 10.115496, 0}, - {-0.245406, 0.062249, 10.150211, 0}, - {-0.241814, 0.070629, 10.117889, 0}, - {-0.257377, 0.083797, 10.120284, 0}, - {-0.239420, 0.081403, 10.121481, 0}, - {-0.247800, 0.068235, 10.135846, 0}, - {-0.243011, 0.071826, 10.129861, 0}, - {-0.235829, 0.082600, 10.128663, 0}, - {-0.247800, 0.073023, 10.145423, 0}, - {-0.258574, 0.065841, 10.123875, 0}, - {-0.233435, 0.069432, 10.122678, 0}, - {-0.245406, 0.076614, 10.120284, 0}, - {-0.247800, 0.089783, 10.131058, 0}, - {-0.244208, 0.090980, 10.114298, 0}, - {-0.247800, 0.089783, 10.143028, 0}, - {-0.229843, 0.073023, 10.119086, 0}, - {-0.240617, 0.082600, 10.134649, 0}, - {-0.244208, 0.095768, 10.125072, 0}, - {-0.241814, 0.083797, 10.145423, 0}, - {-0.250194, 0.068235, 10.139438, 0}, - {-0.248997, 0.075417, 10.113101, 0}, - {-0.250194, 0.076614, 10.128663, 0}, - {-0.247800, 0.081403, 10.114298, 0}, - {-0.247800, 0.075417, 10.123875, 0}, - {-0.248997, 0.095768, 10.145423, 0}, - {-0.245406, 0.088585, 10.143028, 0}, - {-0.238223, 0.084994, 10.113101, 0}, - {-0.240617, 0.071826, 10.126269, 0}, - {-0.240617, 0.067038, 10.140635, 0}, - {-0.245406, 0.071826, 10.138240, 0}, - {-0.254982, 0.073023, 10.128663, 0}, - {-0.245406, 0.077812, 10.145423, 0}, - {-0.250194, 0.070629, 10.127466, 0}, - {-0.243011, 0.073023, 10.137043, 0}, - {-0.245406, 0.067038, 10.117889, 0}, - {-0.243011, 0.071826, 10.151408, 0}, - {-0.252588, 0.081403, 10.128663, 0}, - {-0.233435, 0.074220, 10.110707, 0}, - {-0.243011, 0.074220, 10.126269, 0}, - {-0.239420, 0.089783, 10.143028, 0}, - {-0.237026, 0.086191, 10.123875, 0}, - {-0.243011, 0.064643, 10.129861, 0}, - {-0.234632, 0.077812, 10.133451, 0}, - {-0.250194, 0.086191, 10.133451, 0}, - {-0.241814, 0.074220, 10.125072, 0}, - {-0.243011, 0.086191, 10.122678, 0}, - {-0.234632, 0.076614, 10.121481, 0}, - {-0.251391, 0.082600, 10.135846, 0}, - {-0.251391, 0.084994, 10.133451, 0}, - {-0.245406, 0.063446, 10.117889, 0}, - {-0.253785, 0.079009, 10.122678, 0}, - {-0.243011, 0.074220, 10.129861, 0}, - {-0.233435, 0.069432, 10.127466, 0}, - {-0.251391, 0.077812, 10.126269, 0}, - {-0.245406, 0.079009, 10.120284, 0}, - {-0.247800, 0.068235, 10.128663, 0}, - {-0.244208, 0.069432, 10.133451, 0}, - {-0.238223, 0.074220, 10.146620, 0}, - {-0.241814, 0.080206, 10.120284, 0}, - {-0.248997, 0.071826, 10.107116, 0}, - {-0.240617, 0.073023, 10.123875, 0}, - {-0.239420, 0.063446, 10.135846, 0}, - {-0.245406, 0.068235, 10.117889, 0}, - {-0.248997, 0.088585, 10.105919, 0}, - {-0.248997, 0.067038, 10.138240, 0}, - {-0.247800, 0.074220, 10.128663, 0}, - {-0.237026, 0.079009, 10.138240, 0}, - {-0.243011, 0.092177, 10.140635, 0}, - {-0.235829, 0.082600, 10.128663, 0}, - {-0.240617, 0.079009, 10.116693, 0}, - {-0.248997, 0.087388, 10.114298, 0}, - {-0.238223, 0.079009, 10.120284, 0}, - {-0.241814, 0.087388, 10.128663, 0}, - {-0.250194, 0.063446, 10.129861, 0}, - {-0.245406, 0.071826, 10.128663, 0}, - {-0.251391, 0.073023, 10.123875, 0}, - {-0.258574, 0.084994, 10.137043, 0}, - {-0.246603, 0.077812, 10.140635, 0}, - {-0.244208, 0.070629, 10.111904, 0}, - {-0.252588, 0.075417, 10.143028, 0}, - {-0.248997, 0.069432, 10.117889, 0}, - {-0.243011, 0.073023, 10.129861, 0}, - {-0.238223, 0.079009, 10.143028, 0}, - {-0.238223, 0.080206, 10.114298, 0}, - {-0.241814, 0.074220, 10.132255, 0}, - {-0.240617, 0.065841, 10.132255, 0}, - {-0.247800, 0.069432, 10.134649, 0}, - {-0.251391, 0.075417, 10.132255, 0}, - {-0.238223, 0.086191, 10.115496, 0}, - {-0.245406, 0.076614, 10.139438, 0}, - {-0.240617, 0.073023, 10.123875, 0}, - {-0.238223, 0.071826, 10.137043, 0}, - {-0.245406, 0.076614, 10.135846, 0}, - {-0.251391, 0.081403, 10.133451, 0}, - {-0.251391, 0.086191, 10.134649, 0}, - {-0.248997, 0.079009, 10.115496, 0}, - {-0.256179, 0.067038, 10.133451, 0}, - {-0.246603, 0.068235, 10.121481, 0}, - {-0.244208, 0.082600, 10.135846, 0}, - {-0.250194, 0.079009, 10.122678, 0}, - {-0.252588, 0.079009, 10.120284, 0}, - {-0.243011, 0.083797, 10.127466, 0}, - {-0.243011, 0.071826, 10.119086, 0}, - {-0.251391, 0.081403, 10.128663, 0}, - {-0.252588, 0.065841, 10.122678, 0}, - {-0.240617, 0.079009, 10.131058, 0}, - {-0.253785, 0.082600, 10.121481, 0}, - {-0.256179, 0.071826, 10.140635, 0}, - {-0.263362, 0.070629, 10.123875, 0}, - {-0.248997, 0.074220, 10.123875, 0}, - {-0.235829, 0.064643, 10.125072, 0}, - {-0.238223, 0.082600, 10.125072, 0}, - {-0.238223, 0.077812, 10.108313, 0}, - {-0.231040, 0.071826, 10.117889, 0}, - {-0.250194, 0.093374, 10.122678, 0}, - {-0.241814, 0.080206, 10.123875, 0}, - {-0.258574, 0.073023, 10.117889, 0}, - {-0.248997, 0.071826, 10.127466, 0}, - {-0.246603, 0.067038, 10.146620, 0}, - {-0.248997, 0.074220, 10.126269, 0}, - {-0.248997, 0.071826, 10.133451, 0}, - {-0.247800, 0.080206, 10.133451, 0}, - {-0.239420, 0.076614, 10.138240, 0}, - {-0.248997, 0.081403, 10.127466, 0}, - {-0.248997, 0.076614, 10.137043, 0}, - {-0.248997, 0.080206, 10.123875, 0}, - {-0.239420, 0.067038, 10.141831, 0}, - {-0.235829, 0.083797, 10.119086, 0}, - {-0.247800, 0.069432, 10.134649, 0}, - {-0.237026, 0.087388, 10.137043, 0}, - {-0.246603, 0.073023, 10.131058, 0}, - {-0.251391, 0.083797, 10.135846, 0}, - {-0.247800, 0.071826, 10.121481, 0}, - {-0.246603, 0.076614, 10.128663, 0}, - {-0.251391, 0.082600, 10.114298, 0}, - {-0.254982, 0.082600, 10.134649, 0}, - {-0.237026, 0.084994, 10.117889, 0}, - {-0.229843, 0.077812, 10.119086, 0}, - {-0.246603, 0.070629, 10.125072, 0}, - {-0.235829, 0.076614, 10.140635, 0}, - {-0.245406, 0.061052, 10.122678, 0}, - {-0.240617, 0.076614, 10.119086, 0}, - {-0.259771, 0.088585, 10.126269, 0}, - {-0.241814, 0.077812, 10.139438, 0}, - {-0.244208, 0.075417, 10.116693, 0}, - {-0.239420, 0.067038, 10.109509, 0}, - {-0.241814, 0.083797, 10.134649, 0}, - {-0.244208, 0.067038, 10.125072, 0}, - {-0.244208, 0.073023, 10.149014, 0}, - {-0.243011, 0.084994, 10.116693, 0}, - {-0.231040, 0.076614, 10.123875, 0}, - {-0.247800, 0.089783, 10.120284, 0}, - {-0.246603, 0.077812, 10.122678, 0}, - {-0.262165, 0.077812, 10.120284, 0}, - {-0.231040, 0.070629, 10.115496, 0}, - {-0.243011, 0.077812, 10.149014, 0}, - {-0.248997, 0.090980, 10.119086, 0}, - {-0.250194, 0.090980, 10.132255, 0}, - {-0.238223, 0.074220, 10.120284, 0}, - {-0.228646, 0.080206, 10.140635, 0}, - {-0.245406, 0.075417, 10.113101, 0}, - {-0.233435, 0.089783, 10.131058, 0}, - {-0.244208, 0.081403, 10.117889, 0}, - {-0.246603, 0.063446, 10.141831, 0}, - {-0.235829, 0.090980, 10.143028, 0}, - {-0.233435, 0.081403, 10.125072, 0}, - {-0.251391, 0.077812, 10.127466, 0}, - {-0.238223, 0.081403, 10.125072, 0}, - {-0.235829, 0.074220, 10.132255, 0}, - {-0.244208, 0.064643, 10.119086, 0}, - {-0.256179, 0.071826, 10.143028, 0}, - {-0.240617, 0.082600, 10.110707, 0}, - {-0.248997, 0.071826, 10.137043, 0}, - {-0.251391, 0.076614, 10.125072, 0}, - {-0.228646, 0.082600, 10.134649, 0}, - {-0.233435, 0.082600, 10.111904, 0}, - {-0.246603, 0.068235, 10.119086, 0}, - {-0.235829, 0.067038, 10.143028, 0}, - {-0.241814, 0.079009, 10.126269, 0}, - {-0.238223, 0.095768, 10.125072, 0}, - {-0.243011, 0.065841, 10.105919, 0}, - {-0.256179, 0.081403, 10.132255, 0}, - {-0.256179, 0.073023, 10.110707, 0}, - {-0.246603, 0.079009, 10.145423, 0}, - {-0.231040, 0.069432, 10.122678, 0}, - {-0.234632, 0.065841, 10.139438, 0}, - {-0.232237, 0.094571, 10.126269, 0}, - {-0.243011, 0.081403, 10.149014, 0}, - {-0.256179, 0.083797, 10.132255, 0}, - {-0.246603, 0.073023, 10.127466, 0}, - {-0.244208, 0.067038, 10.131058, 0}, - {-0.244208, 0.082600, 10.133451, 0}, - {-0.239420, 0.088585, 10.137043, 0}, - {-0.234632, 0.069432, 10.123875, 0}, - {-0.241814, 0.069432, 10.137043, 0}, - {-0.241814, 0.083797, 10.120284, 0}, - {-0.243011, 0.075417, 10.134649, 0}, - {-0.250194, 0.075417, 10.132255, 0}, - {-0.240617, 0.076614, 10.126269, 0}, - {-0.265756, 0.083797, 10.137043, 0}, - {-0.258574, 0.079009, 10.116693, 0}, - {-0.237026, 0.069432, 10.122678, 0}, - {-0.248997, 0.073023, 10.121481, 0}, - {-0.256179, 0.080206, 10.123875, 0}, - {-0.248997, 0.067038, 10.122678, 0}, - {-0.237026, 0.083797, 10.143028, 0}, - {-0.238223, 0.080206, 10.114298, 0}, - {-0.253785, 0.074220, 10.129861, 0}, - {-0.250194, 0.075417, 10.129861, 0}, - {-0.254982, 0.081403, 10.151408, 0}, - {-0.250194, 0.070629, 10.135846, 0}, - {-0.247800, 0.075417, 10.120284, 0}, - {-0.241814, 0.064643, 10.139438, 0}, - {-0.246603, 0.071826, 10.138240, 0}, - {-0.243011, 0.079009, 10.152605, 0}, - {-0.241814, 0.080206, 10.127466, 0}, - {-0.251391, 0.070629, 10.129861, 0}, - {-0.243011, 0.081403, 10.139438, 0}, - {-0.251391, 0.070629, 10.129861, 0}, - {-0.251391, 0.076614, 10.122678, 0}, - {-0.252588, 0.079009, 10.133451, 0}, - {-0.254982, 0.073023, 10.128663, 0}, - {-0.232237, 0.067038, 10.113101, 0}, - {-0.239420, 0.088585, 10.120284, 0}, - {-0.245406, 0.080206, 10.113101, 0}, - {-0.238223, 0.075417, 10.131058, 0}, - {-0.244208, 0.065841, 10.109509, 0}, - {-0.235829, 0.068235, 10.141831, 0}, - {-0.251391, 0.081403, 10.121481, 0}, - {-0.250194, 0.077812, 10.119086, 0}, - {-0.241814, 0.071826, 10.126269, 0}, - {-0.233435, 0.069432, 10.135846, 0}, - {-0.239420, 0.076614, 10.131058, 0}, - {-0.239420, 0.088585, 10.107116, 0}, - {-0.234632, 0.084994, 10.126269, 0}, - {-0.247800, 0.077812, 10.128663, 0}, - {-0.246603, 0.083797, 10.137043, 0}, - {-0.240617, 0.087388, 10.127466, 0}, - {-0.256179, 0.070629, 10.117889, 0}, - {-0.243011, 0.077812, 10.121481, 0}, - {-0.243011, 0.083797, 10.133451, 0}, - {-0.252588, 0.087388, 10.125072, 0}, - {-0.256179, 0.073023, 10.127466, 0}, - {-0.239420, 0.057461, 10.128663, 0}, - {-0.243011, 0.070629, 10.117889, 0}, - {-0.252588, 0.074220, 10.138240, 0}, - {-0.243011, 0.073023, 10.127466, 0}, - {-0.238223, 0.082600, 10.133451, 0}, - {-0.235829, 0.074220, 10.143028, 0}, - {-0.248997, 0.065841, 10.153803, 0}, - {-0.240617, 0.081403, 10.107116, 0}, - {-0.241814, 0.087388, 10.123875, 0}, - {-0.241814, 0.070629, 10.141831, 0}, - {-0.238223, 0.074220, 10.113101, 0}, - {-0.251391, 0.079009, 10.129861, 0}, - {-0.253785, 0.082600, 10.108313, 0}, - {-0.254982, 0.075417, 10.121481, 0}, - {-0.247800, 0.057461, 10.133451, 0}, - {-0.243011, 0.058658, 10.128663, 0}, - {-0.244208, 0.080206, 10.120284, 0}, - {-0.231040, 0.079009, 10.109509, 0}, - {-0.256179, 0.070629, 10.120284, 0}, - {-0.251391, 0.082600, 10.143028, 0}, - {-0.233435, 0.068235, 10.128663, 0}, - {-0.241814, 0.068235, 10.129861, 0}, - {-0.235829, 0.083797, 10.111904, 0}, - {-0.238223, 0.067038, 10.139438, 0}, - {-0.260968, 0.063446, 10.128663, 0}, - {-0.231040, 0.084994, 10.140635, 0}, - {-0.237026, 0.082600, 10.134649, 0}, - {-0.246603, 0.070629, 10.144226, 0}, - {-0.246603, 0.080206, 10.125072, 0}, - {-0.244208, 0.087388, 10.122678, 0}, - {-0.234632, 0.069432, 10.111904, 0}, - {-0.252588, 0.065841, 10.121481, 0}, - {-0.245406, 0.071826, 10.128663, 0}, - {-0.243011, 0.075417, 10.129861, 0}, - {-0.238223, 0.068235, 10.139438, 0}, - {-0.256179, 0.076614, 10.126269, 0}, - {-0.246603, 0.083797, 10.131058, 0}, - {-0.248997, 0.080206, 10.116693, 0}, - {-0.241814, 0.082600, 10.123875, 0}, - {-0.262165, 0.075417, 10.113101, 0}, - {-0.240617, 0.079009, 10.134649, 0}, - {-0.244208, 0.077812, 10.121481, 0}, - {-0.246603, 0.068235, 10.141831, 0}, - {-0.252588, 0.075417, 10.120284, 0}, - {-0.247800, 0.084994, 10.104721, 0}, - {-0.241814, 0.086191, 10.126269, 0}, - {-0.237026, 0.082600, 10.117889, 0}, - {-0.243011, 0.070629, 10.117889, 0}, - {-0.239420, 0.070629, 10.135846, 0}, - {-0.237026, 0.065841, 10.120284, 0}, - {-0.237026, 0.061052, 10.125072, 0}, - {-0.235829, 0.061052, 10.114298, 0}, - {-0.252588, 0.074220, 10.137043, 0}, - {-0.253785, 0.086191, 10.119086, 0}, - {-0.252588, 0.089783, 10.129861, 0}, - {-0.245406, 0.084994, 10.126269, 0}, - {-0.232237, 0.076614, 10.120284, 0}, - {-0.252588, 0.082600, 10.119086, 0}, - {-0.251391, 0.064643, 10.132255, 0}, - {-0.227449, 0.076614, 10.149014, 0}, - {-0.259771, 0.083797, 10.131058, 0}, - {-0.248997, 0.075417, 10.127466, 0}, - {-0.244208, 0.071826, 10.133451, 0}, - {-0.243011, 0.070629, 10.132255, 0}, - {-0.228646, 0.076614, 10.128663, 0}, - {-0.241814, 0.089783, 10.138240, 0}, - {-0.252588, 0.086191, 10.122678, 0}, - {-0.254982, 0.068235, 10.133451, 0}, - {-0.250194, 0.071826, 10.150211, 0}, - {-0.235829, 0.084994, 10.140635, 0}, - {-0.234632, 0.087388, 10.139438, 0}, - {-0.245406, 0.077812, 10.105919, 0}, - {-0.250194, 0.080206, 10.107116, 0}, - {-0.240617, 0.092177, 10.132255, 0}, - {-0.243011, 0.077812, 10.133451, 0}, - {-0.248997, 0.062249, 10.128663, 0}, - {-0.245406, 0.068235, 10.125072, 0}, - {-0.250194, 0.064643, 10.129861, 0}, - {-0.248997, 0.082600, 10.126269, 0}, - {-0.252588, 0.073023, 10.141831, 0}, - {-0.250194, 0.076614, 10.127466, 0}, - {-0.251391, 0.077812, 10.121481, 0}, - {-0.250194, 0.069432, 10.134649, 0}, - {-0.232237, 0.065841, 10.131058, 0}, - {-0.233435, 0.081403, 10.131058, 0}, - {-0.241814, 0.074220, 10.111904, 0}, - {-0.248997, 0.064643, 10.135846, 0}, - {-0.239420, 0.081403, 10.143028, 0}, - {-0.239420, 0.077812, 10.138240, 0}, - {-0.237026, 0.074220, 10.110707, 0}, - {-0.235829, 0.081403, 10.121481, 0}, - {-0.247800, 0.063446, 10.129861, 0}, - {-0.235829, 0.068235, 10.121481, 0}, - {-0.238223, 0.064643, 10.123875, 0}, - {-0.246603, 0.070629, 10.132255, 0}, - {-0.264559, 0.073023, 10.145423, 0}, - {-0.247800, 0.065841, 10.116693, 0}, - {-0.247800, 0.084994, 10.125072, 0}, - {-0.225055, 0.080206, 10.115496, 0}, - {-0.233435, 0.064643, 10.135846, 0}, - {-0.247800, 0.069432, 10.131058, 0}, - {-0.234632, 0.081403, 10.125072, 0}, - {-0.246603, 0.081403, 10.128663, 0}, - {-0.235829, 0.086191, 10.117889, 0}, - {-0.233435, 0.077812, 10.122678, 0}, - {-0.256179, 0.049081, 10.128663, 0}, - {-0.243011, 0.083797, 10.138240, 0}, - {-0.239420, 0.087388, 10.129861, 0}, - {-0.238223, 0.068235, 10.131058, 0}, - {-0.234632, 0.068235, 10.129861, 0}, - {-0.250194, 0.080206, 10.135846, 0}, - {-0.246603, 0.062249, 10.131058, 0}, - {-0.243011, 0.076614, 10.134649, 0}, - {-0.246603, 0.093374, 10.128663, 0}, - {-0.251391, 0.065841, 10.126269, 0}, - {-0.235829, 0.069432, 10.135846, 0}, - {-0.243011, 0.081403, 10.120284, 0}, - {-0.245406, 0.086191, 10.129861, 0}, - {-0.234632, 0.073023, 10.110707, 0}, - {-0.244208, 0.083797, 10.140635, 0}, - {-0.247800, 0.069432, 10.141831, 0}, - {-0.240617, 0.076614, 10.149014, 0}, - {-0.243011, 0.081403, 10.122678, 0}, - {-0.237026, 0.071826, 10.120284, 0}, - {-0.234632, 0.073023, 10.120284, 0}, - {-0.237026, 0.077812, 10.131058, 0}, - {-0.244208, 0.080206, 10.152605, 0}, - {-0.250194, 0.076614, 10.135846, 0}, - {-0.253785, 0.069432, 10.131058, 0}, - {-0.260968, 0.073023, 10.141831, 0}, - {-0.247800, 0.070629, 10.134649, 0}, - {-0.257377, 0.068235, 10.125072, 0}, - {-0.243011, 0.073023, 10.121481, 0}, - {-0.235829, 0.082600, 10.127466, 0}, - {-0.237026, 0.070629, 10.139438, 0}, - {-0.227449, 0.081403, 10.127466, 0}, - {-0.239420, 0.080206, 10.141831, 0}, - {-0.251391, 0.069432, 10.129861, 0}, - {-0.238223, 0.069432, 10.121481, 0}, - {-0.237026, 0.069432, 10.126269, 0}, - {-0.250194, 0.077812, 10.114298, 0}, - {-0.237026, 0.094571, 10.116693, 0}, - {-0.253785, 0.084994, 10.143028, 0}, - {-0.263362, 0.071826, 10.123875, 0}, - {-0.246603, 0.064643, 10.126269, 0}, - {-0.240617, 0.059855, 10.131058, 0}, - {-0.247800, 0.070629, 10.139438, 0}, - {-0.240617, 0.082600, 10.132255, 0}, - {-0.234632, 0.073023, 10.111904, 0}, - {-0.240617, 0.062249, 10.131058, 0}, - {-0.238223, 0.080206, 10.129861, 0}, - {-0.243011, 0.076614, 10.123875, 0}, - {-0.246603, 0.080206, 10.125072, 0}, - {-0.235829, 0.079009, 10.127466, 0}, - {-0.243011, 0.076614, 10.110707, 0}, - {-0.246603, 0.065841, 10.128663, 0}, - {-0.246603, 0.076614, 10.133451, 0}, - {-0.253785, 0.080206, 10.123875, 0}, - {-0.241814, 0.073023, 10.119086, 0}, - {-0.250194, 0.075417, 10.120284, 0}, - {-0.235829, 0.079009, 10.143028, 0}, - {-0.241814, 0.071826, 10.135846, 0}, - {-0.254982, 0.077812, 10.125072, 0}, - {-0.238223, 0.077812, 10.122678, 0}, - {-0.235829, 0.071826, 10.132255, 0}, - {-0.238223, 0.084994, 10.120284, 0}, - {-0.253785, 0.075417, 10.146620, 0}, - {-0.254982, 0.069432, 10.141831, 0}, - {-0.240617, 0.087388, 10.126269, 0}, - {-0.251391, 0.088585, 10.115496, 0}, - {-0.256179, 0.065841, 10.129861, 0}, - {-0.243011, 0.069432, 10.127466, 0}, - {-0.246603, 0.063446, 10.134649, 0}, - {-0.246603, 0.073023, 10.128663, 0}, - {-0.240617, 0.068235, 10.119086, 0}, - {-0.257377, 0.069432, 10.143028, 0}, - {-0.245406, 0.081403, 10.128663, 0}, - {-0.252588, 0.075417, 10.120284, 0}, - {-0.241814, 0.068235, 10.111904, 0}, - {-0.238223, 0.075417, 10.141831, 0}, - {-0.240617, 0.071826, 10.111904, 0}, - {-0.247800, 0.067038, 10.126269, 0}, - {-0.247800, 0.068235, 10.134649, 0}, - {-0.238223, 0.084994, 10.139438, 0}, - {-0.237026, 0.090980, 10.141831, 0}, - {-0.245406, 0.068235, 10.109509, 0}, - {-0.256179, 0.076614, 10.143028, 0}, - {-0.237026, 0.080206, 10.116693, 0}, - {-0.228646, 0.079009, 10.134649, 0}, - {-0.247800, 0.071826, 10.121481, 0}, - {-0.241814, 0.075417, 10.129861, 0}, - {-0.228646, 0.076614, 10.152605, 0}, - {-0.238223, 0.087388, 10.125072, 0}, - {-0.239420, 0.075417, 10.128663, 0}, - {-0.247800, 0.074220, 10.114298, 0}, - {-0.219069, 0.080206, 10.126269, 0}, - {-0.234632, 0.082600, 10.109509, 0}, - {-0.244208, 0.063446, 10.127466, 0}, - {-0.247800, 0.068235, 10.134649, 0}, - {-0.245406, 0.069432, 10.139438, 0}, - {-0.251391, 0.086191, 10.128663, 0}, - {-0.244208, 0.065841, 10.127466, 0}, - {-0.246603, 0.070629, 10.125072, 0}, - {-0.240617, 0.081403, 10.125072, 0}, - {-0.232237, 0.063446, 10.141831, 0}, - {-0.247800, 0.065841, 10.126269, 0}, - {-0.235829, 0.086191, 10.133451, 0}, - {-0.245406, 0.096965, 10.121481, 0}, - {-0.239420, 0.090980, 10.121481, 0}, - {-0.248997, 0.077812, 10.125072, 0}, - {-0.231040, 0.067038, 10.126269, 0}, - {-0.245406, 0.081403, 10.125072, 0}, - {-0.231040, 0.074220, 10.145423, 0}, - {-0.253785, 0.067038, 10.115496, 0}, - {-0.246603, 0.065841, 10.110707, 0}, - {-0.245406, 0.069432, 10.131058, 0}, - {-0.232237, 0.076614, 10.113101, 0}, - {-0.243011, 0.075417, 10.121481, 0}, - {-0.243011, 0.079009, 10.132255, 0}, - {-0.238223, 0.079009, 10.123875, 0}, - {-0.245406, 0.069432, 10.122678, 0}, - {-0.247800, 0.075417, 10.126269, 0}, - {-0.239420, 0.079009, 10.139438, 0}, - {-0.244208, 0.083797, 10.105919, 0}, - {-0.245406, 0.071826, 10.109509, 0}, - {-0.233435, 0.076614, 10.128663, 0}, - {-0.243011, 0.088585, 10.131058, 0}, - {-0.252588, 0.069432, 10.117889, 0}, - {-0.248997, 0.090980, 10.119086, 0}, - {-0.241814, 0.074220, 10.129861, 0}, - {-0.253785, 0.068235, 10.135846, 0}, - {-0.240617, 0.074220, 10.125072, 0}, - {-0.246603, 0.076614, 10.131058, 0}, - {-0.238223, 0.081403, 10.117889, 0}, - {-0.246603, 0.074220, 10.127466, 0}, - {-0.250194, 0.070629, 10.133451, 0}, - {-0.248997, 0.073023, 10.132255, 0}, - {-0.250194, 0.077812, 10.122678, 0}, - {-0.259771, 0.077812, 10.123875, 0}, - {-0.234632, 0.079009, 10.123875, 0}, - {-0.241814, 0.073023, 10.120284, 0}, - {-0.251391, 0.063446, 10.146620, 0}, - {-0.250194, 0.074220, 10.113101, 0}, - {-0.256179, 0.082600, 10.119086, 0}, - {-0.257377, 0.080206, 10.132255, 0}, - {-0.245406, 0.090980, 10.127466, 0}, - {-0.243011, 0.075417, 10.133451, 0}, - {-0.239420, 0.088585, 10.125072, 0}, - {-0.241814, 0.079009, 10.127466, 0}, - {-0.251391, 0.070629, 10.137043, 0}, - {-0.235829, 0.081403, 10.110707, 0}, - {-0.248997, 0.075417, 10.141831, 0}, - {-0.231040, 0.087388, 10.125072, 0}, - {-0.247800, 0.068235, 10.127466, 0}, - {-0.252588, 0.086191, 10.119086, 0}, - {-0.240617, 0.071826, 10.127466, 0}, - {-0.243011, 0.081403, 10.144226, 0}, - {-0.243011, 0.083797, 10.126269, 0}, - {-0.251391, 0.074220, 10.127466, 0}, - {-0.239420, 0.084994, 10.125072, 0}, - {-0.231040, 0.069432, 10.113101, 0}, - {-0.246603, 0.069432, 10.138240, 0}, - {-0.243011, 0.075417, 10.132255, 0}, - {-0.243011, 0.084994, 10.113101, 0}, - {-0.253785, 0.082600, 10.120284, 0}, - {-0.247800, 0.070629, 10.125072, 0}, - {-0.244208, 0.079009, 10.113101, 0}, - {-0.260968, 0.073023, 10.127466, 0}, - {-0.239420, 0.063446, 10.128663, 0}, - {-0.234632, 0.082600, 10.122678, 0}, - {-0.240617, 0.079009, 10.132255, 0}, - {-0.251391, 0.069432, 10.133451, 0}, - {-0.252588, 0.073023, 10.131058, 0}, - {-0.239420, 0.059855, 10.121481, 0}, - {-0.238223, 0.079009, 10.122678, 0}, - {-0.229843, 0.070629, 10.115496, 0}, - {-0.246603, 0.074220, 10.128663, 0}, - {-0.235829, 0.079009, 10.121481, 0}, - {-0.237026, 0.076614, 10.146620, 0}, - {-0.244208, 0.077812, 10.117889, 0}, - {-0.258574, 0.070629, 10.133451, 0}, - {-0.259771, 0.077812, 10.119086, 0}, - {-0.246603, 0.083797, 10.133451, 0}, - {-0.241814, 0.076614, 10.127466, 0}, - {-0.253785, 0.077812, 10.116693, 0}, - {-0.256179, 0.075417, 10.123875, 0}, - {-0.254982, 0.074220, 10.120284, 0}, - {-0.252588, 0.070629, 10.114298, 0}, - {-0.256179, 0.074220, 10.128663, 0}, - {-0.237026, 0.071826, 10.139438, 0}, - {-0.235829, 0.069432, 10.108313, 0}, - {-0.250194, 0.074220, 10.116693, 0}, - {-0.241814, 0.073023, 10.131058, 0}, - {-0.234632, 0.075417, 10.147817, 0}, - {-0.238223, 0.067038, 10.111904, 0}, - {-0.251391, 0.071826, 10.128663, 0}, - {-0.239420, 0.087388, 10.134649, 0}, - {-0.237026, 0.082600, 10.128663, 0}, - {-0.240617, 0.089783, 10.133451, 0}, - {-0.245406, 0.081403, 10.119086, 0}, - {-0.241814, 0.080206, 10.128663, 0}, - {-0.235829, 0.062249, 10.140635, 0}, - {-0.235829, 0.065841, 10.128663, 0}, - {-0.237026, 0.092177, 10.128663, 0}, - {-0.244208, 0.082600, 10.122678, 0}, - {-0.247800, 0.065841, 10.127466, 0}, - {-0.243011, 0.070629, 10.113101, 0}, - {-0.238223, 0.068235, 10.123875, 0}, - {-0.241814, 0.077812, 10.107116, 0}, - {-0.238223, 0.088585, 10.132255, 0}, - {-0.234632, 0.067038, 10.127466, 0}, - {-0.243011, 0.075417, 10.117889, 0}, - {-0.240617, 0.077812, 10.132255, 0}, - {-0.240617, 0.079009, 10.120284, 0}, - {-0.239420, 0.074220, 10.125072, 0}, - {-0.233435, 0.071826, 10.132255, 0}, - {-0.241814, 0.083797, 10.126269, 0}, - {-0.258574, 0.089783, 10.127466, 0}, - {-0.234632, 0.081403, 10.131058, 0}, - {-0.252588, 0.071826, 10.137043, 0}, - {-0.240617, 0.064643, 10.127466, 0}, - {-0.248997, 0.070629, 10.133451, 0}, - {-0.246603, 0.087388, 10.132255, 0}, - {-0.250194, 0.075417, 10.132255, 0}, - {-0.244208, 0.073023, 10.126269, 0}, - {-0.241814, 0.079009, 10.120284, 0}, - {-0.251391, 0.083797, 10.128663, 0}, - {-0.234632, 0.080206, 10.145423, 0}, - {-0.250194, 0.074220, 10.140635, 0}, - {-0.247800, 0.062249, 10.116693, 0}, - {-0.243011, 0.077812, 10.125072, 0}, - {-0.247800, 0.064643, 10.126269, 0}, - {-0.244208, 0.071826, 10.145423, 0}, - {-0.253785, 0.070629, 10.123875, 0}, - {-0.237026, 0.077812, 10.133451, 0}, - {-0.246603, 0.082600, 10.117889, 0}, - {-0.245406, 0.086191, 10.121481, 0}, - {-0.235829, 0.073023, 10.117889, 0}, - {-0.243011, 0.075417, 10.134649, 0}, - {-0.239420, 0.087388, 10.139438, 0}, - {-0.227449, 0.084994, 10.135846, 0}, - {-0.240617, 0.083797, 10.133451, 0}, - {-0.243011, 0.073023, 10.117889, 0}, - {-0.228646, 0.082600, 10.144226, 0}, - {-0.240617, 0.068235, 10.104721, 0}, - {-0.241814, 0.059855, 10.127466, 0}, - {-0.243011, 0.081403, 10.116693, 0}, - {-0.238223, 0.080206, 10.147817, 0}, - {-0.244208, 0.076614, 10.119086, 0}, - {-0.241814, 0.073023, 10.119086, 0}, - {-0.251391, 0.075417, 10.131058, 0}, - {-0.244208, 0.071826, 10.127466, 0}, - {-0.233435, 0.082600, 10.146620, 0}, - {-0.250194, 0.070629, 10.120284, 0}, - {-0.248997, 0.067038, 10.135846, 0}, - {-0.233435, 0.077812, 10.109509, 0}, - {-0.243011, 0.083797, 10.133451, 0}, - {-0.251391, 0.069432, 10.111904, 0}, - {-0.234632, 0.076614, 10.138240, 0}, - {-0.241814, 0.086191, 10.120284, 0}, - {-0.239420, 0.068235, 10.128663, 0}, - {-0.229843, 0.071826, 10.140635, 0}, - {-0.245406, 0.082600, 10.115496, 0}, - {-0.234632, 0.076614, 10.143028, 0}, - {-0.246603, 0.068235, 10.119086, 0}, - {-0.250194, 0.064643, 10.132255, 0}, - {-0.237026, 0.082600, 10.129861, 0}, - {-0.256179, 0.089783, 10.138240, 0}, - {-0.239420, 0.076614, 10.121481, 0}, - {-0.238223, 0.069432, 10.133451, 0}, - {-0.247800, 0.067038, 10.135846, 0}, - {-0.250194, 0.070629, 10.131058, 0}, - {-0.243011, 0.080206, 10.141831, 0}, - {-0.244208, 0.064643, 10.122678, 0}, - {-0.238223, 0.070629, 10.134649, 0}, - {-0.229843, 0.070629, 10.113101, 0}, - {-0.254982, 0.087388, 10.137043, 0}, - {-0.259771, 0.081403, 10.128663, 0}, - {-0.241814, 0.074220, 10.129861, 0}, - {-0.247800, 0.065841, 10.126269, 0}, - {-0.253785, 0.063446, 10.122678, 0}, - {-0.256179, 0.076614, 10.129861, 0}, - {-0.250194, 0.083797, 10.123875, 0}, - {-0.239420, 0.073023, 10.129861, 0}, - {-0.253785, 0.084994, 10.109509, 0}, - {-0.238223, 0.071826, 10.151408, 0}, - {-0.245406, 0.068235, 10.110707, 0}, - {-0.246603, 0.064643, 10.127466, 0}, - {-0.232237, 0.077812, 10.113101, 0}, - {-0.247800, 0.064643, 10.132255, 0}, - {-0.254982, 0.080206, 10.137043, 0}, - {-0.248997, 0.080206, 10.138240, 0}, - {-0.243011, 0.081403, 10.123875, 0}, - {-0.237026, 0.087388, 10.127466, 0}, - {-0.234632, 0.070629, 10.129861, 0}, - {-0.235829, 0.073023, 10.121481, 0}, - {-0.244208, 0.073023, 10.127466, 0}, - {-0.237026, 0.067038, 10.138240, 0}, - {-0.248997, 0.067038, 10.119086, 0}, - {-0.253785, 0.079009, 10.129861, 0}, - {-0.239420, 0.068235, 10.129861, 0}, - {-0.252588, 0.071826, 10.122678, 0}, - {-0.243011, 0.076614, 10.134649, 0}, - {-0.234632, 0.075417, 10.117889, 0}, - {-0.235829, 0.070629, 10.115496, 0}, - {-0.247800, 0.083797, 10.123875, 0}, - {-0.241814, 0.089783, 10.123875, 0}, - {-0.234632, 0.087388, 10.133451, 0}, - {-0.239420, 0.073023, 10.116693, 0}, - {-0.241814, 0.087388, 10.122678, 0}, - {-0.243011, 0.077812, 10.126269, 0}, - {-0.247800, 0.076614, 10.129861, 0}, - {-0.244208, 0.082600, 10.140635, 0}, - {-0.241814, 0.079009, 10.150211, 0}, - {-0.237026, 0.065841, 10.144226, 0}, - {-0.234632, 0.081403, 10.133451, 0}, - {-0.231040, 0.081403, 10.121481, 0}, - {-0.248997, 0.071826, 10.143028, 0}, - {-0.257377, 0.063446, 10.119086, 0}, - {-0.245406, 0.087388, 10.141831, 0}, - {-0.246603, 0.082600, 10.137043, 0}, - {-0.227449, 0.080206, 10.128663, 0}, - {-0.244208, 0.082600, 10.120284, 0}, - {-0.245406, 0.087388, 10.139438, 0}, - {-0.237026, 0.061052, 10.137043, 0}, - {-0.240617, 0.061052, 10.132255, 0}, - {-0.239420, 0.076614, 10.132255, 0}, - {-0.244208, 0.083797, 10.131058, 0}, - {-0.227449, 0.077812, 10.137043, 0}, - {-0.240617, 0.089783, 10.144226, 0}, - {-0.238223, 0.083797, 10.121481, 0}, - {-0.260968, 0.068235, 10.119086, 0}, - {-0.243011, 0.070629, 10.155000, 0}, - {-0.248997, 0.079009, 10.117889, 0}, - {-0.252588, 0.076614, 10.111904, 0}, - {-0.237026, 0.084994, 10.134649, 0}, - {-0.248997, 0.069432, 10.128663, 0}, - {-0.235829, 0.082600, 10.126269, 0}, - {-0.245406, 0.069432, 10.150211, 0}, - {-0.253785, 0.090980, 10.125072, 0}, - {-0.247800, 0.077812, 10.119086, 0}, - {-0.248997, 0.074220, 10.117889, 0}, - {-0.239420, 0.080206, 10.122678, 0}, - {-0.239420, 0.087388, 10.127466, 0}, - {-0.244208, 0.074220, 10.128663, 0}, - {-0.229843, 0.068235, 10.123875, 0}, - {-0.247800, 0.080206, 10.127466, 0}, - {-0.241814, 0.071826, 10.119086, 0}, - {-0.235829, 0.086191, 10.121481, 0}, - {-0.234632, 0.084994, 10.127466, 0}, - {-0.237026, 0.073023, 10.131058, 0}, - {-0.243011, 0.074220, 10.123875, 0}, - {-0.259771, 0.084994, 10.146620, 0}, - {-0.241814, 0.071826, 10.122678, 0}, - {-0.232237, 0.077812, 10.132255, 0}, - {-0.239420, 0.076614, 10.133451, 0}, - {-0.244208, 0.076614, 10.128663, 0}, - {-0.241814, 0.081403, 10.153803, 0}, - {-0.246603, 0.069432, 10.114298, 0}, - {-0.247800, 0.067038, 10.128663, 0}, - {-0.239420, 0.077812, 10.132255, 0}, - {-0.248997, 0.064643, 10.133451, 0}, - {-0.231040, 0.075417, 10.120284, 0}, - {-0.235829, 0.070629, 10.109509, 0}, - {-0.248997, 0.079009, 10.121481, 0}, - {-0.239420, 0.094571, 10.128663, 0}, - {-0.254982, 0.083797, 10.134649, 0}, - {-0.240617, 0.079009, 10.117889, 0}, - {-0.244208, 0.065841, 10.122678, 0}, - {-0.238223, 0.070629, 10.116693, 0}, - {-0.244208, 0.081403, 10.131058, 0}, - {-0.239420, 0.071826, 10.135846, 0}, - {-0.231040, 0.070629, 10.139438, 0}, - {-0.240617, 0.070629, 10.125072, 0}, - {-0.235829, 0.079009, 10.127466, 0}, - {-0.235829, 0.077812, 10.126269, 0}, - {-0.241814, 0.071826, 10.127466, 0}, - {-0.243011, 0.068235, 10.131058, 0}, - {-0.240617, 0.076614, 10.129861, 0}, - {-0.231040, 0.070629, 10.127466, 0}, - {-0.229843, 0.076614, 10.129861, 0}, - {-0.235829, 0.071826, 10.128663, 0}, - {-0.235829, 0.068235, 10.131058, 0}, - {-0.246603, 0.074220, 10.122678, 0}, - {-0.232237, 0.075417, 10.126269, 0}, - {-0.233435, 0.075417, 10.116693, 0}, - {-0.227449, 0.069432, 10.131058, 0}, - {-0.233435, 0.069432, 10.133451, 0}, - {-0.243011, 0.076614, 10.125072, 0}, - {-0.243011, 0.079009, 10.111904, 0}, - {-0.245406, 0.080206, 10.137043, 0}, - {-0.244208, 0.083797, 10.133451, 0}, - {-0.247800, 0.071826, 10.131058, 0}, - {-0.239420, 0.063446, 10.114298, 0}, - {-0.234632, 0.070629, 10.119086, 0}, - {-0.238223, 0.070629, 10.151408, 0}, - {-0.247800, 0.075417, 10.134649, 0}, - {-0.241814, 0.075417, 10.137043, 0}, - {-0.240617, 0.067038, 10.121481, 0}, - {-0.243011, 0.063446, 10.137043, 0}, - {-0.229843, 0.068235, 10.132255, 0}, - {-0.241814, 0.075417, 10.122678, 0}, - {-0.246603, 0.086191, 10.119086, 0}, - {-0.235829, 0.081403, 10.126269, 0}, - {-0.229843, 0.081403, 10.138240, 0}, - {-0.234632, 0.075417, 10.120284, 0}, - {-0.237026, 0.080206, 10.133451, 0}, - {-0.232237, 0.074220, 10.114298, 0}, - {-0.245406, 0.069432, 10.128663, 0}, - {-0.241814, 0.064643, 10.134649, 0}, - {-0.239420, 0.086191, 10.133451, 0}, - {-0.238223, 0.086191, 10.144226, 0}, - {-0.248997, 0.063446, 10.131058, 0}, - {-0.229843, 0.065841, 10.137043, 0}, - {-0.239420, 0.084994, 10.110707, 0}, - {-0.231040, 0.083797, 10.141831, 0}, - {-0.245406, 0.073023, 10.128663, 0}, - {-0.245406, 0.071826, 10.129861, 0}, - {-0.238223, 0.071826, 10.120284, 0}, - {-0.247800, 0.081403, 10.137043, 0}, - {-0.264559, 0.069432, 10.135846, 0}, - {-0.247800, 0.070629, 10.131058, 0}, - {-0.240617, 0.082600, 10.134649, 0}, - {-0.246603, 0.075417, 10.126269, 0}, - {-0.238223, 0.071826, 10.152605, 0}, - {-0.235829, 0.063446, 10.132255, 0}, - {-0.251391, 0.065841, 10.120284, 0}, - {-0.243011, 0.068235, 10.131058, 0}, - {-0.222661, 0.067038, 10.134649, 0}, - {-0.239420, 0.081403, 10.128663, 0}, - {-0.240617, 0.083797, 10.138240, 0}, - {-0.223858, 0.068235, 10.122678, 0}, - {-0.238223, 0.065841, 10.140635, 0}, - {-0.237026, 0.081403, 10.134649, 0}, - {-0.240617, 0.079009, 10.123875, 0}, - {-0.238223, 0.073023, 10.133451, 0}, - {-0.246603, 0.067038, 10.117889, 0}, - {-0.243011, 0.061052, 10.135846, 0}, - {-0.239420, 0.075417, 10.116693, 0}, - {-0.260968, 0.065841, 10.123875, 0}, - {-0.247800, 0.064643, 10.117889, 0}, - {-0.248997, 0.093374, 10.140635, 0}, - {-0.244208, 0.080206, 10.144226, 0}, - {-0.258574, 0.077812, 10.113101, 0}, - {-0.250194, 0.069432, 10.126269, 0}, - {-0.238223, 0.073023, 10.102327, 0}, - {-0.240617, 0.070629, 10.135846, 0}, - {-0.247800, 0.063446, 10.121481, 0}, - {-0.268150, 0.088585, 10.135846, 0}, - {-0.246603, 0.075417, 10.119086, 0}, - {-0.233435, 0.071826, 10.131058, 0}, - {-0.245406, 0.071826, 10.128663, 0}, - {-0.244208, 0.094571, 10.128663, 0}, - {-0.234632, 0.080206, 10.123875, 0}, - {-0.240617, 0.081403, 10.109509, 0}, - {-0.240617, 0.069432, 10.128663, 0}, - {-0.237026, 0.069432, 10.122678, 0}, - {-0.234632, 0.071826, 10.137043, 0}, - {-0.239420, 0.076614, 10.139438, 0}, - {-0.244208, 0.088585, 10.117889, 0}, - {-0.259771, 0.087388, 10.134649, 0}, - {-0.252588, 0.077812, 10.134649, 0}, - {-0.241814, 0.073023, 10.117889, 0}, - {-0.243011, 0.080206, 10.128663, 0}, - {-0.241814, 0.086191, 10.119086, 0}, - {-0.244208, 0.073023, 10.115496, 0}, - {-0.239420, 0.080206, 10.123875, 0}, - {-0.248997, 0.070629, 10.137043, 0}, - {-0.240617, 0.076614, 10.119086, 0}, - {-0.233435, 0.070629, 10.128663, 0}, - {-0.235829, 0.075417, 10.121481, 0}, - {-0.240617, 0.090980, 10.127466, 0}, - {-0.252588, 0.067038, 10.114298, 0}, - {-0.229843, 0.077812, 10.123875, 0}, - {-0.248997, 0.084994, 10.137043, 0}, - {-0.245406, 0.070629, 10.110707, 0}, - {-0.239420, 0.061052, 10.131058, 0}, - {-0.241814, 0.077812, 10.132255, 0}, - {-0.239420, 0.081403, 10.126269, 0}, - {-0.235829, 0.069432, 10.127466, 0}, - {-0.243011, 0.076614, 10.134649, 0}, - {-0.252588, 0.077812, 10.132255, 0}, - {-0.237026, 0.077812, 10.138240, 0}, - {-0.246603, 0.073023, 10.127466, 0}, - {-0.241814, 0.063446, 10.129861, 0}, - {-0.234632, 0.071826, 10.126269, 0}, - {-0.248997, 0.081403, 10.113101, 0}, - {-0.244208, 0.084994, 10.114298, 0}, - {-0.232237, 0.077812, 10.132255, 0}, - {-0.234632, 0.084994, 10.128663, 0}, - {-0.244208, 0.088585, 10.108313, 0}, - {-0.253785, 0.070629, 10.141831, 0}, - {-0.247800, 0.071826, 10.121481, 0}, - {-0.244208, 0.070629, 10.128663, 0}, - {-0.244208, 0.079009, 10.116693, 0}, - {-0.239420, 0.074220, 10.113101, 0}, - {-0.239420, 0.079009, 10.127466, 0}, - {-0.251391, 0.071826, 10.133451, 0}, - {-0.247800, 0.076614, 10.133451, 0}, - {-0.254982, 0.088585, 10.137043, 0}, - {-0.250194, 0.081403, 10.137043, 0}, - {-0.257377, 0.077812, 10.117889, 0}, - {-0.237026, 0.079009, 10.123875, 0}, - {-0.235829, 0.073023, 10.121481, 0}, - {-0.262165, 0.082600, 10.123875, 0}, - {-0.248997, 0.073023, 10.113101, 0}, - {-0.241814, 0.076614, 10.114298, 0}, - {-0.251391, 0.073023, 10.131058, 0}, - {-0.248997, 0.075417, 10.141831, 0}, - {-0.237026, 0.074220, 10.132255, 0}, - {-0.253785, 0.084994, 10.122678, 0}, - {-0.247800, 0.079009, 10.133451, 0}, - {-0.246603, 0.082600, 10.109509, 0}, - {-0.252588, 0.094571, 10.122678, 0}, - {-0.246603, 0.073023, 10.125072, 0}, - {-0.250194, 0.057461, 10.115496, 0}, - {-0.250194, 0.071826, 10.122678, 0}, - {-0.251391, 0.076614, 10.127466, 0}, - {-0.240617, 0.079009, 10.126269, 0}, - {-0.259771, 0.073023, 10.115496, 0}, - {-0.246603, 0.074220, 10.135846, 0}, - {-0.253785, 0.077812, 10.119086, 0}, - {-0.244208, 0.077812, 10.128663, 0}, - {-0.241814, 0.069432, 10.128663, 0}, - {-0.244208, 0.081403, 10.126269, 0}, - {-0.246603, 0.086191, 10.128663, 0}, - {-0.252588, 0.084994, 10.132255, 0}, - {-0.247800, 0.076614, 10.128663, 0}, - {-0.240617, 0.063446, 10.126269, 0}, - {-0.235829, 0.069432, 10.127466, 0}, - {-0.240617, 0.087388, 10.129861, 0}, - {-0.251391, 0.063446, 10.128663, 0}, - {-0.252588, 0.077812, 10.135846, 0}, - {-0.254982, 0.082600, 10.138240, 0}, - {-0.244208, 0.081403, 10.128663, 0}, - {-0.241814, 0.086191, 10.117889, 0}, - {-0.254982, 0.069432, 10.149014, 0}, - {-0.248997, 0.068235, 10.131058, 0}, - {-0.252588, 0.063446, 10.122678, 0}, - {-0.240617, 0.079009, 10.152605, 0}, - {-0.240617, 0.088585, 10.107116, 0}, - {-0.248997, 0.076614, 10.138240, 0}, - {-0.251391, 0.075417, 10.119086, 0}, - {-0.225055, 0.079009, 10.138240, 0}, - {-0.239420, 0.077812, 10.150211, 0}, - {-0.250194, 0.055067, 10.137043, 0}, - {-0.257377, 0.082600, 10.125072, 0}, - {-0.243011, 0.075417, 10.119086, 0}, - {-0.244208, 0.064643, 10.119086, 0}, - {-0.246603, 0.080206, 10.117889, 0}, - {-0.232237, 0.079009, 10.158591, 0}, - {-0.247800, 0.071826, 10.120284, 0}, - {-0.245406, 0.075417, 10.137043, 0}, - {-0.240617, 0.069432, 10.117889, 0}, - {-0.246603, 0.080206, 10.134649, 0}, - {-0.248997, 0.087388, 10.109509, 0}, - {-0.252588, 0.081403, 10.132255, 0}, - {-0.250194, 0.069432, 10.123875, 0}, - {-0.257377, 0.073023, 10.131058, 0}, - {-0.241814, 0.068235, 10.109509, 0}, - {-0.243011, 0.080206, 10.108313, 0}, - {-0.238223, 0.074220, 10.139438, 0}, - {-0.245406, 0.075417, 10.122678, 0}, - {-0.250194, 0.069432, 10.137043, 0}, - {-0.245406, 0.069432, 10.116693, 0}, - {-0.235829, 0.070629, 10.158591, 0}, - {-0.247800, 0.082600, 10.117889, 0}, - {-0.247800, 0.077812, 10.137043, 0}, - {-0.243011, 0.080206, 10.134649, 0}, - {-0.263362, 0.081403, 10.110707, 0}, - {-0.247800, 0.079009, 10.127466, 0}, - {-0.248997, 0.071826, 10.131058, 0}, - {-0.248997, 0.075417, 10.144226, 0}, - {-0.239420, 0.077812, 10.117889, 0}, - {-0.248997, 0.071826, 10.139438, 0}, - {-0.254982, 0.083797, 10.120284, 0}, - {-0.238223, 0.075417, 10.131058, 0}, - {-0.235829, 0.084994, 10.105919, 0}, - {-0.245406, 0.080206, 10.133451, 0}, - {-0.247800, 0.075417, 10.131058, 0}, - {-0.235829, 0.079009, 10.120284, 0}, - {-0.247800, 0.070629, 10.133451, 0}, - {-0.253785, 0.064643, 10.110707, 0}, - {-0.240617, 0.071826, 10.120284, 0}, - {-0.248997, 0.079009, 10.101130, 0}, - {-0.243011, 0.079009, 10.141831, 0}, - {-0.244208, 0.077812, 10.134649, 0}, - {-0.245406, 0.081403, 10.140635, 0}, - {-0.253785, 0.070629, 10.110707, 0}, - {-0.254982, 0.058658, 10.129861, 0}, - {-0.239420, 0.083797, 10.137043, 0}, - {-0.232237, 0.081403, 10.125072, 0}, - {-0.243011, 0.068235, 10.139438, 0}, - {-0.243011, 0.063446, 10.123875, 0}, - {-0.232237, 0.074220, 10.140635, 0}, - {-0.241814, 0.077812, 10.116693, 0}, - {-0.247800, 0.074220, 10.139438, 0}, - {-0.245406, 0.077812, 10.127466, 0}, - {-0.233435, 0.073023, 10.132255, 0}, - {-0.243011, 0.074220, 10.121481, 0}, - {-0.246603, 0.059855, 10.125072, 0}, - {-0.246603, 0.070629, 10.120284, 0}, - {-0.241814, 0.087388, 10.133451, 0}, - {-0.245406, 0.061052, 10.128663, 0}, - {-0.248997, 0.079009, 10.111904, 0}, - {-0.237026, 0.077812, 10.135846, 0}, - {-0.240617, 0.083797, 10.108313, 0}, - {-0.237026, 0.075417, 10.141831, 0}, - {-0.243011, 0.061052, 10.132255, 0}, - {-0.234632, 0.073023, 10.133451, 0}, - {-0.251391, 0.073023, 10.137043, 0}, - {-0.237026, 0.083797, 10.135846, 0}, - {-0.231040, 0.077812, 10.117889, 0}, - {-0.237026, 0.061052, 10.140635, 0}, - {-0.243011, 0.071826, 10.127466, 0}, - {-0.235829, 0.081403, 10.131058, 0}, - {-0.241814, 0.076614, 10.123875, 0}, - {-0.258574, 0.081403, 10.127466, 0}, - {-0.241814, 0.063446, 10.127466, 0}, - {-0.254982, 0.071826, 10.139438, 0}, - {-0.244208, 0.077812, 10.117889, 0}, - {-0.240617, 0.077812, 10.134649, 0}, - {-0.258574, 0.075417, 10.128663, 0}, - {-0.245406, 0.069432, 10.131058, 0}, - {-0.245406, 0.074220, 10.126269, 0}, - {-0.248997, 0.075417, 10.137043, 0}, - {-0.248997, 0.082600, 10.137043, 0}, - {-0.245406, 0.084994, 10.115496, 0}, - {-0.244208, 0.073023, 10.126269, 0}, - {-0.234632, 0.067038, 10.126269, 0}, - {-0.238223, 0.064643, 10.127466, 0}, - {-0.263362, 0.065841, 10.123875, 0}, - {-0.257377, 0.081403, 10.126269, 0}, - {-0.237026, 0.082600, 10.105919, 0}, - {-0.253785, 0.083797, 10.119086, 0}, - {-0.234632, 0.073023, 10.125072, 0}, - {-0.243011, 0.062249, 10.122678, 0}, - {-0.251391, 0.076614, 10.119086, 0}, - {-0.258574, 0.071826, 10.139438, 0}, - {-0.250194, 0.071826, 10.140635, 0}, - {-0.251391, 0.086191, 10.140635, 0}, - {-0.248997, 0.077812, 10.121481, 0}, - {-0.244208, 0.083797, 10.126269, 0}, - {-0.241814, 0.083797, 10.133451, 0}, - {-0.246603, 0.070629, 10.119086, 0}, - {-0.241814, 0.067038, 10.146620, 0}, - {-0.247800, 0.079009, 10.109509, 0}, - {-0.256179, 0.069432, 10.146620, 0}, - {-0.247800, 0.073023, 10.126269, 0}, - {-0.245406, 0.070629, 10.113101, 0}, - {-0.234632, 0.084994, 10.126269, 0}, - {-0.228646, 0.068235, 10.129861, 0}, - {-0.246603, 0.062249, 10.143028, 0}, - {-0.245406, 0.084994, 10.122678, 0}, - {-0.244208, 0.067038, 10.143028, 0}, - {-0.241814, 0.080206, 10.138240, 0}, - {-0.243011, 0.083797, 10.135846, 0}, - {-0.238223, 0.069432, 10.139438, 0}, - {-0.235829, 0.081403, 10.121481, 0}, - {-0.241814, 0.081403, 10.119086, 0}, - {-0.241814, 0.068235, 10.146620, 0}, - {-0.246603, 0.093374, 10.107116, 0}, - {-0.247800, 0.088585, 10.135846, 0}, - {-0.258574, 0.069432, 10.101130, 0}, - {-0.252588, 0.074220, 10.135846, 0}, - {-0.240617, 0.058658, 10.127466, 0}, - {-0.263362, 0.073023, 10.138240, 0}, - {-0.244208, 0.081403, 10.135846, 0}, - {-0.248997, 0.086191, 10.127466, 0}, - {-0.251391, 0.074220, 10.133451, 0}, - {-0.241814, 0.068235, 10.129861, 0}, - {-0.247800, 0.075417, 10.144226, 0}, - {-0.248997, 0.086191, 10.113101, 0}, - {-0.239420, 0.080206, 10.153803, 0}, - {-0.239420, 0.059855, 10.117889, 0}, - {-0.244208, 0.073023, 10.139438, 0}, - {-0.245406, 0.082600, 10.120284, 0}, - {-0.238223, 0.086191, 10.133451, 0}, - {-0.246603, 0.079009, 10.123875, 0}, - {-0.247800, 0.074220, 10.131058, 0}, - {-0.252588, 0.084994, 10.120284, 0}, - {-0.245406, 0.075417, 10.125072, 0}, - {-0.240617, 0.069432, 10.135846, 0}, - {-0.245406, 0.076614, 10.121481, 0}, - {-0.231040, 0.068235, 10.132255, 0}, - {-0.233435, 0.076614, 10.134649, 0}, - {-0.239420, 0.082600, 10.127466, 0}, - {-0.253785, 0.076614, 10.104721, 0}, - {-0.247800, 0.089783, 10.133451, 0}, - {-0.238223, 0.076614, 10.134649, 0}, - {-0.240617, 0.073023, 10.105919, 0}, - {-0.243011, 0.067038, 10.146620, 0}, - {-0.246603, 0.067038, 10.135846, 0}, - {-0.250194, 0.080206, 10.146620, 0}, - {-0.252588, 0.062249, 10.125072, 0}, - {-0.234632, 0.074220, 10.127466, 0}, - {-0.239420, 0.069432, 10.149014, 0}, - {-0.243011, 0.069432, 10.126269, 0}, - {-0.240617, 0.071826, 10.109509, 0}, - {-0.258574, 0.067038, 10.121481, 0}, - {-0.258574, 0.079009, 10.137043, 0}, - {-0.248997, 0.083797, 10.114298, 0}, - {-0.228646, 0.077812, 10.123875, 0}, - {-0.248997, 0.061052, 10.128663, 0}, - {-0.253785, 0.080206, 10.140635, 0}, - {-0.250194, 0.077812, 10.119086, 0}, - {-0.250194, 0.080206, 10.134649, 0}, - {-0.254982, 0.079009, 10.104721, 0}, - {-0.251391, 0.076614, 10.125072, 0}, - {-0.244208, 0.069432, 10.109509, 0}, - {-0.251391, 0.075417, 10.131058, 0}, - {-0.246603, 0.074220, 10.135846, 0}, - {-0.247800, 0.077812, 10.133451, 0}, - {-0.243011, 0.095768, 10.119086, 0}, - {-0.252588, 0.079009, 10.103524, 0}, - {-0.248997, 0.080206, 10.119086, 0}, - {-0.250194, 0.087388, 10.122678, 0}, - {-0.244208, 0.071826, 10.143028, 0}, - {-0.228646, 0.079009, 10.104721, 0}, - {-0.235829, 0.087388, 10.125072, 0}, - {-0.241814, 0.070629, 10.105919, 0}, - {-0.251391, 0.081403, 10.140635, 0}, - {-0.235829, 0.074220, 10.117889, 0}, - {-0.244208, 0.076614, 10.134649, 0}, - {-0.248997, 0.074220, 10.108313, 0}, - {-0.240617, 0.089783, 10.123875, 0}, - {-0.254982, 0.074220, 10.146620, 0}, - {-0.252588, 0.079009, 10.120284, 0}, - {-0.246603, 0.087388, 10.133451, 0}, - {-0.246603, 0.074220, 10.116693, 0}, - {-0.235829, 0.074220, 10.138240, 0}, - {-0.239420, 0.076614, 10.111904, 0}, - {-0.253785, 0.065841, 10.132255, 0}, - {-0.246603, 0.074220, 10.117889, 0}, - {-0.251391, 0.084994, 10.121481, 0}, - {-0.260968, 0.087388, 10.131058, 0}, - {-0.246603, 0.084994, 10.123875, 0}, - {-0.247800, 0.087388, 10.119086, 0}, - {-0.238223, 0.070629, 10.125072, 0}, - {-0.248997, 0.075417, 10.137043, 0}, - {-0.240617, 0.081403, 10.126269, 0}, - {-0.225055, 0.075417, 10.117889, 0}, - {-0.245406, 0.061052, 10.099933, 0}, - {-0.229843, 0.071826, 10.133451, 0}, - {-0.239420, 0.088585, 10.158591, 0}, - {-0.251391, 0.079009, 10.111904, 0}, - {-0.234632, 0.070629, 10.151408, 0}, - {-0.232237, 0.068235, 10.127466, 0}, - {-0.238223, 0.083797, 10.125072, 0}, - {-0.240617, 0.083797, 10.104721, 0}, - {-0.234632, 0.084994, 10.127466, 0}, - {-0.243011, 0.068235, 10.098736, 0}, - {-0.251391, 0.075417, 10.146620, 0}, - {-0.257377, 0.082600, 10.117889, 0}, - {-0.234632, 0.076614, 10.119086, 0}, - {-0.244208, 0.080206, 10.132255, 0}, - {-0.232237, 0.080206, 10.139438, 0}, - {-0.235829, 0.083797, 10.134649, 0}, - {-0.240617, 0.083797, 10.107116, 0}, - {-0.239420, 0.087388, 10.134649, 0}, - {-0.248997, 0.074220, 10.125072, 0}, - {-0.247800, 0.064643, 10.150211, 0}, - {-0.243011, 0.076614, 10.111904, 0}, - {-0.247800, 0.069432, 10.139438, 0}, - {-0.240617, 0.076614, 10.132255, 0}, - {-0.240617, 0.076614, 10.129861, 0}, - {-0.235829, 0.065841, 10.105919, 0}, - {-0.252588, 0.080206, 10.113101, 0}, - {-0.251391, 0.077812, 10.149014, 0}, - {-0.241814, 0.082600, 10.056837, 0}, - {-0.243011, 0.084994, 10.199292, 0}, - {-0.253785, 0.077812, 10.098736, 0}, - {-0.229843, 0.063446, 10.103524, 0}, - {-0.250194, 0.069432, 10.183730, 0}, - {-0.240617, 0.086191, 10.067612, 0}, - {-0.246603, 0.070629, 10.201687, 0}, - {-0.263362, 0.067038, 10.071202, 0}, - {-0.245406, 0.059855, 10.166970, 0}, - {-0.239420, 0.065841, 10.092751, 0}, - {-0.238223, 0.068235, 10.139438, 0}, - {-0.243011, 0.074220, 10.116693, 0}, - {-0.240617, 0.081403, 10.122678, 0}, - {-0.251391, 0.067038, 10.119086, 0}, - {-0.240617, 0.075417, 10.113101, 0}, - {-0.250194, 0.059855, 10.137043, 0}, - {-0.244208, 0.062249, 10.129861, 0}, - {-0.229843, 0.083797, 10.117889, 0}, - {-0.246603, 0.076614, 10.123875, 0}, - {-0.234632, 0.087388, 10.140635, 0}, - {-0.254982, 0.079009, 10.119086, 0}, - {-0.237026, 0.074220, 10.157393, 0}, - {-0.247800, 0.088585, 10.115496, 0}, - {-0.251391, 0.087388, 10.144226, 0}, - {-0.238223, 0.071826, 10.116693, 0}, - {-0.233435, 0.069432, 10.137043, 0}, - {-0.231040, 0.081403, 10.119086, 0}, - {-0.244208, 0.079009, 10.116693, 0}, - {-0.245406, 0.073023, 10.147817, 0}, - {-0.250194, 0.071826, 10.113101, 0}, - {-0.238223, 0.077812, 10.135846, 0}, - {-0.240617, 0.077812, 10.105919, 0}, - {-0.239420, 0.076614, 10.145423, 0}, - {-0.232237, 0.070629, 10.102327, 0}, - {-0.241814, 0.080206, 10.119086, 0}, - {-0.237026, 0.068235, 10.111904, 0}, - {-0.260968, 0.082600, 10.137043, 0}, - {-0.240617, 0.089783, 10.139438, 0}, - {-0.238223, 0.077812, 10.128663, 0}, - {-0.240617, 0.075417, 10.138240, 0}, - {-0.247800, 0.075417, 10.129861, 0}, - {-0.251391, 0.075417, 10.143028, 0}, - {-0.254982, 0.076614, 10.128663, 0}, - {-0.251391, 0.070629, 10.157393, 0}, - {-0.253785, 0.086191, 10.134649, 0}, - {-0.248997, 0.079009, 10.126269, 0}, - {-0.244208, 0.087388, 10.117889, 0}, - {-0.254982, 0.080206, 10.125072, 0}, - {-0.244208, 0.071826, 10.122678, 0}, - {-0.248997, 0.087388, 10.111904, 0}, - {-0.246603, 0.075417, 10.133451, 0}, - {-0.252588, 0.071826, 10.099933, 0}, - {-0.245406, 0.082600, 10.132255, 0}, - {-0.246603, 0.086191, 10.129861, 0}, - {-0.227449, 0.067038, 10.151408, 0}, - {-0.235829, 0.079009, 10.109509, 0}, - {-0.239420, 0.080206, 10.137043, 0}, - {-0.241814, 0.084994, 10.121481, 0}, - {-0.251391, 0.081403, 10.116693, 0}, - {-0.260968, 0.073023, 10.141831, 0}, - {-0.245406, 0.073023, 10.122678, 0}, - {-0.252588, 0.083797, 10.139438, 0}, - {-0.243011, 0.080206, 10.122678, 0}, - {-0.239420, 0.077812, 10.138240, 0}, - {-0.241814, 0.068235, 10.113101, 0}, - {-0.244208, 0.074220, 10.133451, 0}, - {-0.257377, 0.079009, 10.128663, 0}, - {-0.253785, 0.074220, 10.125072, 0}, - {-0.238223, 0.062249, 10.132255, 0}, - {-0.243011, 0.068235, 10.119086, 0}, - {-0.240617, 0.074220, 10.132255, 0}, - {-0.272939, 0.076614, 10.116693, 0}, - {-0.234632, 0.075417, 10.138240, 0}, - {-0.241814, 0.073023, 10.085567, 0}, - {-0.246603, 0.075417, 10.163380, 0}, - {-0.248997, 0.058658, 10.093947, 0}, - {-0.243011, 0.070629, 10.146620, 0}, - {-0.238223, 0.074220, 10.110707, 0}, - {-0.252588, 0.065841, 10.141831, 0}, - {-0.229843, 0.074220, 10.137043, 0}, - {-0.248997, 0.076614, 10.099933, 0}, - {-0.229843, 0.081403, 10.157393, 0}, - {-0.243011, 0.082600, 10.074794, 0}, - {-0.250194, 0.071826, 10.164577, 0}, - {-0.263362, 0.076614, 10.103524, 0}, - {-0.260968, 0.094571, 10.138240, 0}, - {-0.240617, 0.077812, 10.116693, 0}, - {-0.239420, 0.081403, 10.109509, 0}, - {-0.253785, 0.086191, 10.135846, 0}, - {-0.247800, 0.076614, 10.093947, 0}, - {-0.256179, 0.068235, 10.158591, 0}, - {-0.253785, 0.079009, 10.090356, 0}, - {-0.239420, 0.076614, 10.151408, 0}, - {-0.244208, 0.082600, 10.115496, 0}, - {-0.244208, 0.081403, 10.134649, 0}, - {-0.254982, 0.088585, 10.122678, 0}, - {-0.252588, 0.069432, 10.120284, 0}, - {-0.247800, 0.077812, 10.137043, 0}, - {-0.250194, 0.076614, 10.117889, 0}, - {-0.238223, 0.077812, 10.121481, 0}, - {-0.245406, 0.065841, 10.186124, 0}, - {-0.233435, 0.065841, 10.046063, 0}, - {-0.237026, 0.094571, 10.243585, 0}, - {-0.231040, 0.093374, 10.014939, 0}, - {-0.243011, 0.084994, 10.223234, 0}, - {-0.256179, 0.064643, 9.987406, 0}, - {-0.250194, 0.098162, 10.247176, 0}, - {-0.229843, 0.073023, 9.891638, 0}, - {-0.268150, 0.062249, 10.406390, 0}, - {-0.247800, 0.073023, 9.883258, 0}, - {-0.237026, 0.076614, 10.360901, 0}, - {-0.247800, 0.081403, 9.975434, 0}, - {-0.225055, 0.080206, 10.178942, 0}, - {-0.263362, 0.071826, 10.163380, 0}, - {-0.237026, 0.076614, 10.062823, 0}, - {-0.265756, 0.075417, 10.214854, 0}, - {-0.234632, 0.083797, 10.053246, 0}, - {-0.254982, 0.071826, 10.210066, 0}, - {-0.241814, 0.076614, 10.001771, 0}, - {-0.221464, 0.117316, 10.239994, 0}, - {-0.269348, 0.076614, 10.064020, 0}, - {-0.220266, 0.092177, 10.166970, 0}, - {-0.252588, 0.075417, 10.111904, 0}, - {-0.232237, 0.068235, 10.122678, 0}, - {-0.259771, 0.075417, 10.110707, 0}, - {-0.246603, 0.095768, 10.137043, 0}, - {-0.235829, 0.076614, 10.138240, 0}, - {-0.256179, 0.071826, 10.102327, 0}, - {-0.229843, 0.089783, 10.175350, 0}, - {-0.260968, 0.082600, 10.089159, 0}, - {-0.225055, 0.086191, 10.169365, 0}, - {-0.262165, 0.087388, 10.103524, 0}, - {-0.234632, 0.077812, 10.149014, 0}, - {-0.241814, 0.070629, 10.079582, 0}, - {-0.256179, 0.077812, 10.163380, 0}, - {-0.226252, 0.068235, 10.096342, 0}, - {-0.253785, 0.080206, 10.117889, 0}, - {-0.244208, 0.077812, 10.163380, 0}, - {-0.269348, 0.076614, 10.097539, 0}, - {-0.238223, 0.069432, 10.169365, 0}, - {-0.254982, 0.068235, 10.096342, 0}, - {-0.231040, 0.061052, 10.159788, 0}, - {-0.248997, 0.075417, 10.079582, 0}, - {-0.258574, 0.071826, 10.162182, 0}, - {-0.232237, 0.079009, 10.102327, 0}, - {-0.256179, 0.100556, 10.138240, 0}, - {-0.232237, 0.084994, 10.116693, 0}, - {-0.235829, 0.080206, 10.110707, 0}, - {-0.225055, 0.065841, 10.129861, 0}, - {-0.217872, 0.082600, 10.090356, 0}, - {-0.244208, 0.081403, 10.157393, 0}, -}; - -const size_t kBodyDetectOnOffTestDataLength = - ARRAY_SIZE(kBodyDetectOnOffTestData); diff --git a/test/body_detection_test_data.h b/test/body_detection_test_data.h deleted file mode 100644 index 4c22c3236f..0000000000 --- a/test/body_detection_test_data.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright 2020 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. - */ - -#ifndef __CROS_EC_BODY_DETECTION_TEST_DATA_H -#define __CROS_EC_BODY_DETECTION_TEST_DATA_H - -#include "body_detection.h" -#include "motion_sense.h" - -struct body_detect_test_data { - float x, y, z; - int action; -}; - -extern const struct body_detect_test_data kBodyDetectOnBodyTestData[]; -extern const size_t kBodyDetectOnBodyTestDataLength; - -extern const struct body_detect_test_data kBodyDetectOffOnTestData[]; -extern const size_t kBodyDetectOffOnTestDataLength; - -extern const struct body_detect_test_data kBodyDetectOnOffTestData[]; -extern const size_t kBodyDetectOnOffTestDataLength; -#endif diff --git a/test/build.mk b/test/build.mk deleted file mode 100644 index 61865009f6..0000000000 --- a/test/build.mk +++ /dev/null @@ -1,262 +0,0 @@ -# -*- makefile -*- -# Copyright 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. - -# Device test binaries -test-list-y ?= flash_write_protect pingpong timer_calib timer_dos timer_jump mutex utils utils_str -#disable: powerdemo - -# Emulator tests -ifneq ($(TEST_LIST_HOST),) -test-list-host=$(TEST_LIST_HOST) -else -test-list-host = accel_cal -test-list-host += aes -test-list-host += base32 -test-list-host += battery_get_params_smart -test-list-host += bklight_lid -test-list-host += bklight_passthru -test-list-host += body_detection -test-list-host += button -test-list-host += cbi -test-list-host += cbi_wp -test-list-host += cec -test-list-host += charge_manager -test-list-host += charge_manager_drp_charging -test-list-host += charge_ramp -test-list-host += compile_time_macros -test-list-host += console_edit -test-list-host += crc -test-list-host += entropy -test-list-host += extpwr_gpio -test-list-host += fan -test-list-host += flash -test-list-host += float -test-list-host += fp -test-list-host += fpsensor -test-list-host += fpsensor_crypto -test-list-host += fpsensor_state -test-list-host += gyro_cal -test-list-host += hooks -test-list-host += host_command -test-list-host += i2c_bitbang -test-list-host += inductive_charging -test-list-host += interrupt -test-list-host += irq_locking -test-list-host += is_enabled -test-list-host += is_enabled_error -test-list-host += kasa -test-list-host += kb_8042 -test-list-host += kb_mkbp -test-list-host += kb_scan -test-list-host += kb_scan_strict -test-list-host += lid_sw -test-list-host += lightbar -test-list-host += mag_cal -test-list-host += math_util -test-list-host += motion_angle -test-list-host += motion_angle_tablet -test-list-host += motion_lid -test-list-host += motion_sense_fifo -test-list-host += mutex -test-list-host += newton_fit -test-list-host += online_calibration -test-list-host += online_calibration_spoof -test-list-host += pingpong -test-list-host += power_button -test-list-host += printf -test-list-host += queue -test-list-host += rsa -test-list-host += rsa3 -test-list-host += rtc -test-list-host += sbs_charging_v2 -test-list-host += sha256 -test-list-host += sha256_unrolled -test-list-host += shmalloc -test-list-host += static_if -test-list-host += static_if_error -test-list-host += system -test-list-host += thermal -test-list-host += timer_dos -test-list-host += uptime -test-list-host += usb_common -test-list-host += usb_pd_int -test-list-host += usb_pd -test-list-host += usb_pd_giveback -test-list-host += usb_pd_rev30 -test-list-host += usb_pd_pdo_fixed -test-list-host += usb_ppc -test-list-host += usb_sm_framework_h3 -test-list-host += usb_sm_framework_h2 -test-list-host += usb_sm_framework_h1 -test-list-host += usb_sm_framework_h0 -test-list-host += usb_typec_vpd -test-list-host += usb_typec_ctvpd -test-list-host += usb_typec_drp_acc_trysrc -test-list-host += usb_prl_old -test-list-host += usb_tcpmv2_compliance -test-list-host += usb_prl -test-list-host += usb_prl_noextended -test-list-host += usb_pe_drp_old -test-list-host += usb_pe_drp_old_noextended -test-list-host += usb_pe_drp -test-list-host += usb_pe_drp_noextended -test-list-host += utils -test-list-host += utils_str -test-list-host += vboot -test-list-host += version -test-list-host += x25519 -test-list-host += stillness_detector -endif - -# Build up the list of coverage test targets based on test-list-host, but -# with some tests excluded because they cause code coverage to fail. - -# is_enabled_error is a shell script that does not produce coverage results -cov-dont-test = is_enabled_error -# static_if_error is a shell script that does not produce coverage results -cov-dont-test += static_if_error -# fpsensor: genhtml looks for build/host/fpsensor/cryptoc/util.c -cov-dont-test += fpsensor -# fpsensor_crypto: genhtml looks for build/host/fpsensor_crypto/cryptoc/util.c -cov-dont-test += fpsensor_crypto -# fpsensor_state: genhtml looks for build/host/fpsensor_state/cryptoc/util.c -cov-dont-test += fpsensor_state -# version: Only works in a chroot. -cov-dont-test += version -cov-test-list-host = $(filter-out $(cov-dont-test), $(test-list-host)) - -accel_cal-y=accel_cal.o -aes-y=aes.o -base32-y=base32.o -battery_get_params_smart-y=battery_get_params_smart.o -bklight_lid-y=bklight_lid.o -bklight_passthru-y=bklight_passthru.o -body_detection-y=body_detection.o body_detection_data_literals.o motion_common.o -button-y=button.o -cbi-y=cbi.o -cbi_wp-y=cbi_wp.o -cec-y=cec.o -charge_manager-y=charge_manager.o -charge_manager_drp_charging-y=charge_manager.o -charge_ramp-y+=charge_ramp.o -compile_time_macros-y=compile_time_macros.o -console_edit-y=console_edit.o -crc-y=crc.o -entropy-y=entropy.o -extpwr_gpio-y=extpwr_gpio.o -fan-y=fan.o -flash-y=flash.o -flash_physical-y=flash_physical.o -flash_write_protect-y=flash_write_protect.o -fpsensor-y=fpsensor.o -fpsensor_crypto-y=fpsensor_crypto.o -fpsensor_hw-y=fpsensor_hw.o -fpsensor_state-y=fpsensor_state.o -gyro_cal-y=gyro_cal.o gyro_cal_init_for_test.o -hooks-y=hooks.o -host_command-y=host_command.o -i2c_bitbang-y=i2c_bitbang.o -inductive_charging-y=inductive_charging.o -interrupt-y=interrupt.o -irq_locking-y=irq_locking.o -is_enabled-y=is_enabled.o -kb_8042-y=kb_8042.o -kb_mkbp-y=kb_mkbp.o -kb_scan-y=kb_scan.o -kb_scan_strict-y=kb_scan.o -lid_sw-y=lid_sw.o -lightbar-y=lightbar.o -mag_cal-y=mag_cal.o -math_util-y=math_util.o -motion_angle-y=motion_angle.o motion_angle_data_literals.o motion_common.o -motion_angle_tablet-y=motion_angle_tablet.o motion_angle_data_literals_tablet.o motion_common.o -motion_lid-y=motion_lid.o -motion_sense_fifo-y=motion_sense_fifo.o -online_calibration-y=online_calibration.o -online_calibration_spoof-y=online_calibration_spoof.o gyro_cal_init_for_test.o -kasa-y=kasa.o -mpu-y=mpu.o -mutex-y=mutex.o -newton_fit-y=newton_fit.o -pingpong-y=pingpong.o -power_button-y=power_button.o -powerdemo-y=powerdemo.o -printf-y=printf.o -queue-y=queue.o -rollback-y=rollback.o -rollback_entropy-y=rollback_entropy.o -rsa-y=rsa.o -rsa3-y=rsa.o -rtc-y=rtc.o -scratchpad-y=scratchpad.o -sbs_charging-y=sbs_charging.o -sbs_charging_v2-y=sbs_charging_v2.o -sha256-y=sha256.o -sha256_unrolled-y=sha256.o -shmalloc-y=shmalloc.o -static_if-y=static_if.o -stm32f_rtc-y=stm32f_rtc.o -stress-y=stress.o -system-y=system.o -thermal-y=thermal.o -timer_calib-y=timer_calib.o -timer_dos-y=timer_dos.o -uptime-y=uptime.o -usb_common-y=usb_common_test.o fake_battery.o -usb_pd_int-y=usb_pd_int.o -usb_pd-y=usb_pd.o -usb_pd_giveback-y=usb_pd.o -usb_pd_rev30-y=usb_pd.o -usb_pd_pdo_fixed-y=usb_pd_pdo_fixed_test.o -usb_ppc-y=usb_ppc.o -usb_sm_framework_h3-y=usb_sm_framework_h3.o -usb_sm_framework_h2-y=usb_sm_framework_h3.o -usb_sm_framework_h1-y=usb_sm_framework_h3.o -usb_sm_framework_h0-y=usb_sm_framework_h3.o -usb_typec_vpd-y=usb_typec_ctvpd.o vpd_api.o usb_sm_checks.o fake_usbc.o -usb_typec_ctvpd-y=usb_typec_ctvpd.o vpd_api.o usb_sm_checks.o fake_usbc.o -usb_typec_drp_acc_trysrc-y=usb_typec_drp_acc_trysrc.o vpd_api.o \ - usb_sm_checks.o -usb_prl_old-y=usb_prl_old.o usb_sm_checks.o fake_usbc.o -usb_prl-y=usb_prl.o usb_sm_checks.o -usb_prl_noextended-y=usb_prl_noextended.o usb_sm_checks.o fake_usbc.o -usb_pe_drp_old-y=usb_pe_drp_old.o usb_sm_checks.o fake_usbc.o -usb_pe_drp_old_noextended-y=usb_pe_drp_old.o usb_sm_checks.o fake_usbc.o -usb_pe_drp-y=usb_pe_drp.o usb_sm_checks.o -usb_pe_drp_noextended-y=usb_pe_drp_noextended.o usb_sm_checks.o -usb_tcpmv2_compliance-y=usb_tcpmv2_compliance.o usb_tcpmv2_compliance_common.o \ - usb_tcpmv2_td_pd_ll_e3.o \ - usb_tcpmv2_td_pd_ll_e4.o \ - usb_tcpmv2_td_pd_ll_e5.o \ - usb_tcpmv2_td_pd_src_e1.o \ - usb_tcpmv2_td_pd_src_e2.o \ - usb_tcpmv2_td_pd_src_e5.o \ - usb_tcpmv2_td_pd_src3_e1.o \ - usb_tcpmv2_td_pd_src3_e7.o \ - usb_tcpmv2_td_pd_src3_e8.o \ - usb_tcpmv2_td_pd_src3_e9.o \ - usb_tcpmv2_td_pd_src3_e26.o \ - usb_tcpmv2_td_pd_src3_e32.o \ - usb_tcpmv2_td_pd_snk3_e12.o \ - usb_tcpmv2_td_pd_vndi3_e3.o \ - usb_tcpmv2_td_pd_other.o -utils-y=utils.o -utils_str-y=utils_str.o -vboot-y=vboot.o -version-y += version.o -float-y=fp.o -fp-y=fp.o -x25519-y=x25519.o -stillness_detector-y=stillness_detector.o - -host-is_enabled_error: TEST_SCRIPT=is_enabled_error.sh -is_enabled_error-y=is_enabled_error.o.cmd - -host-static_if_error: TEST_SCRIPT=static_if_error.sh -static_if_error-y=static_if_error.o.cmd - -run-genvif_test: - @echo " TEST genvif_test" - @test/genvif/genvif.sh diff --git a/test/button.c b/test/button.c deleted file mode 100644 index e457eaa786..0000000000 --- a/test/button.c +++ /dev/null @@ -1,318 +0,0 @@ -/* Copyright 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. - * - * Test non-keyboard buttons. -* - * Using GPIOS and buttons[] defined in board/host/board.c - * Volume down is active low with a debounce time of 30 mSec. - * Volume up is active high with a debounce time of 60 mSec. - * - */ - -#include "button.h" -#include "common.h" -#include "console.h" -#include "gpio.h" -#include "host_command.h" -#include "test_util.h" -#include "timer.h" -#include "keyboard_config.h" -#include "keyboard_protocol.h" -#include "util.h" - -#define UNCHANGED -1 - -uint8_t keyboard_cols = KEYBOARD_COLS_MAX; - -static const struct button_config *button_vol_down = - &buttons[BUTTON_VOLUME_DOWN]; -static const struct button_config *button_vol_up = &buttons[BUTTON_VOLUME_UP]; - -static int button_state[BUTTON_COUNT]; - -/* - * Callback from the button handling logic. - * This is normally implemented by a keyboard protocol handler. - */ -void keyboard_update_button(enum keyboard_button_type button, int is_pressed) -{ - int i; - - for (i = 0; i < BUTTON_COUNT; i++) { - if (buttons[i].type == button) { - button_state[i] = is_pressed; - break; - } - } -} - -/* Test pressing a button */ -static int test_button_press(void) -{ - gpio_set_level(button_vol_down->gpio, 0); - msleep(100); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == 1); - - return EC_SUCCESS; -} - -/* Test releasing a button */ -static int test_button_release(void) -{ - gpio_set_level(button_vol_up->gpio, 0); - msleep(100); - gpio_set_level(button_vol_up->gpio, 1); - msleep(100); - TEST_ASSERT(button_state[BUTTON_VOLUME_UP] == 0); - - return EC_SUCCESS; -} - -/* A press shorter than the debounce time should not trigger an update */ -static int test_button_debounce_short_press(void) -{ - gpio_set_level(button_vol_down->gpio, 0); - msleep(10); - gpio_set_level(button_vol_down->gpio, 1); - msleep(100); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == UNCHANGED); - - return EC_SUCCESS; -} - -/* A short bounce while pressing should still result in a button press */ -static int test_button_debounce_short_bounce(void) -{ - gpio_set_level(button_vol_down->gpio, 0); - msleep(10); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == UNCHANGED); - gpio_set_level(button_vol_down->gpio, 1); - msleep(10); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == UNCHANGED); - gpio_set_level(button_vol_down->gpio, 0); - msleep(20); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == UNCHANGED); - msleep(20); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == 1); - - return EC_SUCCESS; -} - -/* Button level must be stable for the entire debounce interval */ -static int test_button_debounce_stability(void) -{ - gpio_set_level(button_vol_down->gpio, 0); - msleep(20); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == UNCHANGED); - gpio_set_level(button_vol_down->gpio, 1); - msleep(20); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == UNCHANGED); - gpio_set_level(button_vol_down->gpio, 0); - msleep(20); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == UNCHANGED); - msleep(20); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == 1); - msleep(60); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == 1); - gpio_set_level(button_vol_down->gpio, 1); - msleep(20); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == 1); - msleep(20); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == 0); - msleep(60); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == 0); - - return EC_SUCCESS; -} - -/* Test pressing both buttons at different times */ -static int test_button_press_both(void) -{ - gpio_set_level(button_vol_down->gpio, 0); - msleep(10); - gpio_set_level(button_vol_up->gpio, 0); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == UNCHANGED); - TEST_ASSERT(button_state[BUTTON_VOLUME_UP] == UNCHANGED); - msleep(30); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == 1); - TEST_ASSERT(button_state[BUTTON_VOLUME_UP] == UNCHANGED); - msleep(40); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == 1); - TEST_ASSERT(button_state[BUTTON_VOLUME_UP] == 1); - - return EC_SUCCESS; -} - -/* Button simulate test cases */ -static int send_button_hostcmd(uint32_t btn_mask, uint32_t press_ms) -{ - struct ec_params_button p; - - p.press_ms = press_ms; - p.btn_mask = btn_mask; - - return test_send_host_command(EC_CMD_BUTTON, 0, &p, sizeof(p), NULL, 0); -} - -static void test_sim_button_util(uint32_t btn_mask, uint32_t press_ms) -{ - send_button_hostcmd(btn_mask, press_ms); - msleep(100); -} - -/* Test simulate pressing a button */ -static int test_sim_button_press(void) -{ - test_sim_button_util(1 << KEYBOARD_BUTTON_VOLUME_DOWN, 100); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == 1); - - return EC_SUCCESS; -} - -/* Test simulate releasing a button */ -static int test_sim_button_release(void) -{ - test_sim_button_util(1 << KEYBOARD_BUTTON_VOLUME_UP, 50); - TEST_ASSERT(button_state[BUTTON_VOLUME_UP] == 0); - - return EC_SUCCESS; -} - -/* A press shorter than the debounce time should not trigger an update */ -static int test_sim_button_debounce_short_press(void) -{ - test_sim_button_util(1 << KEYBOARD_BUTTON_VOLUME_DOWN, 10); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == UNCHANGED); - - return EC_SUCCESS; -} - -/* A short bounce while pressing should still result in a button press */ -static int test_sim_button_debounce_short_bounce(void) -{ - uint32_t btn_mask = 0; - - btn_mask |= (1 << KEYBOARD_BUTTON_VOLUME_DOWN); - send_button_hostcmd(btn_mask, 10); - msleep(50); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == UNCHANGED); - - send_button_hostcmd(btn_mask, 100); - msleep(20); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == UNCHANGED); - msleep(20); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == 1); - - return EC_SUCCESS; -} - -/* Button level must be stable for the entire debounce interval */ -static int test_sim_button_debounce_stability(void) -{ - uint32_t btn_mask = 0; - - btn_mask |= (1 << KEYBOARD_BUTTON_VOLUME_DOWN); - send_button_hostcmd(btn_mask, 10); - msleep(20); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == UNCHANGED); - msleep(20); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == UNCHANGED); - - send_button_hostcmd(btn_mask, 100); - msleep(20); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == UNCHANGED); - msleep(20); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == 1); - msleep(60); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == 1); - - msleep(20); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == 1); - msleep(20); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == 0); - msleep(60); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == 0); - - return EC_SUCCESS; -} - -/* Test simulate pressing both buttons */ -static int test_sim_button_press_both(void) -{ - uint32_t btn_mask = 0; - - btn_mask |= (1 << KEYBOARD_BUTTON_VOLUME_DOWN); - btn_mask |= (1 << KEYBOARD_BUTTON_VOLUME_UP); - send_button_hostcmd(btn_mask, 100); - msleep(10); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == UNCHANGED); - TEST_ASSERT(button_state[BUTTON_VOLUME_UP] == UNCHANGED); - msleep(60); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == 1); - TEST_ASSERT(button_state[BUTTON_VOLUME_UP] == 1); - msleep(100); - TEST_ASSERT(button_state[BUTTON_VOLUME_DOWN] == 0); - TEST_ASSERT(button_state[BUTTON_VOLUME_UP] == 0); - - return EC_SUCCESS; -} - -static void button_test_init(void) -{ - int i; - - ccprints("Setting button GPIOs to inactive state"); - for (i = 0; i < BUTTON_COUNT; i++) - gpio_set_level(buttons[i].gpio, - !(buttons[i].flags & BUTTON_FLAG_ACTIVE_HIGH)); - - msleep(100); - for (i = 0; i < BUTTON_COUNT; i++) - button_state[i] = UNCHANGED; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - button_init(); - - button_test_init(); - RUN_TEST(test_button_press); - - button_test_init(); - RUN_TEST(test_button_release); - - button_test_init(); - RUN_TEST(test_button_debounce_short_press); - - button_test_init(); - RUN_TEST(test_button_debounce_short_bounce); - - button_test_init(); - RUN_TEST(test_button_debounce_stability); - - button_test_init(); - RUN_TEST(test_button_press_both); - - button_test_init(); - RUN_TEST(test_sim_button_press); - - button_test_init(); - RUN_TEST(test_sim_button_release); - - button_test_init(); - RUN_TEST(test_sim_button_debounce_short_press); - - button_test_init(); - RUN_TEST(test_sim_button_debounce_short_bounce); - - button_test_init(); - RUN_TEST(test_sim_button_debounce_stability); - - button_test_init(); - RUN_TEST(test_sim_button_press_both); - - test_print_result(); -} diff --git a/test/button.tasklist b/test/button.tasklist deleted file mode 100644 index 5a8fb1bfbe..0000000000 --- a/test/button.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) diff --git a/test/cbi.c b/test/cbi.c deleted file mode 100644 index 688063f153..0000000000 --- a/test/cbi.c +++ /dev/null @@ -1,293 +0,0 @@ -/* Copyright 2020 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. - * - * Test CBI - */ - -#include "common.h" -#include "console.h" -#include "cros_board_info.h" -#include "ec_commands.h" -#include "gpio.h" -#include "i2c.h" -#include "test_util.h" -#include "util.h" - -static void test_setup(void) -{ - /* Make sure that write protect is disabled */ -#ifdef CONFIG_WP_ACTIVE_HIGH - gpio_set_level(GPIO_WP, 0); -#else - gpio_set_level(GPIO_WP_L, 1); -#endif /* CONFIG_WP_ACTIVE_HIGH */ - - cbi_create(); - cbi_write(); -} - -static void test_teardown(void) -{ -} - -DECLARE_EC_TEST(test_uint8) -{ - uint8_t d8; - uint32_t d32; - uint8_t size; - const int tag = 0xff; - - /* Set & get uint8_t */ - d8 = 0xa5; - zassert_equal(cbi_set_board_info(tag, &d8, sizeof(d8)), EC_SUCCESS, - NULL); - size = 1; - zassert_equal(cbi_get_board_info(tag, &d8, &size), EC_SUCCESS, NULL); - zassert_equal(d8, 0xa5, "0x%x, 0x%x", d8, 0xa5); - zassert_equal(size, 1, "%x, %x", size, 1); - - /* Size-up */ - d32 = 0x1234abcd; - zassert_equal(cbi_set_board_info(tag, (void *)&d32, sizeof(d32)), - EC_SUCCESS, NULL); - size = 4; - zassert_equal(cbi_get_board_info(tag, (void *)&d32, &size), EC_SUCCESS, - NULL); - zassert_equal(d32, 0x1234abcd, "0x%x, 0x%x", d32, 0x1234abcd); - zassert_equal(size, 4, "%u, %u", size, 4); - - return EC_SUCCESS; -} - -DECLARE_EC_TEST(test_uint32) -{ - uint8_t d8; - uint32_t d32; - uint8_t size; - const int tag = 0xff; - - /* Set & get uint32_t */ - d32 = 0x1234abcd; - zassert_equal(cbi_set_board_info(tag, (void *)&d32, sizeof(d32)), - EC_SUCCESS, NULL); - size = 4; - zassert_equal(cbi_get_board_info(tag, (void *)&d32, &size), EC_SUCCESS, - NULL); - zassert_equal(d32, 0x1234abcd, "0x%x, 0x%x", d32, 0x1234abcd); - zassert_equal(size, 4, "%u, %u", size, 4); - - /* Size-down */ - d8 = 0xa5; - zassert_equal(cbi_set_board_info(tag, &d8, sizeof(d8)), EC_SUCCESS, - NULL); - size = 1; - zassert_equal(cbi_get_board_info(tag, &d8, &size), EC_SUCCESS, NULL); - zassert_equal(d8, 0xa5, "0x%x, 0x%x", d8, 0xa5); - zassert_equal(size, 1, "%u, %u", size, 1); - - return EC_SUCCESS; -} - -DECLARE_EC_TEST(test_string) -{ - const uint8_t string[] = "abcdefghijklmn"; - uint8_t buf[32]; - uint8_t size; - const int tag = 0xff; - - /* Set & get string */ - zassert_equal(cbi_set_board_info(tag, string, sizeof(string)), - EC_SUCCESS, NULL); - size = sizeof(buf); - zassert_equal(cbi_get_board_info(tag, buf, &size), EC_SUCCESS, NULL); - zassert_equal(strncmp(buf, string, sizeof(string)), 0, NULL); - /* Size contains null byte */ - /* This should be zassert_equal, but for EC test fmt is always "0x%x" - * which will generate compilation error. - */ - zassert_true((size_t)size - 1 == strlen(buf), "%zu, %zu", - (size_t)size - 1, strlen(buf)); - - /* Read buffer too small */ - size = 4; - zassert_equal(cbi_get_board_info(tag, buf, &size), EC_ERROR_INVAL, - NULL); - - return EC_SUCCESS; -} - -DECLARE_EC_TEST(test_not_found) -{ - uint8_t d8; - const int tag = 0xff; - uint8_t size; - - size = 1; - zassert_equal(cbi_get_board_info(tag, &d8, &size), EC_ERROR_UNKNOWN, - NULL); - - return EC_SUCCESS; -} - -DECLARE_EC_TEST(test_too_large) -{ - uint8_t buf[CBI_IMAGE_SIZE-1]; - const int tag = 0xff; - - /* Data too large */ - memset(buf, 0xa5, sizeof(buf)); - zassert_equal(cbi_set_board_info(tag, buf, sizeof(buf)), - EC_ERROR_OVERFLOW, NULL); - - return EC_SUCCESS; -} - -DECLARE_EC_TEST(test_all_tags) -{ - uint8_t d8; - uint32_t d32; - uint64_t d64; - const char string[] = "abc"; - uint8_t buf[32]; - uint8_t size; - int count = 0; - - /* Populate all data and read out */ - d8 = 0x12; - zassert_equal(cbi_set_board_info(CBI_TAG_BOARD_VERSION, &d8, - sizeof(d8)), - EC_SUCCESS, NULL); - count++; - zassert_equal(cbi_set_board_info(CBI_TAG_OEM_ID, &d8, sizeof(d8)), - EC_SUCCESS, NULL); - count++; - zassert_equal(cbi_set_board_info(CBI_TAG_SKU_ID, &d8, sizeof(d8)), - EC_SUCCESS, NULL); - count++; - zassert_equal(cbi_set_board_info(CBI_TAG_DRAM_PART_NUM, - string, sizeof(string)), - EC_SUCCESS, NULL); - count++; - zassert_equal(cbi_set_board_info(CBI_TAG_OEM_NAME, - string, sizeof(string)), - EC_SUCCESS, NULL); - count++; - zassert_equal(cbi_set_board_info(CBI_TAG_MODEL_ID, &d8, sizeof(d8)), - EC_SUCCESS, NULL); - count++; - zassert_equal(cbi_set_board_info(CBI_TAG_FW_CONFIG, &d8, sizeof(d8)), - EC_SUCCESS, NULL); - count++; - zassert_equal(cbi_set_board_info(CBI_TAG_PCB_SUPPLIER, &d8, - sizeof(d8)), - EC_SUCCESS, NULL); - count++; - zassert_equal(cbi_set_board_info(CBI_TAG_SSFC, &d8, sizeof(d8)), - EC_SUCCESS, NULL); - count++; - zassert_equal(cbi_set_board_info(CBI_TAG_REWORK_ID, &d8, sizeof(d8)), - EC_SUCCESS, NULL); - count++; - - /* Read out all */ - zassert_equal(cbi_get_board_version(&d32), EC_SUCCESS, NULL); - zassert_equal(d32, d8, "0x%x, 0x%x", d32, d8); - zassert_equal(cbi_get_oem_id(&d32), EC_SUCCESS, NULL); - zassert_equal(d32, d8, "0x%x, 0x%x", d32, d8); - zassert_equal(cbi_get_sku_id(&d32), EC_SUCCESS, NULL); - zassert_equal(d32, d8, "0x%x, 0x%x", d32, d8); - size = sizeof(buf); - zassert_equal(cbi_get_board_info(CBI_TAG_DRAM_PART_NUM, buf, &size), - EC_SUCCESS, NULL); - zassert_equal(strncmp(buf, string, sizeof(string)), 0, NULL); - /* This should be zassert_equal, but for EC test fmt is always "0x%x" - * which will generate compilation error. - */ - zassert_true((size_t)size - 1 == strlen(buf), "%zu, %zu", - (size_t)size - 1, strlen(buf)); - size = sizeof(buf); - zassert_equal(cbi_get_board_info(CBI_TAG_OEM_NAME, buf, &size), - EC_SUCCESS, NULL); - zassert_equal(strncmp(buf, string, sizeof(string)), 0, NULL); - /* This should be zassert_equal, but for EC test fmt is always "0x%x" - * which will generate compilation error. - */ - zassert_true((size_t)size - 1 == strlen(buf), "%zu, %zu", - (size_t)size - 1, strlen(buf)); - zassert_equal(cbi_get_model_id(&d32), EC_SUCCESS, NULL); - zassert_equal(d32, d8, "0x%x, 0x%x", d32, d8); - zassert_equal(cbi_get_fw_config(&d32), EC_SUCCESS, NULL); - zassert_equal(d32, d8, "0x%x, 0x%x", d32, d8); - zassert_equal(cbi_get_pcb_supplier(&d32), EC_SUCCESS, NULL); - zassert_equal(d32, d8, "0x%x, 0x%x", d32, d8); - zassert_equal(cbi_get_ssfc(&d32), EC_SUCCESS, NULL); - zassert_equal(d32, d8, "0x%x, 0x%x", d32, d8); - zassert_equal(cbi_get_rework_id(&d64), EC_SUCCESS, NULL); - /* This should be zassert_equal, but for EC test fmt is always "0x%x" - * which will generate compilation error. - */ - zassert_true((unsigned long long)d64 == (unsigned long long)d8, - "0x%llx, 0x%llx", (unsigned long long)d64, - (unsigned long long)d8); - - /* Fail if a (new) tag is missing from the unit test. */ - zassert_equal(count, CBI_TAG_COUNT, "%d, %d", count, CBI_TAG_COUNT); - - /* Write protect */ -#ifdef CONFIG_WP_ACTIVE_HIGH - gpio_set_level(GPIO_WP, 1); -#else - gpio_set_level(GPIO_WP_L, 0); -#endif /* CONFIG_WP_ACTIVE_HIGH */ - zassert_equal(cbi_write(), EC_ERROR_ACCESS_DENIED, NULL); - - return EC_SUCCESS; -} - -DECLARE_EC_TEST(test_bad_crc) -{ - uint8_t d8; - const int tag = 0xff; - uint8_t size; - int crc; - - /* Bad CRC */ - d8 = 0xa5; - zassert_equal(cbi_set_board_info(tag, &d8, sizeof(d8)), EC_SUCCESS, - NULL); - i2c_read8(I2C_PORT_EEPROM, I2C_ADDR_EEPROM_FLAGS, - offsetof(struct cbi_header, crc), &crc); - i2c_write8(I2C_PORT_EEPROM, I2C_ADDR_EEPROM_FLAGS, - offsetof(struct cbi_header, crc), ++crc); - cbi_invalidate_cache(); - size = sizeof(d8); - zassert_equal(cbi_get_board_info(tag, &d8, &size), EC_ERROR_UNKNOWN, - NULL); - - return EC_SUCCESS; -} - -TEST_SUITE(test_suite_cbi) -{ - ztest_test_suite(test_cbi, - ztest_unit_test_setup_teardown(test_uint8, test_setup, - test_teardown), - ztest_unit_test_setup_teardown(test_uint32, test_setup, - test_teardown), - ztest_unit_test_setup_teardown(test_string, test_setup, - test_teardown), - ztest_unit_test_setup_teardown(test_not_found, - test_setup, - test_teardown), - ztest_unit_test_setup_teardown(test_too_large, - test_setup, - test_teardown), - ztest_unit_test_setup_teardown(test_all_tags, - test_setup, - test_teardown), - ztest_unit_test_setup_teardown(test_bad_crc, - test_setup, - test_teardown)); - ztest_run_test_suite(test_cbi); -} diff --git a/test/cbi.tasklist b/test/cbi.tasklist deleted file mode 100644 index 52c0d390ef..0000000000 --- a/test/cbi.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2020 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/cbi_wp.c b/test/cbi_wp.c deleted file mode 100644 index 7bdfa4b0c8..0000000000 --- a/test/cbi_wp.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright 2021 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. - * - * Test CBI EEPROM WP - */ - -#include "common.h" -#include "console.h" -#include "cros_board_info.h" -#include "gpio.h" -#include "system.h" -#include "test_util.h" -#include "util.h" - -static int system_locked; - -static void test_setup(void) -{ - /* Make sure that write protect is disabled */ - gpio_set_level(GPIO_WP, 0); - gpio_set_level(GPIO_EC_CBI_WP, 0); - system_locked = 0; -} - -static void test_teardown(void) -{ -} - -int system_is_locked(void) -{ - return system_locked; -} - -DECLARE_EC_TEST(test_wp) -{ - int cbi_wp; - - cbi_wp = gpio_get_level(GPIO_EC_CBI_WP); - zassert_equal(cbi_wp, 0, NULL); - - cbi_latch_eeprom_wp(); - cbi_wp = gpio_get_level(GPIO_EC_CBI_WP); - zassert_equal(cbi_wp, 1, NULL); - - return EC_SUCCESS; -} - -TEST_SUITE(test_suite_cbi_wp) -{ - ztest_test_suite(test_cbi_wp, - ztest_unit_test_setup_teardown(test_wp, - test_setup, - test_teardown)); - ztest_run_test_suite(test_cbi_wp); -} diff --git a/test/cbi_wp.tasklist b/test/cbi_wp.tasklist deleted file mode 100644 index e54ea001bd..0000000000 --- a/test/cbi_wp.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2021 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/cec.c b/test/cec.c deleted file mode 100644 index 9377e4fcd3..0000000000 --- a/test/cec.c +++ /dev/null @@ -1,131 +0,0 @@ -/* Copyright 2018 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. - * - * Test the buffer handling of HDMI CEC - */ - -#include <string.h> - -#include "cec.h" -#include "test_util.h" - -struct overflow_msg { - struct cec_msg_transfer transfer; - uint8_t overflow_detector; -} overflow_msg; -/* Ensure the overflow detector is located directly after the buffer */ -BUILD_ASSERT(offsetof(struct overflow_msg, overflow_detector) == - offsetof(struct cec_msg_transfer, buf) + MAX_CEC_MSG_LEN); - - -struct overflow_queue { - struct cec_rx_queue queue; - uint8_t overflow_detector[CEC_RX_BUFFER_SIZE]; -} overflow_queue; -/* Ensure the overflow detector is located directly after the buffer */ -BUILD_ASSERT(offsetof(struct overflow_queue, overflow_detector) == - offsetof(struct cec_rx_queue, buf) + CEC_RX_BUFFER_SIZE); - -static struct cec_rx_queue *queue; - -/* Tests */ -static int test_msg_overflow(void) -{ - int i; - - /* Overwrite the buffer by 1 byte */ - for (i = 0; i < (MAX_CEC_MSG_LEN+1)*8; i++) { - cec_transfer_set_bit(&overflow_msg.transfer, 1); - cec_transfer_inc_bit(&overflow_msg.transfer); - } - - /* Make sure we actually wrote the whole buffer with ones */ - for (i = 0; i < MAX_CEC_MSG_LEN; i++) - TEST_ASSERT(overflow_msg.transfer.buf[i] == 0xff); - - /* Verify that the attempt to overflow the buffer did not succeed */ - TEST_ASSERT(overflow_msg.overflow_detector == 0); - - /* The full indicator is when byte reaches MAX_CEC_MSG_LEN */ - TEST_ASSERT(overflow_msg.transfer.byte == MAX_CEC_MSG_LEN); - - /* Check that the indicator stays the same if we write another byte */ - for (i = 0; i < 8; i++) { - cec_transfer_set_bit(&overflow_msg.transfer, 1); - cec_transfer_inc_bit(&overflow_msg.transfer); - } - TEST_ASSERT(overflow_msg.transfer.byte == MAX_CEC_MSG_LEN); - - return EC_SUCCESS; -} - - - -static int verify_no_queue_overflow(void) -{ - int i; - - for (i = 0; i < CEC_RX_BUFFER_SIZE; i++) { - if (overflow_queue.overflow_detector[i] != 0) - return EC_ERROR_OVERFLOW; - } - return EC_SUCCESS; -} - - -static void clear_queue(void) -{ - memset(queue, 0, sizeof(struct cec_rx_queue)); - -} - -static int fill_queue(uint8_t *msg, int msg_size) -{ - int i; - - /* - * Fill the queue. Every push adds the message and one extra byte for - * the length field. The maximum data we can add is one less than - * CEC_RX_BUFFER_SIZE since write_pointer==read_pointer is used to - * indicate an empty buffer - */ - clear_queue(); - - for (i = 0; i < (CEC_RX_BUFFER_SIZE - 1)/(msg_size + 1); i++) - TEST_ASSERT(cec_rx_queue_push(queue, msg, msg_size) == 0); - - /* Now the queue should be full */ - TEST_ASSERT(cec_rx_queue_push(queue, msg, msg_size) == - EC_ERROR_OVERFLOW); - - /* Verify nothing was written outside of the queue */ - TEST_ASSERT(verify_no_queue_overflow() == EC_SUCCESS); - - return EC_SUCCESS; -} - -static int test_queue_overflow(void) -{ - uint8_t msg[CEC_RX_BUFFER_SIZE]; - - memset(msg, 0xff, sizeof(msg)); - - TEST_ASSERT(fill_queue(msg, 1) == EC_SUCCESS); - TEST_ASSERT(fill_queue(msg, 2) == EC_SUCCESS); - TEST_ASSERT(fill_queue(msg, 3) == EC_SUCCESS); - TEST_ASSERT(fill_queue(msg, MAX_CEC_MSG_LEN) == EC_SUCCESS); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - queue = &overflow_queue.queue; - - RUN_TEST(test_msg_overflow); - - RUN_TEST(test_queue_overflow); - - test_print_result(); -} diff --git a/test/cec.tasklist b/test/cec.tasklist deleted file mode 100644 index e7634958a9..0000000000 --- a/test/cec.tasklist +++ /dev/null @@ -1,11 +0,0 @@ -/* Copyright 2018 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. - * - * Test the buffer handling of HDMI CEC - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/charge_manager.c b/test/charge_manager.c deleted file mode 100644 index 2a64ca3e98..0000000000 --- a/test/charge_manager.c +++ /dev/null @@ -1,805 +0,0 @@ -/* Copyright 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. - * - * Test charge manager module. - */ - -#include "battery.h" -#include "charge_manager.h" -#include "common.h" -#include "ec_commands.h" -#include "test_util.h" -#include "timer.h" -#include "usb_pd.h" -#include "util.h" - -#define CHARGE_MANAGER_SLEEP_MS 50 - -/* Charge supplier priority: lower number indicates higher priority. */ -const int supplier_priority[] = { - [CHARGE_SUPPLIER_TEST1] = 0, - [CHARGE_SUPPLIER_TEST2] = 1, - [CHARGE_SUPPLIER_TEST3] = 1, - [CHARGE_SUPPLIER_TEST4] = 1, - [CHARGE_SUPPLIER_TEST5] = 3, - [CHARGE_SUPPLIER_TEST6] = 3, - [CHARGE_SUPPLIER_TEST7] = 5, - [CHARGE_SUPPLIER_TEST8] = 6, - [CHARGE_SUPPLIER_TEST9] = 6, - [CHARGE_SUPPLIER_TEST10] = 7, -}; -BUILD_ASSERT((int)CHARGE_SUPPLIER_COUNT == (int)CHARGE_SUPPLIER_TEST_COUNT); -BUILD_ASSERT(ARRAY_SIZE(supplier_priority) == CHARGE_SUPPLIER_COUNT); - -static unsigned int active_charge_limit = CHARGE_SUPPLIER_NONE; -static unsigned int active_charge_port = CHARGE_PORT_NONE; -static unsigned int charge_port_to_reject = CHARGE_PORT_NONE; -static int new_power_request[CONFIG_USB_PD_PORT_MAX_COUNT]; -static enum pd_power_role power_role[CONFIG_USB_PD_PORT_MAX_COUNT]; - -/* Callback functions called by CM on state change */ -void board_set_charge_limit(int port, int supplier, int charge_ma, - int max_ma, int charge_mv) -{ - active_charge_limit = charge_ma; -} - -__override uint8_t board_get_usb_pd_port_count(void) -{ - return CONFIG_USB_PD_PORT_MAX_COUNT; -} - -/* Sets a charge port that will be rejected as the active port. */ -static void set_charge_port_to_reject(int port) -{ - charge_port_to_reject = port; -} - -int board_set_active_charge_port(int charge_port) -{ - if (charge_port != CHARGE_PORT_NONE && - charge_port == charge_port_to_reject) - return EC_ERROR_INVAL; - - active_charge_port = charge_port; - return EC_SUCCESS; -} - -void board_charge_manager_override_timeout(void) -{ -} - -void pd_set_new_power_request(int port) -{ - new_power_request[port] = 1; -} - -static void clear_new_power_requests(void) -{ - int i; - for (i = 0; i < board_get_usb_pd_port_count(); ++i) - new_power_request[i] = 0; -} - -static void pd_set_role(int port, int role) -{ - power_role[port] = role; -} - -enum pd_power_role pd_get_power_role(int port) -{ - return power_role[port]; -} - -void pd_request_power_swap(int port) -{ - if (power_role[port] == PD_ROLE_SINK) - power_role[port] = PD_ROLE_SOURCE; - else - power_role[port] = PD_ROLE_SINK; -} - -static void wait_for_charge_manager_refresh(void) -{ - msleep(CHARGE_MANAGER_SLEEP_MS); -} - -static void initialize_charge_table(int current, int voltage, int ceil) -{ - int i, j; - struct charge_port_info charge; - - charge_manager_set_override(OVERRIDE_OFF); - set_charge_port_to_reject(CHARGE_PORT_NONE); - charge.current = current; - charge.voltage = voltage; - - for (i = 0; i < board_get_usb_pd_port_count(); ++i) { - for (j = 0; j < CEIL_REQUESTOR_COUNT; ++j) - charge_manager_set_ceil(i, j, ceil); - charge_manager_update_dualrole(i, CAP_DEDICATED); - pd_set_role(i, PD_ROLE_SINK); - for (j = 0; j < CHARGE_SUPPLIER_COUNT; ++j) - charge_manager_update_charge(j, i, &charge); - } - wait_for_charge_manager_refresh(); -} - -static int test_initialization(void) -{ - int i, j; - struct charge_port_info charge; - - /* - * No charge port should be selected until all ports + suppliers - * have reported in with an initial charge. - */ - TEST_ASSERT(active_charge_port == CHARGE_PORT_NONE); - charge.current = 1000; - charge.voltage = 5000; - - /* Initialize all supplier/port pairs, except for the last one */ - for (i = 0; i < CHARGE_SUPPLIER_COUNT; ++i) - for (j = 0; j < board_get_usb_pd_port_count(); ++j) { - if (i == 0) - charge_manager_update_dualrole(j, - CAP_DEDICATED); - if (i == CHARGE_SUPPLIER_COUNT - 1 && - j == board_get_usb_pd_port_count() - 1) - break; - charge_manager_update_charge(i, j, &charge); - } - - /* Verify no active charge port, since all pairs haven't updated */ - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == CHARGE_PORT_NONE); - - /* Update last pair and verify a charge port has been selected */ - charge_manager_update_charge(CHARGE_SUPPLIER_COUNT-1, - board_get_usb_pd_port_count()-1, - &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port != CHARGE_PORT_NONE); - - return EC_SUCCESS; -} - -static int test_safe_mode(void) -{ - int port = 0; - struct charge_port_info charge; - - /* Initialize table to no charge */ - initialize_charge_table(0, 5000, 5000); - - /* - * Set a 2A non-dedicated charger on port 0 and verify that - * it is selected, due to safe mode. - */ - charge_manager_update_dualrole(port, CAP_DUALROLE); - charge.current = 2000; - charge.voltage = 5000; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST2, port, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == port); - TEST_ASSERT(active_charge_limit == 2000); - - /* Verify ceil is ignored, due to safe mode. */ - charge_manager_set_ceil(port, 0, 500); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_limit == 2000); - - /* - * Leave safe mode and verify normal port selection rules go - * into effect. - */ - charge_manager_leave_safe_mode(); - wait_for_charge_manager_refresh(); -#ifdef CONFIG_CHARGE_MANAGER_DRP_CHARGING - TEST_ASSERT(active_charge_port == port); - TEST_ASSERT(active_charge_limit == 500); -#else - TEST_ASSERT(active_charge_port == CHARGE_PORT_NONE); -#endif - - /* For subsequent tests, safe mode is exited. */ - return EC_SUCCESS; -} - -static int test_priority(void) -{ - struct charge_port_info charge; - - /* Initialize table to no charge */ - initialize_charge_table(0, 5000, 5000); - TEST_ASSERT(active_charge_port == CHARGE_PORT_NONE); - - /* - * Set a 1A charge via a high-priority supplier and a 2A charge via - * a low-priority supplier, and verify the HP supplier is chosen. - */ - charge.current = 2000; - charge.voltage = 5000; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST6, 0, &charge); - charge.current = 1000; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST2, 1, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 1); - TEST_ASSERT(active_charge_limit == 1000); - - /* - * Set a higher charge on a LP supplier and verify we still use the - * lower charge. - */ - charge.current = 1500; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST7, 1, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 1); - TEST_ASSERT(active_charge_limit == 1000); - - /* - * Zero our HP charge and verify fallback to next highest priority, - * which happens to be a different port. - */ - charge.current = 0; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST2, 1, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 0); - TEST_ASSERT(active_charge_limit == 2000); - - /* Add a charge at equal priority and verify highest charge selected */ - charge.current = 2500; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST5, 0, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 0); - TEST_ASSERT(active_charge_limit == 2500); - - charge.current = 3000; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST6, 1, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 1); - TEST_ASSERT(active_charge_limit == 3000); - - /* - * Add a charge at equal priority and equal power, verify that the - * active port doesn't change since the first plugged port is - * selected as the tiebreaker. - */ - charge.current = 3000; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST6, 0, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 1); - TEST_ASSERT(active_charge_limit == 3000); - - return EC_SUCCESS; -} - -static int test_charge_ceil(void) -{ - int port; - struct charge_port_info charge; - - /* Initialize table to 1A @ 5V, and verify port + limit */ - initialize_charge_table(1000, 5000, 1000); - TEST_ASSERT(active_charge_port != CHARGE_PORT_NONE); - TEST_ASSERT(active_charge_limit == 1000); - - /* Set a 500mA ceiling, verify port is unchanged */ - port = active_charge_port; - charge_manager_set_ceil(port, 0, 500); - wait_for_charge_manager_refresh(); - TEST_ASSERT(port == active_charge_port); - TEST_ASSERT(active_charge_limit == 500); - - /* Raise the ceiling to 2A, verify limit goes back to 1A */ - charge_manager_set_ceil(port, 0, 2000); - wait_for_charge_manager_refresh(); - TEST_ASSERT(port == active_charge_port); - TEST_ASSERT(active_charge_limit == 1000); - - /* Verify that ceiling is ignored in determining active charge port */ - charge.current = 2000; - charge.voltage = 5000; - charge_manager_update_charge(0, 0, &charge); - charge.current = 2500; - charge_manager_update_charge(0, 1, &charge); - charge_manager_set_ceil(1, 0, 750); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 1); - TEST_ASSERT(active_charge_limit == 750); - - /* Set a secondary lower ceiling and verify it takes effect */ - charge_manager_set_ceil(1, 1, 500); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 1); - TEST_ASSERT(active_charge_limit == 500); - - /* Raise the secondary ceiling and verify the primary takes effect */ - charge_manager_set_ceil(1, 1, 800); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 1); - TEST_ASSERT(active_charge_limit == 750); - - /* Remove the primary celing and verify the secondary takes effect */ - charge_manager_set_ceil(1, 0, CHARGE_CEIL_NONE); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 1); - TEST_ASSERT(active_charge_limit == 800); - - /* Remove all ceilings */ - charge_manager_set_ceil(1, 1, CHARGE_CEIL_NONE); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 1); - TEST_ASSERT(active_charge_limit == 2500); - - /* Verify forced ceil takes effect immediately */ - charge_manager_force_ceil(1, 500); - TEST_ASSERT(active_charge_port == 1); - TEST_ASSERT(active_charge_limit == 500); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 1); - TEST_ASSERT(active_charge_limit == 500); - - return EC_SUCCESS; -} - -static int test_new_power_request(void) -{ - struct charge_port_info charge; - - /* Initialize table to no charge */ - initialize_charge_table(0, 5000, 5000); - /* Clear power requests, and verify they are zero'd */ - clear_new_power_requests(); - wait_for_charge_manager_refresh(); - TEST_ASSERT(new_power_request[0] == 0); - TEST_ASSERT(new_power_request[1] == 0); - - /* Charge from port 1 and verify NPR on port 1 only */ - charge.current = 1000; - charge.voltage = 5000; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST2, 1, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(new_power_request[0] == 0); - TEST_ASSERT(new_power_request[1] == 1); - clear_new_power_requests(); - - /* Reduce port 1 through ceil and verify no NPR */ - charge_manager_set_ceil(1, 0, 500); - wait_for_charge_manager_refresh(); - TEST_ASSERT(new_power_request[0] == 0); - TEST_ASSERT(new_power_request[1] == 0); - clear_new_power_requests(); - - /* Change port 1 voltage and verify NPR on port 1 */ - charge.voltage = 4000; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST2, 1, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(new_power_request[0] == 0); - TEST_ASSERT(new_power_request[1] == 1); - clear_new_power_requests(); - - /* Add low-priority source and verify no NPRs */ - charge_manager_update_charge(CHARGE_SUPPLIER_TEST6, 0, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(new_power_request[0] == 0); - TEST_ASSERT(new_power_request[1] == 0); - clear_new_power_requests(); - - /* - * Add higher-priority source and verify NPR on both ports, - * since we're switching charge ports. - */ - charge_manager_update_charge(CHARGE_SUPPLIER_TEST1, 0, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(new_power_request[0] == 1); - TEST_ASSERT(new_power_request[1] == 1); - clear_new_power_requests(); - - return EC_SUCCESS; -} - -static int test_override(void) -{ - struct charge_port_info charge; - - /* Initialize table to no charge */ - initialize_charge_table(0, 5000, 1000); - - /* - * Set a low-priority supplier on p0 and high-priority on p1, then - * verify that p1 is selected. - */ - charge.current = 500; - charge.voltage = 5000; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST2, 0, &charge); - charge_manager_update_charge(CHARGE_SUPPLIER_TEST1, 1, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 1); - TEST_ASSERT(active_charge_limit == 500); - - /* Set override to p0 and verify p0 is selected */ - charge_manager_set_override(0); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 0); - - /* Remove override and verify p1 is again selected */ - charge_manager_set_override(OVERRIDE_OFF); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 1); - - /* - * Set override again to p0, but set p0 charge to 0, and verify p1 - * is again selected. - */ - charge.current = 0; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST2, 0, &charge); - charge_manager_set_override(0); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 1); - - /* Set non-zero charge on port 0 and verify override was auto-removed */ - charge.current = 250; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST5, 0, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 1); - - /* - * Verify current limit is still selected according to supplier - * priority on the override port. - */ - charge.current = 300; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST2, 0, &charge); - charge_manager_set_override(0); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 0); - TEST_ASSERT(active_charge_limit == 300); - charge.current = 100; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST1, 0, &charge); - charge_manager_set_override(0); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 0); - TEST_ASSERT(active_charge_limit == 100); - - /* - * Verify that a don't charge override request on a dual-role - * port causes a swap to source. - */ - pd_set_role(0, PD_ROLE_SINK); - charge_manager_update_dualrole(0, CAP_DUALROLE); - charge_manager_set_override(OVERRIDE_DONT_CHARGE); - wait_for_charge_manager_refresh(); - TEST_ASSERT(pd_get_power_role(0) == PD_ROLE_SOURCE); - - /* - * Verify that an override request to a dual-role source port - * causes a role swap to sink. - */ - charge_manager_set_override(0); - wait_for_charge_manager_refresh(); - charge.current = 200; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST1, 0, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 0); - TEST_ASSERT(active_charge_limit == 200); - TEST_ASSERT(pd_get_power_role(0) == PD_ROLE_SINK); - - /* Set override to "don't charge", then verify we're not charging */ - charge_manager_set_override(OVERRIDE_DONT_CHARGE); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == CHARGE_PORT_NONE); - TEST_ASSERT(active_charge_limit == 0); - TEST_ASSERT(pd_get_power_role(0) == PD_ROLE_SOURCE); - - /* Update a charge supplier, verify that we still aren't charging */ - charge.current = 200; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST1, 0, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == CHARGE_PORT_NONE); - TEST_ASSERT(active_charge_limit == 0); - TEST_ASSERT(pd_get_power_role(0) == PD_ROLE_SOURCE); - - /* Turn override off, verify that we go back to the correct charge */ - charge_manager_set_override(OVERRIDE_OFF); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 1); - TEST_ASSERT(active_charge_limit == 500); - TEST_ASSERT(pd_get_power_role(0) == PD_ROLE_SOURCE); - - return EC_SUCCESS; -} - -static int test_dual_role(void) -{ - struct charge_port_info charge; - - /* Initialize table to no charge. */ - initialize_charge_table(0, 5000, 1000); - - /* Mark P0 as dual-role and set a charge. */ - charge_manager_update_dualrole(0, CAP_DUALROLE); - charge.current = 500; - charge.voltage = 5000; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST2, 0, &charge); - wait_for_charge_manager_refresh(); -#ifdef CONFIG_CHARGE_MANAGER_DRP_CHARGING - /* Verify we do charge from dual-role port */ - TEST_ASSERT(active_charge_port == 0); - TEST_ASSERT(active_charge_limit == 500); -#else - /* Verify we don't charge from dual-role port */ - TEST_ASSERT(active_charge_port == CHARGE_PORT_NONE); - TEST_ASSERT(active_charge_limit == 0); -#endif - - /* Mark P0 as the override port, verify that we now charge. */ - charge_manager_set_override(0); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 0); - TEST_ASSERT(active_charge_limit == 500); - TEST_ASSERT(pd_get_power_role(0) == PD_ROLE_SINK); - - /* Remove override and verify we go back to previous state */ - charge_manager_set_override(OVERRIDE_OFF); - wait_for_charge_manager_refresh(); -#ifdef CONFIG_CHARGE_MANAGER_DRP_CHARGING - TEST_ASSERT(active_charge_port == 0); - TEST_ASSERT(active_charge_limit == 500); -#else - TEST_ASSERT(active_charge_port == CHARGE_PORT_NONE); - TEST_ASSERT(active_charge_limit == 0); - TEST_ASSERT(pd_get_power_role(0) == PD_ROLE_SOURCE); -#endif - - /* Mark P0 as the override port, verify that we again charge. */ - charge_manager_set_override(0); - charge.current = 550; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST2, 0, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 0); - TEST_ASSERT(active_charge_limit == 550); - TEST_ASSERT(pd_get_power_role(0) == PD_ROLE_SINK); - - /* - * Insert a dual-role charger into P1 and set the override. Verify - * that the override correctly changes. - */ - charge_manager_update_dualrole(1, CAP_DUALROLE); - charge_manager_set_override(1); - charge.current = 500; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST6, 1, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 1); - TEST_ASSERT(active_charge_limit == 500); - TEST_ASSERT(pd_get_power_role(1) == PD_ROLE_SINK); - TEST_ASSERT(pd_get_power_role(0) == PD_ROLE_SOURCE); - - /* Set override back to P0 and verify switch */ - charge_manager_set_override(0); - charge.current = 600; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST2, 0, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 0); - TEST_ASSERT(active_charge_limit == 600); - TEST_ASSERT(pd_get_power_role(0) == PD_ROLE_SINK); - TEST_ASSERT(pd_get_power_role(1) == PD_ROLE_SOURCE); - - /* Insert a dedicated charger and verify override is removed */ - charge.current = 0; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST6, 1, &charge); - wait_for_charge_manager_refresh(); - charge_manager_update_dualrole(1, CAP_DEDICATED); - charge.current = 400; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST6, 1, &charge); - wait_for_charge_manager_refresh(); -#ifdef CONFIG_CHARGE_MANAGER_DRP_CHARGING - TEST_ASSERT(active_charge_port == 0); - TEST_ASSERT(active_charge_limit == 600); -#else - TEST_ASSERT(active_charge_port == 1); - TEST_ASSERT(active_charge_limit == 400); - TEST_ASSERT(pd_get_power_role(0) == PD_ROLE_SOURCE); -#endif - - /* - * Verify the port is handled normally if the dual-role source is - * unplugged and replaced with a dedicated source. - */ - charge_manager_update_dualrole(0, CAP_DEDICATED); - charge.current = 0; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST2, 0, &charge); - charge.current = 500; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST2, 0, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 0); - TEST_ASSERT(active_charge_limit == 500); - - /* - * Test one port connected to dedicated charger and one connected - * to dual-role device. - */ - charge_manager_update_dualrole(0, CAP_DUALROLE); - charge.current = 0; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST2, 0, &charge); - charge.current = 500; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST2, 0, &charge); - charge.current = 200; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST6, 1, &charge); - wait_for_charge_manager_refresh(); -#ifdef CONFIG_CHARGE_MANAGER_DRP_CHARGING - /* Verify we charge from port with higher priority */ - TEST_ASSERT(active_charge_port == 0); - TEST_ASSERT(active_charge_limit == 500); -#else - /* - * Verify that we charge from the dedicated port if a dual-role - * source is also attached. - */ - TEST_ASSERT(active_charge_port == 1); - TEST_ASSERT(active_charge_limit == 200); - TEST_ASSERT(pd_get_power_role(0) == PD_ROLE_SOURCE); -#endif - - return EC_SUCCESS; -} - -static int test_rejected_port(void) -{ - struct charge_port_info charge; - - /* Initialize table to no charge. */ - initialize_charge_table(0, 5000, 1000); - TEST_ASSERT(active_charge_port == CHARGE_PORT_NONE); - - /* Set a charge on P0. */ - charge.current = 500; - charge.voltage = 5000; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST2, 0, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 0); - TEST_ASSERT(active_charge_limit == 500); - - /* Set P0 as rejected, and verify that it doesn't become active. */ - set_charge_port_to_reject(1); - charge.current = 1000; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST1, 1, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 0); - TEST_ASSERT(active_charge_limit == 500); - - /* Don't reject P0, and verify it can become active. */ - set_charge_port_to_reject(CHARGE_PORT_NONE); - charge_manager_update_charge(CHARGE_SUPPLIER_TEST1, 1, &charge); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 1); - TEST_ASSERT(active_charge_limit == 1000); - - return EC_SUCCESS; -} - -static int test_unknown_dualrole_capability(void) -{ - struct charge_port_info charge; - - /* Initialize table to no charge. */ - initialize_charge_table(0, 5000, 2000); - TEST_ASSERT(active_charge_port == CHARGE_PORT_NONE); - - /* Set a charge on P0 with unknown dualrole capability, */ - charge.current = 500; - charge.voltage = 5000; - charge_manager_update_dualrole(0, CAP_UNKNOWN); - charge_manager_update_charge(CHARGE_SUPPLIER_TEST2, 0, &charge); - wait_for_charge_manager_refresh(); -#ifdef CONFIG_CHARGE_MANAGER_DRP_CHARGING - /* Verify we do charge from that port */ - TEST_ASSERT(active_charge_port == 0); - TEST_ASSERT(active_charge_limit == 500); -#else - /* Verify that we don't charge from the port. */ - TEST_ASSERT(active_charge_port == CHARGE_PORT_NONE); -#endif - - /* Toggle to dedicated and verify port becomes active. */ - charge_manager_update_dualrole(0, CAP_DEDICATED); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 0); - - /* Add dualrole charger in port 1 */ - charge.current = 1000; - charge_manager_update_dualrole(1, CAP_DUALROLE); - charge_manager_update_charge(CHARGE_SUPPLIER_TEST2, 1, &charge); - wait_for_charge_manager_refresh(); -#ifdef CONFIG_CHARGE_MANAGER_DRP_CHARGING - TEST_ASSERT(active_charge_port == 1); - TEST_ASSERT(active_charge_limit == 1000); -#else - TEST_ASSERT(active_charge_port == 0); -#endif - - /* Remove charger on port 0 */ - charge.current = 0; - charge_manager_update_dualrole(0, CAP_UNKNOWN); - charge_manager_update_charge(CHARGE_SUPPLIER_TEST2, 0, &charge); - wait_for_charge_manager_refresh(); -#ifdef CONFIG_CHARGE_MANAGER_DRP_CHARGING - TEST_ASSERT(active_charge_port == 1); - TEST_ASSERT(active_charge_limit == 1000); -#else - TEST_ASSERT(active_charge_port == CHARGE_PORT_NONE); -#endif - - /* Set override to charge on port 1 */ - charge_manager_set_override(1); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 1); - - /* - * Toggle port 0 to dedicated, verify that override is still kept - * because there's no charge on the port. - */ - charge_manager_update_dualrole(0, CAP_DEDICATED); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 1); - - /* Insert UNKNOWN capability charger on port 0 */ - charge_manager_update_dualrole(0, CAP_UNKNOWN); - charge.current = 2000; - charge_manager_update_charge(CHARGE_SUPPLIER_TEST2, 0, &charge); - wait_for_charge_manager_refresh(); - wait_for_charge_manager_refresh(); - wait_for_charge_manager_refresh(); -#ifdef CONFIG_CHARGE_MANAGER_DRP_CHARGING - /* Verify override is removed */ - TEST_ASSERT(active_charge_port == 0); - TEST_ASSERT(active_charge_limit == 2000); -#else - /* Verify override is still kept */ - TEST_ASSERT(active_charge_port == 1); -#endif - - /* Toggle to dualrole */ - charge_manager_update_dualrole(0, CAP_DUALROLE); - wait_for_charge_manager_refresh(); -#ifdef CONFIG_CHARGE_MANAGER_DRP_CHARGING - /* Verify no change */ - TEST_ASSERT(active_charge_port == 0); -#else - /* Verify override is still kept */ - TEST_ASSERT(active_charge_port == 1); -#endif - - /* Toggle to dedicated */ - charge_manager_update_dualrole(0, CAP_UNKNOWN); - wait_for_charge_manager_refresh(); -#ifdef CONFIG_CHARGE_MANAGER_DRP_CHARGING - /* Verify no change */ - TEST_ASSERT(active_charge_port == 0); -#else - /* Verify override is still kept */ - TEST_ASSERT(active_charge_port == 1); -#endif - charge_manager_update_dualrole(0, CAP_DEDICATED); - wait_for_charge_manager_refresh(); - TEST_ASSERT(active_charge_port == 0); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_initialization); - RUN_TEST(test_safe_mode); - RUN_TEST(test_priority); - RUN_TEST(test_charge_ceil); - RUN_TEST(test_new_power_request); - RUN_TEST(test_override); - RUN_TEST(test_dual_role); - RUN_TEST(test_rejected_port); - RUN_TEST(test_unknown_dualrole_capability); - - test_print_result(); -} diff --git a/test/charge_manager.tasklist b/test/charge_manager.tasklist deleted file mode 100644 index 1f6f139a63..0000000000 --- a/test/charge_manager.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/charge_manager_drp_charging.tasklist b/test/charge_manager_drp_charging.tasklist deleted file mode 100644 index e39c934e44..0000000000 --- a/test/charge_manager_drp_charging.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2015 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/charge_ramp.c b/test/charge_ramp.c deleted file mode 100644 index 84cac57b8e..0000000000 --- a/test/charge_ramp.c +++ /dev/null @@ -1,526 +0,0 @@ -/* Copyright 2015 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. - * - * Test AC input current ramp. - */ - -#include "charge_manager.h" -#include "charge_ramp.h" -#include "common.h" -#include "console.h" -#include "gpio.h" -#include "hooks.h" -#include "task.h" -#include "test_util.h" -#include "timer.h" -#include "usb_charge.h" -#include "util.h" - -#define TASK_EVENT_OVERCURRENT (1 << 0) - -#define RAMP_STABLE_DELAY (120*SECOND) - -/* - * Time to delay for detecting the charger type. This value follows - * the value in common/charge_ramp.c, but must be less than the real - * CHARGE_DETECT_DELAY so we guarantee we wake up before the ramp - * has started. - */ -#define CHARGE_DETECT_DELAY_TEST (CHARGE_DETECT_DELAY - 100*MSEC) - -static int system_load_current_ma; -static int vbus_low_current_ma = 500; -static int overcurrent_current_ma = 3000; - -static int charge_limit_ma; - -/* Mock functions */ - -__override uint8_t board_get_usb_pd_port_count(void) -{ - return CONFIG_USB_PD_PORT_MAX_COUNT; -} - -/* Override test_mockable implementations in charge_ramp module */ -int chg_ramp_allowed(int port, int supplier) -{ - /* Ramp for TEST4-TEST8 */ - return supplier > CHARGE_SUPPLIER_TEST3; -} - -int chg_ramp_max(int port, int supplier, int sup_curr) -{ - if (supplier == CHARGE_SUPPLIER_TEST7) - return 1600; - else if (supplier == CHARGE_SUPPLIER_TEST8) - return 2400; - else - return 3000; -} - -/* Mock bc12_ports[] array to make linker happy */ -struct bc12_config bc12_ports[0]; - -int charge_is_consuming_full_input_current(void) -{ - return charge_limit_ma <= system_load_current_ma; -} - -int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state) -{ - return MIN(system_load_current_ma, charge_limit_ma) > - vbus_low_current_ma; -} - -void board_set_charge_limit(int port, int supplier, int limit_ma, - int max_ma, int max_mv) -{ - charge_limit_ma = limit_ma; - if (charge_limit_ma > overcurrent_current_ma) - task_set_event(TASK_ID_TEST_RUNNER, TASK_EVENT_OVERCURRENT); -} - -/* Test utilities */ - -static void plug_charger_with_ts(int supplier_type, int port, int min_current, - int vbus_low_current, int overcurrent_current, - timestamp_t reg_time) -{ - vbus_low_current_ma = vbus_low_current; - overcurrent_current_ma = overcurrent_current; - chg_ramp_charge_supplier_change(port, supplier_type, min_current, - reg_time, 0); -} - -static void plug_charger(int supplier_type, int port, int min_current, - int vbus_low_current, int overcurrent_current) -{ - plug_charger_with_ts(supplier_type, port, min_current, - vbus_low_current, overcurrent_current, - get_time()); -} - -static void unplug_charger(void) -{ - chg_ramp_charge_supplier_change(CHARGE_PORT_NONE, CHARGE_SUPPLIER_NONE, - 0, get_time(), 0); -} - -static int unplug_charger_and_check(void) -{ - unplug_charger(); - usleep(CHARGE_DETECT_DELAY_TEST); - return charge_limit_ma == 0; -} - -static int wait_stable_no_overcurrent(void) -{ - return task_wait_event(RAMP_STABLE_DELAY) != TASK_EVENT_OVERCURRENT; -} - -static int is_in_range(int x, int min, int max) -{ - return x >= min && x <= max; -} - -/* Tests */ - -static int test_no_ramp(void) -{ - system_load_current_ma = 3000; - /* A powerful charger, but hey, you're not allowed to ramp! */ - plug_charger(CHARGE_SUPPLIER_TEST1, 0, 500, 3000, 3000); - /* - * NOTE: Since this is currently the first test being run, give the - * charge ramp task enough time to actually transition states and set - * the charge limit. This just needs at least transition to the - * CHG_RAMP_OVERCURRENT_DETECT state. - */ - usleep(CHARGE_DETECT_DELAY_TEST + 200*MSEC); - /* That's right. Start at 500 mA */ - TEST_ASSERT(charge_limit_ma == 500); - TEST_ASSERT(wait_stable_no_overcurrent()); - /* ... and stays at 500 mA */ - TEST_ASSERT(charge_limit_ma == 500); - - TEST_ASSERT(unplug_charger_and_check()); - return EC_SUCCESS; -} - -static int test_full_ramp(void) -{ - system_load_current_ma = 3000; - /* Now you get to ramp with this 3A charger */ - plug_charger(CHARGE_SUPPLIER_TEST4, 0, 500, 3000, 3000); - usleep(CHARGE_DETECT_DELAY_TEST); - /* Start with something around 500 mA */ - TEST_ASSERT(is_in_range(charge_limit_ma, 500, 800)); - TEST_ASSERT(wait_stable_no_overcurrent()); - /* And ramp up to 3A */ - TEST_ASSERT(charge_limit_ma == 3000); - - TEST_ASSERT(unplug_charger_and_check()); - return EC_SUCCESS; -} - -static int test_vbus_dip(void) -{ - system_load_current_ma = 3000; - /* VBUS dips too low right before the charger shuts down */ - plug_charger(CHARGE_SUPPLIER_TEST5, 0, 1000, 1500, 1600); - - TEST_ASSERT(wait_stable_no_overcurrent()); - TEST_ASSERT(is_in_range(charge_limit_ma, 1300, 1500)); - - TEST_ASSERT(unplug_charger_and_check()); - return EC_SUCCESS; -} - -static int test_overcurrent(void) -{ - system_load_current_ma = 3000; - /* Huh...VBUS doesn't dip before the charger shuts down */ - plug_charger(CHARGE_SUPPLIER_TEST6, 0, 500, 3000, 1500); - usleep(CHARGE_DETECT_DELAY_TEST); - /* Ramp starts at 500 mA */ - TEST_ASSERT(is_in_range(charge_limit_ma, 500, 700)); - - while (task_wait_event(RAMP_STABLE_DELAY) == TASK_EVENT_OVERCURRENT) { - /* Charger goes away but comes back after 0.6 seconds */ - unplug_charger(); - usleep(MSEC * 600); - plug_charger(CHARGE_SUPPLIER_TEST6, 0, 500, 3000, 1500); - usleep(CHARGE_DETECT_DELAY_TEST); - /* Ramp restarts at 500 mA */ - TEST_ASSERT(is_in_range(charge_limit_ma, 500, 700)); - } - - TEST_ASSERT(is_in_range(charge_limit_ma, 1300, 1500)); - - TEST_ASSERT(unplug_charger_and_check()); - return EC_SUCCESS; -} - -static int test_switch_outlet(void) -{ - int i; - - system_load_current_ma = 3000; - /* Here's a nice powerful charger */ - plug_charger(CHARGE_SUPPLIER_TEST6, 0, 500, 3000, 3000); - - /* - * Now the user decides to move it to a nearby outlet...actually - * they decide to move it 5 times! - */ - for (i = 0; i < 5; ++i) { - usleep(SECOND * 20); - unplug_charger(); - usleep(SECOND * 1.5); - plug_charger(CHARGE_SUPPLIER_TEST6, 0, 500, 3000, 3000); - usleep(CHARGE_DETECT_DELAY_TEST); - /* Ramp restarts at 500 mA */ - TEST_ASSERT(is_in_range(charge_limit_ma, 500, 700)); - } - - /* Should still ramp up to 3000 mA */ - TEST_ASSERT(wait_stable_no_overcurrent()); - TEST_ASSERT(charge_limit_ma == 3000); - - TEST_ASSERT(unplug_charger_and_check()); - return EC_SUCCESS; -} - -static int test_fast_switch(void) -{ - int i; - - system_load_current_ma = 3000; - plug_charger(CHARGE_SUPPLIER_TEST4, 0, 500, 3000, 3000); - - /* - * Here comes that naughty user again, and this time they are switching - * outlet really quickly. Fortunately this time they only do it twice. - */ - for (i = 0; i < 2; ++i) { - usleep(SECOND * 20); - unplug_charger(); - usleep(600 * MSEC); - plug_charger(CHARGE_SUPPLIER_TEST4, 0, 500, 3000, 3000); - usleep(CHARGE_DETECT_DELAY_TEST); - /* Ramp restarts at 500 mA */ - TEST_ASSERT(is_in_range(charge_limit_ma, 500, 700)); - } - - /* Should still ramp up to 3000 mA */ - TEST_ASSERT(wait_stable_no_overcurrent()); - TEST_ASSERT(charge_limit_ma == 3000); - - TEST_ASSERT(unplug_charger_and_check()); - return EC_SUCCESS; -} - -static int test_overcurrent_after_switch_outlet(void) -{ - system_load_current_ma = 3000; - /* Here's a less powerful charger */ - plug_charger(CHARGE_SUPPLIER_TEST5, 0, 500, 3000, 1500); - usleep(SECOND * 5); - - /* Now the user decides to move it to a nearby outlet */ - unplug_charger(); - usleep(SECOND * 1.5); - plug_charger(CHARGE_SUPPLIER_TEST5, 0, 500, 3000, 1500); - - /* Okay the user is satisified */ - while (task_wait_event(RAMP_STABLE_DELAY) == TASK_EVENT_OVERCURRENT) { - /* Charger goes away but comes back after 0.6 seconds */ - unplug_charger(); - usleep(MSEC * 600); - plug_charger(CHARGE_SUPPLIER_TEST5, 0, 500, 3000, 1500); - usleep(CHARGE_DETECT_DELAY_TEST); - /* Ramp restarts at 500 mA */ - TEST_ASSERT(is_in_range(charge_limit_ma, 500, 700)); - } - - TEST_ASSERT(is_in_range(charge_limit_ma, 1300, 1500)); - - TEST_ASSERT(unplug_charger_and_check()); - return EC_SUCCESS; -} - -static int test_partial_load(void) -{ - /* We have a 3A charger, but we just want 1.5A */ - system_load_current_ma = 1500; - plug_charger(CHARGE_SUPPLIER_TEST4, 0, 500, 3000, 2500); - - /* We should end up with a little bit more than 1.5A */ - TEST_ASSERT(wait_stable_no_overcurrent()); - TEST_ASSERT(is_in_range(charge_limit_ma, 1500, 1600)); - - /* Ok someone just started watching YouTube */ - system_load_current_ma = 2000; - TEST_ASSERT(wait_stable_no_overcurrent()); - TEST_ASSERT(is_in_range(charge_limit_ma, 2000, 2100)); - - /* Somehow the system load increases again */ - system_load_current_ma = 2600; - while (task_wait_event(RAMP_STABLE_DELAY) == TASK_EVENT_OVERCURRENT) { - /* Charger goes away but comes back after 0.6 seconds */ - unplug_charger(); - usleep(MSEC * 600); - plug_charger(CHARGE_SUPPLIER_TEST4, 0, 500, 3000, 2500); - usleep(CHARGE_DETECT_DELAY_TEST); - /* Ramp restarts at 500 mA */ - TEST_ASSERT(is_in_range(charge_limit_ma, 500, 700)); - } - - /* Alright the charger isn't powerful enough, so we'll stop at 2.5A */ - TEST_ASSERT(is_in_range(charge_limit_ma, 2300, 2500)); - - TEST_ASSERT(unplug_charger_and_check()); - return EC_SUCCESS; -} - -static int test_charge_supplier_stable(void) -{ - system_load_current_ma = 3000; - /* The charger says it's of type TEST4 initially */ - plug_charger(CHARGE_SUPPLIER_TEST4, 0, 500, 1500, 1600); - /* - * And then it decides it's actually TEST2 after 0.5 seconds, - * why? Well, this charger is just evil. - */ - usleep(500 * MSEC); - plug_charger(CHARGE_SUPPLIER_TEST2, 0, 3000, 3000, 3000); - /* We should get 3A right away. */ - usleep(SECOND); - TEST_ASSERT(charge_limit_ma == 3000); - - TEST_ASSERT(unplug_charger_and_check()); - return EC_SUCCESS; -} - -static int test_charge_supplier_stable_ramp(void) -{ - system_load_current_ma = 3000; - /* This time we start with a non-ramp charge supplier */ - plug_charger(CHARGE_SUPPLIER_TEST3, 0, 500, 3000, 3000); - /* - * After 0.5 seconds, it's decided that the supplier is actually - * a 1.5A ramp supplier. - */ - usleep(500 * MSEC); - plug_charger(CHARGE_SUPPLIER_TEST5, 0, 500, 1400, 1500); - TEST_ASSERT(wait_stable_no_overcurrent()); - TEST_ASSERT(is_in_range(charge_limit_ma, 1200, 1400)); - - TEST_ASSERT(unplug_charger_and_check()); - return EC_SUCCESS; -} - -static int test_charge_supplier_change(void) -{ - system_load_current_ma = 3000; - /* Start with a 3A ramp charge supplier */ - plug_charger(CHARGE_SUPPLIER_TEST4, 0, 500, 3000, 3000); - TEST_ASSERT(wait_stable_no_overcurrent()); - TEST_ASSERT(charge_limit_ma == 3000); - - /* The charger decides to change type to a 1.5A non-ramp supplier */ - plug_charger(CHARGE_SUPPLIER_TEST1, 0, 1500, 3000, 3000); - usleep(500 * MSEC); - TEST_ASSERT(charge_limit_ma == 1500); - TEST_ASSERT(wait_stable_no_overcurrent()); - TEST_ASSERT(charge_limit_ma == 1500); - - TEST_ASSERT(unplug_charger_and_check()); - return EC_SUCCESS; -} - -static int test_charge_port_change(void) -{ - system_load_current_ma = 3000; - /* Start with a 1.5A ramp charge supplier on port 0 */ - plug_charger(CHARGE_SUPPLIER_TEST5, 0, 500, 1400, 1500); - TEST_ASSERT(wait_stable_no_overcurrent()); - TEST_ASSERT(is_in_range(charge_limit_ma, 1200, 1400)); - - /* Here comes a 2.1A ramp charge supplier on port 1 */ - plug_charger(CHARGE_SUPPLIER_TEST6, 0, 500, 2000, 2100); - TEST_ASSERT(wait_stable_no_overcurrent()); - TEST_ASSERT(is_in_range(charge_limit_ma, 1800, 2000)); - - /* Now we have a 2.5A non-ramp charge supplier on port 0 */ - plug_charger(CHARGE_SUPPLIER_TEST1, 0, 2500, 3000, 3000); - usleep(SECOND); - TEST_ASSERT(charge_limit_ma == 2500); - TEST_ASSERT(wait_stable_no_overcurrent()); - TEST_ASSERT(charge_limit_ma == 2500); - - /* Unplug on port 0 */ - plug_charger(CHARGE_SUPPLIER_TEST6, 0, 500, 2000, 2100); - TEST_ASSERT(wait_stable_no_overcurrent()); - TEST_ASSERT(is_in_range(charge_limit_ma, 1800, 2000)); - - TEST_ASSERT(unplug_charger_and_check()); - return EC_SUCCESS; -} - -static int test_vbus_shift(void) -{ - system_load_current_ma = 3000; - /* - * At first, the charger is able to supply up to 1900 mA before - * the VBUS voltage starts to drop. - */ - plug_charger(CHARGE_SUPPLIER_TEST6, 0, 500, 1900, 2000); - TEST_ASSERT(wait_stable_no_overcurrent()); - TEST_ASSERT(is_in_range(charge_limit_ma, 1700, 1900)); - - /* The charger heats up and VBUS voltage drops by 100mV */ - vbus_low_current_ma = 1800; - TEST_ASSERT(wait_stable_no_overcurrent()); - TEST_ASSERT(is_in_range(charge_limit_ma, 1600, 1800)); - - TEST_ASSERT(unplug_charger_and_check()); - return EC_SUCCESS; -} - -static int test_equal_priority_overcurrent(void) -{ - int overcurrent_count = 0; - timestamp_t oc_time = get_time(); - - system_load_current_ma = 3000; - - /* - * Now we have two charge suppliers of equal priorties plugged into - * port 0 and port 1. If the active one browns out, charge manager - * switches to the other one. - */ - while (1) { - plug_charger_with_ts(CHARGE_SUPPLIER_TEST4, 0, 500, 3000, - 2000, oc_time); - oc_time = get_time(); - oc_time.val += 600 * MSEC; - if (wait_stable_no_overcurrent()) - break; - plug_charger_with_ts(CHARGE_SUPPLIER_TEST4, 1, 500, 3000, - 2000, oc_time); - oc_time = get_time(); - oc_time.val += 600 * MSEC; - if (wait_stable_no_overcurrent()) - break; - if (overcurrent_count++ >= 10) { - /* - * Apparently we are in a loop and can never reach - * stable state. - */ - unplug_charger(); - return EC_ERROR_UNKNOWN; - } - } - - TEST_ASSERT(unplug_charger_and_check()); - return EC_SUCCESS; -} - -static int test_ramp_limit(void) -{ - system_load_current_ma = 3000; - - /* Plug in supplier that is limited to 1.6A */ - plug_charger(CHARGE_SUPPLIER_TEST7, 0, 500, 3000, 3000); - usleep(SECOND); - TEST_ASSERT(is_in_range(charge_limit_ma, 500, 700)); - TEST_ASSERT(wait_stable_no_overcurrent()); - TEST_ASSERT(charge_limit_ma == 1600); - - /* Switch to supplier that is limited to 2.4A */ - plug_charger(CHARGE_SUPPLIER_TEST8, 1, 500, 3000, 3000); - usleep(SECOND); - TEST_ASSERT(is_in_range(charge_limit_ma, 500, 700)); - TEST_ASSERT(wait_stable_no_overcurrent()); - TEST_ASSERT(charge_limit_ma == 2400); - - /* Go back to 1.6A limited, but VBUS goes low before that point */ - plug_charger(CHARGE_SUPPLIER_TEST7, 0, 500, 1200, 1300); - usleep(SECOND); - TEST_ASSERT(is_in_range(charge_limit_ma, 500, 700)); - TEST_ASSERT(wait_stable_no_overcurrent()); - TEST_ASSERT(is_in_range(charge_limit_ma, 1000, 1200)); - - TEST_ASSERT(unplug_charger_and_check()); - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - /* - * If the following test order changes, make sure to add enough time for - * the charge ramp task to make its first transition after plugging in a - * charger. See the comment in test_no_ramp(). - */ - RUN_TEST(test_no_ramp); - RUN_TEST(test_full_ramp); - RUN_TEST(test_vbus_dip); - RUN_TEST(test_overcurrent); - RUN_TEST(test_switch_outlet); - RUN_TEST(test_fast_switch); - RUN_TEST(test_overcurrent_after_switch_outlet); - RUN_TEST(test_partial_load); - RUN_TEST(test_charge_supplier_stable); - RUN_TEST(test_charge_supplier_stable_ramp); - RUN_TEST(test_charge_supplier_change); - RUN_TEST(test_charge_port_change); - RUN_TEST(test_vbus_shift); - RUN_TEST(test_equal_priority_overcurrent); - RUN_TEST(test_ramp_limit); - - test_print_result(); -} diff --git a/test/charge_ramp.tasklist b/test/charge_ramp.tasklist deleted file mode 100644 index 1e18846c75..0000000000 --- a/test/charge_ramp.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2015 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(CHG_RAMP, chg_ramp_task, NULL, SMALLER_TASK_STACK_SIZE) diff --git a/test/compile_time_macros.c b/test/compile_time_macros.c deleted file mode 100644 index 60b3bae7b6..0000000000 --- a/test/compile_time_macros.c +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright 2019 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. - * - * Test compile_time_macros.h - */ - -#include "stdbool.h" -#include "common.h" -#include "test_util.h" - - -static int test_BIT(void) -{ - TEST_EQ(BIT(0), 0x00000001U, "%u"); - TEST_EQ(BIT(25), 0x02000000U, "%u"); - TEST_EQ(BIT(31), 0x80000000U, "%u"); - - return EC_SUCCESS; -} - -static int test_BIT_ULL(void) -{ - TEST_EQ(BIT_ULL(0), 0x0000000000000001ULL, "%Lu"); - TEST_EQ(BIT_ULL(25), 0x0000000002000000ULL, "%Lu"); - TEST_EQ(BIT_ULL(50), 0x0004000000000000ULL, "%Lu"); - TEST_EQ(BIT_ULL(63), 0x8000000000000000ULL, "%Lu"); - - return EC_SUCCESS; -} - -static int test_GENMASK(void) -{ - TEST_EQ(GENMASK(0, 0), 0x00000001U, "%u"); - TEST_EQ(GENMASK(31, 0), 0xFFFFFFFFU, "%u"); - TEST_EQ(GENMASK(4, 4), 0x00000010U, "%u"); - TEST_EQ(GENMASK(4, 0), 0x0000001FU, "%u"); - TEST_EQ(GENMASK(21, 21), 0x00200000U, "%u"); - TEST_EQ(GENMASK(31, 31), 0x80000000U, "%u"); - - return EC_SUCCESS; -} - -static int test_GENMASK_ULL(void) -{ - TEST_EQ(GENMASK_ULL(0, 0), 0x0000000000000001ULL, "%Lu"); - TEST_EQ(GENMASK_ULL(31, 0), 0x00000000FFFFFFFFULL, "%Lu"); - TEST_EQ(GENMASK_ULL(63, 0), 0xFFFFFFFFFFFFFFFFULL, "%Lu"); - TEST_EQ(GENMASK_ULL(4, 4), 0x0000000000000010ULL, "%Lu"); - TEST_EQ(GENMASK_ULL(4, 0), 0x000000000000001FULL, "%Lu"); - TEST_EQ(GENMASK_ULL(21, 21), 0x0000000000200000ULL, "%Lu"); - TEST_EQ(GENMASK_ULL(31, 31), 0x0000000080000000ULL, "%Lu"); - TEST_EQ(GENMASK_ULL(63, 63), 0x8000000000000000ULL, "%Lu"); - TEST_EQ(GENMASK_ULL(62, 60), 0x7000000000000000ULL, "%Lu"); - - return EC_SUCCESS; -} - -test_static int test_IS_ARRAY(void) -{ - int array[5]; - int *pointer = array; - - TEST_EQ(_IS_ARRAY(array), true, "%d"); - TEST_EQ(_IS_ARRAY(pointer), false, "%d"); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_BIT); - RUN_TEST(test_BIT_ULL); - RUN_TEST(test_GENMASK); - RUN_TEST(test_GENMASK_ULL); - RUN_TEST(test_IS_ARRAY); - - test_print_result(); -} diff --git a/test/compile_time_macros.tasklist b/test/compile_time_macros.tasklist deleted file mode 100644 index 5ffe662d01..0000000000 --- a/test/compile_time_macros.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/console_edit.c b/test/console_edit.c deleted file mode 100644 index 8d0721c14e..0000000000 --- a/test/console_edit.c +++ /dev/null @@ -1,295 +0,0 @@ -/* Copyright 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. - * - * Test console editing and history. - */ - -#include "common.h" -#include "console.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -static int cmd_1_call_cnt; -static int cmd_2_call_cnt; - -static int command_test_1(int argc, char **argv) -{ - cmd_1_call_cnt++; - return EC_SUCCESS; -} -DECLARE_CONSOLE_COMMAND(test1, command_test_1, NULL, NULL); - -static int command_test_2(int argc, char **argv) -{ - cmd_2_call_cnt++; - return EC_SUCCESS; -} -DECLARE_CONSOLE_COMMAND(test2, command_test_2, NULL, NULL); - -/*****************************************************************************/ -/* Test utilities */ - -enum arrow_key_t { - ARROW_UP = 0, - ARROW_DOWN, - ARROW_RIGHT, - ARROW_LEFT, -}; - -static void arrow_key(enum arrow_key_t k, int repeat) -{ - static char seq[4] = {0x1B, '[', 0, 0}; - seq[2] = 'A' + k; - while (repeat--) - UART_INJECT(seq); -} - -static void delete_key(void) -{ - UART_INJECT("\x1b[3~"); -} - -static void home_key(void) -{ - UART_INJECT("\x1b[1~"); -} - -static void end_key(void) -{ - UART_INJECT("\x1bOF"); -} - -static void ctrl_key(char c) -{ - static char seq[2] = {0, 0}; - seq[0] = c - '@'; - UART_INJECT(seq); -} - -/* - * Helper function to compare multiline strings. When comparing, CR's are - * ignored. - */ -static int compare_multiline_string(const char *s1, const char *s2) -{ - do { - while (*s1 == '\r') - ++s1; - while (*s2 == '\r') - ++s2; - if (*s1 != *s2) - return 1; - if (*s1 == 0 && *s2 == 0) - break; - ++s1; - ++s2; - } while (1); - - return 0; -} - -/*****************************************************************************/ -/* Tests */ - -static int test_backspace(void) -{ - cmd_1_call_cnt = 0; - UART_INJECT("testx\b1\n"); - msleep(30); - TEST_CHECK(cmd_1_call_cnt == 1); -} - -static int test_insert_char(void) -{ - cmd_1_call_cnt = 0; - UART_INJECT("tet1"); - arrow_key(ARROW_LEFT, 2); - UART_INJECT("s\n"); - msleep(30); - TEST_CHECK(cmd_1_call_cnt == 1); -} - -static int test_delete_char(void) -{ - cmd_1_call_cnt = 0; - UART_INJECT("testt1"); - arrow_key(ARROW_LEFT, 1); - UART_INJECT("\b\n"); - msleep(30); - TEST_CHECK(cmd_1_call_cnt == 1); -} - -static int test_insert_delete_char(void) -{ - cmd_1_call_cnt = 0; - UART_INJECT("txet1"); - arrow_key(ARROW_LEFT, 4); - delete_key(); - arrow_key(ARROW_RIGHT, 1); - UART_INJECT("s\n"); - msleep(30); - TEST_CHECK(cmd_1_call_cnt == 1); -} - -static int test_home_end_key(void) -{ - cmd_1_call_cnt = 0; - UART_INJECT("est"); - home_key(); - UART_INJECT("t"); - end_key(); - UART_INJECT("1\n"); - msleep(30); - TEST_CHECK(cmd_1_call_cnt == 1); -} - -static int test_ctrl_k(void) -{ - cmd_1_call_cnt = 0; - UART_INJECT("test123"); - arrow_key(ARROW_LEFT, 2); - ctrl_key('K'); - UART_INJECT("\n"); - msleep(30); - TEST_CHECK(cmd_1_call_cnt == 1); -} - -static int test_history_up(void) -{ - cmd_1_call_cnt = 0; - UART_INJECT("test1\n"); - msleep(30); - arrow_key(ARROW_UP, 1); - UART_INJECT("\n"); - msleep(30); - TEST_CHECK(cmd_1_call_cnt == 2); -} - -static int test_history_up_up(void) -{ - cmd_1_call_cnt = 0; - cmd_2_call_cnt = 0; - UART_INJECT("test1\n"); - msleep(30); - UART_INJECT("test2\n"); - msleep(30); - arrow_key(ARROW_UP, 2); - UART_INJECT("\n"); - msleep(30); - TEST_CHECK(cmd_1_call_cnt == 2 && cmd_2_call_cnt == 1); -} - -static int test_history_up_up_down(void) -{ - cmd_1_call_cnt = 0; - cmd_2_call_cnt = 0; - UART_INJECT("test1\n"); - msleep(30); - UART_INJECT("test2\n"); - msleep(30); - arrow_key(ARROW_UP, 2); - arrow_key(ARROW_DOWN, 1); - UART_INJECT("\n"); - msleep(30); - TEST_CHECK(cmd_1_call_cnt == 1 && cmd_2_call_cnt == 2); -} - -static int test_history_edit(void) -{ - cmd_1_call_cnt = 0; - cmd_2_call_cnt = 0; - UART_INJECT("test1\n"); - msleep(30); - arrow_key(ARROW_UP, 1); - UART_INJECT("\b2\n"); - msleep(30); - TEST_CHECK(cmd_1_call_cnt == 1 && cmd_2_call_cnt == 1); -} - -static int test_history_stash(void) -{ - cmd_1_call_cnt = 0; - cmd_2_call_cnt = 0; - UART_INJECT("test1\n"); - msleep(30); - UART_INJECT("test"); - arrow_key(ARROW_UP, 1); - arrow_key(ARROW_DOWN, 1); - UART_INJECT("2\n"); - msleep(30); - TEST_CHECK(cmd_1_call_cnt == 1 && cmd_2_call_cnt == 1); -} - -static int test_history_list(void) -{ - const char *exp_output = "history\n" /* Input command */ - "test3\n" /* Output 4 last commands */ - "test4\n" - "test5\n" - "history\n" - "> "; - - UART_INJECT("test1\n"); - UART_INJECT("test2\n"); - UART_INJECT("test3\n"); - UART_INJECT("test4\n"); - UART_INJECT("test5\n"); - msleep(30); - test_capture_console(1); - UART_INJECT("history\n"); - msleep(30); - test_capture_console(0); - TEST_ASSERT(compare_multiline_string(test_get_captured_console(), - exp_output) == 0); - - return EC_SUCCESS; -} - -static int test_output_channel(void) -{ - UART_INJECT("chan save\n"); - msleep(30); - UART_INJECT("chan 0\n"); - msleep(30); - test_capture_console(1); - cprintf(CC_SYSTEM, "shouldn't see this\n"); - cputs(CC_TASK, "shouldn't see this either\n"); - cflush(); - test_capture_console(0); - TEST_ASSERT(compare_multiline_string(test_get_captured_console(), - "") == 0); - UART_INJECT("chan restore\n"); - msleep(30); - test_capture_console(1); - cprintf(CC_SYSTEM, "see me\n"); - cputs(CC_TASK, "me as well\n"); - cflush(); - test_capture_console(0); - TEST_ASSERT(compare_multiline_string(test_get_captured_console(), - "see me\nme as well\n") == 0); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_backspace); - RUN_TEST(test_insert_char); - RUN_TEST(test_delete_char); - RUN_TEST(test_insert_delete_char); - RUN_TEST(test_home_end_key); - RUN_TEST(test_ctrl_k); - RUN_TEST(test_history_up); - RUN_TEST(test_history_up_up); - RUN_TEST(test_history_up_up_down); - RUN_TEST(test_history_edit); - RUN_TEST(test_history_stash); - RUN_TEST(test_history_list); - RUN_TEST(test_output_channel); - - test_print_result(); -} diff --git a/test/console_edit.tasklist b/test/console_edit.tasklist deleted file mode 100644 index da0ab6211a..0000000000 --- a/test/console_edit.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/crc.c b/test/crc.c deleted file mode 100644 index e65be72ace..0000000000 --- a/test/crc.c +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright 2016 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. - * - * Tests crc32 sw implementation. - */ - -#include "common.h" -#include "console.h" -#include "crc.h" -#include "crc8.h" -#include "test_util.h" -#include "util.h" - -// test that static version matches context version -static int test_static_version(void) -{ - uint32_t crc; - const uint32_t input = 0xdeadbeef; - - crc32_ctx_init(&crc); - crc32_ctx_hash32(&crc, input); - - crc32_init(); - crc32_hash32(input); - TEST_ASSERT(crc32_result() == crc32_ctx_result(&crc)); - - crc32_init(); - crc32_hash(&input, sizeof(input)); - TEST_ASSERT(crc32_result() == crc32_ctx_result(&crc)); - - return EC_SUCCESS; -} - -// test that context bytes at a time matches static word at time -static int test_8(void) -{ - uint32_t crc; - const uint32_t input = 0xdeadbeef; - const uint8_t *p = (const uint8_t *) &input; - int i; - - crc32_init(); - crc32_hash32(input); - - crc32_ctx_init(&crc); - for (i = 0; i < sizeof(input); ++i) - crc32_ctx_hash8(&crc, p[i]); - - TEST_ASSERT(crc32_result() == crc32_ctx_result(&crc)); - - return EC_SUCCESS; -} - -// http://www.febooti.com/products/filetweak/members/hash-and-crc/test-vectors/ -static int test_kat0(void) -{ - uint32_t crc; - int i; - const char input[] = "The quick brown fox jumps over the lazy dog"; - - crc32_ctx_init(&crc); - for (i = 0; i < strlen(input); ++i) - crc32_ctx_hash8(&crc, input[i]); - TEST_ASSERT(crc32_ctx_result(&crc) == 0x414fa339); - - crc32_ctx_init(&crc); - crc32_ctx_hash(&crc, input, strlen(input)); - TEST_ASSERT(crc32_ctx_result(&crc) == 0x414fa339); - - return EC_SUCCESS; -} - -static int test_cros_crc8(void) -{ - uint8_t buffer[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 8 }; - - int crc = cros_crc8(buffer, 10); - - /* Verifies polynomial values of 0x07 representing x^8 + x^2 + x + 1 */ - TEST_EQ(crc, 170, "%d"); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_static_version); - RUN_TEST(test_8); - RUN_TEST(test_kat0); - RUN_TEST(test_cros_crc8); - - test_print_result(); -} diff --git a/test/crc.tasklist b/test/crc.tasklist deleted file mode 100644 index f46a2eaa1d..0000000000 --- a/test/crc.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2016 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST diff --git a/test/entropy.c b/test/entropy.c deleted file mode 100644 index fb066a6c5b..0000000000 --- a/test/entropy.c +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright 2017 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. - * - * Tests entropy source. - */ - -#include "console.h" -#include "common.h" -#include "rollback.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" -#include "watchdog.h" - -static int buckets[256]; - -static const int log2_mult = 2; - -/* - * log2 (multiplied by 2). For non-power of 2, this rounds to the closest - * half-integer, otherwise the value is exact. - */ -uint32_t log2(int32_t val) -{ - int val1 = 31 - __builtin_clz(val); - int val2 = 32 - __builtin_clz(val - 1); - - return log2_mult * (val1 + val2)/2; -} - -void run_test(int argc, char **argv) -{ - const int loopcount = 512; - - uint8_t buffer[32]; - timestamp_t t0, t1; - int i, j; - uint32_t entropy; - const int totalcount = loopcount * sizeof(buffer); - const int log2totalcount = log2(totalcount); - - memset(buckets, 0, sizeof(buckets)); - - for (i = 0; i < loopcount; i++) { - t0 = get_time(); - if (!board_get_entropy(buffer, sizeof(buffer))) { - ccprintf("Cannot get entropy\n"); - test_fail(); - return; - } - t1 = get_time(); - if (i == 0) - ccprintf("Got %zd bytes in %" PRId64 " us\n", - sizeof(buffer), t1.val - t0.val); - - for (j = 0; j < sizeof(buffer); j++) - buckets[buffer[j]]++; - - watchdog_reload(); - } - - ccprintf("Total count: %d\n", totalcount); - ccprintf("Buckets: "); - entropy = 0; - for (j = 0; j < 256; j++) { - /* - * Shannon entropy (base 2) is sum of -p[j] * log_2(p[j]). - * p[j] = buckets[j]/totalcount - * -p[j] * log_2(p[j]) - * = -(buckets[j]/totalcount) * log_2(buckets[j]/totalcount) - * = buckets[j] * (log_2(totalcount) - log_2(buckets[j])) - * / totalcount - * Our log2() function is scaled by log2_mult, and we defer the - * division by totalcount until we get the total sum, so we need - * to divide by (log2_mult * totalcount) at the end. - */ - entropy += buckets[j] * (log2totalcount - log2(buckets[j])); - ccprintf("%d;", buckets[j]); - cflush(); - } - ccprintf("\n"); - - ccprintf("Entropy: %u/1000 bits\n", - entropy * 1000 / (log2_mult * totalcount)); - - /* We want at least 2 bits of entropy (out of a maximum of 8) */ - if ((entropy / (log2_mult * totalcount)) >= 2) - test_pass(); - else - test_fail(); -} diff --git a/test/entropy.tasklist b/test/entropy.tasklist deleted file mode 100644 index 80072bb620..0000000000 --- a/test/entropy.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2017 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST diff --git a/test/extpwr_gpio.c b/test/extpwr_gpio.c deleted file mode 100644 index d1f77c9167..0000000000 --- a/test/extpwr_gpio.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright 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. - * - * Test GPIO extpower module. - */ - -#include "common.h" -#include "console.h" -#include "extpower.h" -#include "gpio.h" -#include "hooks.h" -#include "host_command.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -static int ac_hook_count; - -static void set_ac(int val) -{ - gpio_set_level(GPIO_AC_PRESENT, val); - msleep(50); -} - -static void ac_change_hook(void) -{ - ac_hook_count++; -} -DECLARE_HOOK(HOOK_AC_CHANGE, ac_change_hook, HOOK_PRIO_DEFAULT); - -static int test_hook(void) -{ - /* Remove AC for testing */ - set_ac(0); - ac_hook_count = 0; - host_clear_events(0xffffffff); - - set_ac(1); - TEST_ASSERT(ac_hook_count == 1); - TEST_ASSERT(extpower_is_present()); - TEST_ASSERT(host_get_events() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_CONNECTED)); - - set_ac(0); - TEST_ASSERT(ac_hook_count == 2); - TEST_ASSERT(!extpower_is_present()); - TEST_ASSERT(host_get_events() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_DISCONNECTED)); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_hook); - - test_print_result(); -} diff --git a/test/extpwr_gpio.tasklist b/test/extpwr_gpio.tasklist deleted file mode 100644 index da0ab6211a..0000000000 --- a/test/extpwr_gpio.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/fake_battery.c b/test/fake_battery.c deleted file mode 100644 index 4442300572..0000000000 --- a/test/fake_battery.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright 2019 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. - * - * Fake BATTERY module. - */ -#include "battery.h" -#include "common.h" - -int battery_design_voltage(int *voltage) -{ - *voltage = 0; - return 0; -} - -enum battery_present battery_is_present(void) -{ - return BP_NO; -} - -int battery_design_capacity(int *capacity) -{ - *capacity = 0; - return 0; -} - -int battery_full_charge_capacity(int *capacity) -{ - *capacity = 0; - return 0; -} - -int battery_remaining_capacity(int *capacity) -{ - *capacity = 0; - return 0; -} - -int battery_status(int *status) -{ - return EC_ERROR_UNIMPLEMENTED; -} diff --git a/test/fake_usbc.c b/test/fake_usbc.c deleted file mode 100644 index dc631997cf..0000000000 --- a/test/fake_usbc.c +++ /dev/null @@ -1,320 +0,0 @@ -/* Copyright 2019 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. - * - * Test USB Type-C module. - */ -#include "common.h" -#include "usb_tc_sm.h" -#include "usb_pd.h" -#include "usb_pd_tcpm.h" - -__overridable int pd_is_vbus_present(int port) -{ - return 0; -} - -__overridable void pd_request_data_swap(int port) -{} - -__overridable void pd_request_power_swap(int port) -{} - -void pd_request_vconn_swap_off(int port) -{} - -void pd_request_vconn_swap_on(int port) -{} - - -static enum pd_data_role data_role; -__overridable enum pd_data_role pd_get_data_role(int port) -{ - return data_role; -} -__overridable void tc_set_data_role(int port, enum pd_data_role role) -{ - data_role = role; -} - -static enum pd_power_role power_role; -__overridable enum pd_power_role pd_get_power_role(int port) -{ - return power_role; -} -__overridable void tc_set_power_role(int port, enum pd_power_role role) -{ - power_role = role; -} - -__overridable bool pd_get_partner_usb_comm_capable(int port) -{ - return true; -} - -__overridable enum pd_cable_plug tc_get_cable_plug(int port) -{ - return PD_PLUG_FROM_DFP_UFP; -} - -__overridable int pd_get_rev(int port, enum tcpci_msg_type type) -{ - return IS_ENABLED(CONFIG_USB_PD_REV30) ? PD_REV30 : PD_REV20; -} - -int tc_check_vconn_swap(int port) -{ - return 0; -} - -void tc_ctvpd_detected(int port) -{} - -void tc_disc_ident_complete(int port) -{} - -static int attached_snk; -int tc_is_attached_snk(int port) -{ - return attached_snk; -} - -static int attached_src; -int tc_is_attached_src(int port) -{ - return attached_src; -} - -int tc_is_vconn_src(int port) -{ - return 0; -} - -void tc_hard_reset_request(int port) -{} - -void tc_hard_reset_complete(int port) -{} - -void tc_partner_dr_data(int port, int en) -{} - -void tc_partner_dr_power(int port, int en) -{} - -void tc_partner_unconstrainedpower(int port, int en) -{} - -void tc_partner_usb_comm(int port, int en) -{} - -void tc_pd_connection(int port, int en) -{} - -void tc_pr_swap_complete(int port, bool success) -{} - -void tc_prs_snk_src_assert_rp(int port) -{ - attached_snk = 0; - attached_src = 1; -} - -void tc_prs_src_snk_assert_rd(int port) -{ - attached_snk = 1; - attached_src = 0; -} - -void tc_src_power_off(int port) -{} - -void tc_set_timeout(int port, uint64_t timeout) -{} - -__overridable void tc_start_error_recovery(int port) -{} - -__overridable void tc_snk_power_off(int port) -{} - -__overridable void pe_invalidate_explicit_contract(int port) -{ -} - -__overridable enum pd_dual_role_states pd_get_dual_role(int port) -{ - return PD_DRP_TOGGLE_ON; -} - -__overridable void pd_dev_get_rw_hash(int port, uint16_t *dev_id, - uint8_t *rw_hash, uint32_t *current_image) -{ -} - -__overridable int pd_comm_is_enabled(int port) -{ - return 0; -} - -bool pd_get_partner_data_swap_capable(int port) -{ - return true; -} - -bool pd_capable(int port) -{ - return true; -} - -bool pd_waiting_on_partner_src_caps(int port) -{ - return false; -} - -#ifndef CONFIG_TEST_USB_PE_SM -enum idh_ptype get_usb_pd_mux_cable_type(int port) -{ - return IDH_PTYPE_UNDEF; -} - -const uint32_t * const pd_get_src_caps(int port) -{ - return NULL; -} - -void pd_set_src_caps(int port, int cnt, uint32_t *src_caps) -{ -} - -uint8_t pd_get_src_cap_cnt(int port) -{ - return 0; -} -#endif - -#if !defined(CONFIG_USB_DRP_ACC_TRYSRC) && \ - !defined(CONFIG_USB_CTVPD) -int pd_is_connected(int port) -{ - return true; -} - -bool pd_is_disconnected(int port) -{ - return false; -} -#endif /* !CONFIG_USB_DRP_ACC_TRYSRC && !CONFIG_USB_CTVPD */ - -#ifndef CONFIG_USB_DRP_ACC_TRYSRC -__overridable void pd_set_dual_role(int port, enum pd_dual_role_states state) -{ -} - -__overridable enum tcpc_cc_polarity pd_get_polarity(int port) -{ - return POLARITY_CC1; -} - -bool pd_get_vconn_state(int port) -{ - return false; -} - -bool pd_get_partner_dual_role_power(int port) -{ - return false; -} - -uint8_t pd_get_task_state(int port) -{ - return 0; -} - -enum pd_cc_states pd_get_task_cc_state(int port) -{ - return PD_CC_NONE; -} - -bool pd_get_partner_unconstr_power(int port) -{ - return 0; -} - -const char *pd_get_task_state_name(int port) -{ - return NULL; -} -#endif /* CONFIG_USB_DRP_ACC_TRYSRC */ - -void dp_init(int port) -{ -} - -void dp_vdm_acked(int port, int cmd) -{ -} - -void dpm_init(int port) -{ -} - -void dpm_vdm_acked(int port, enum tcpci_msg_type type, int vdo_count, - uint32_t *vdm) -{ -} - -void dpm_vdm_naked(int port, enum tcpci_msg_type type, uint16_t svid, - uint8_t vdm_cmd) -{ -} - -void dpm_set_mode_entry_done(int port) -{ -} - -void dpm_set_mode_exit_request(int port) -{ -} - -void dpm_run(int port) -{ -} - -void dpm_evaluate_sink_fixed_pdo(int port, uint32_t vsafe5v_pdo) -{ -} - -void dpm_add_non_pd_sink(int port) -{ -} - -void dpm_remove_sink(int port) -{ -} - -void dpm_remove_source(int port) -{ -} - -int dpm_get_source_pdo(const uint32_t **src_pdo, const int port) -{ - *src_pdo = pd_src_pdo; - return pd_src_pdo_cnt; -} - -static enum tcpc_rp_value lcl_rp; -__overridable void typec_select_src_current_limit_rp(int port, - enum tcpc_rp_value rp) -{ - lcl_rp = rp; -} -__overridable void typec_select_src_collision_rp(int port, - enum tcpc_rp_value rp) -{ - lcl_rp = rp; -} -__overridable int typec_update_cc(int port) -{ - return EC_SUCCESS; -} diff --git a/test/fan.c b/test/fan.c deleted file mode 100644 index d03aa0213c..0000000000 --- a/test/fan.c +++ /dev/null @@ -1,113 +0,0 @@ -/* Copyright 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. - * - * Test thermal engine. - */ - -#include "common.h" -#include "console.h" -#include "fan.h" -#include "hooks.h" -#include "host_command.h" -#include "printf.h" -#include "temp_sensor.h" -#include "test_util.h" -#include "thermal.h" -#include "timer.h" -#include "util.h" - -#define FAN_RPM(fan) fans[fan].rpm - -/*****************************************************************************/ -/* Tests */ - -void set_thermal_control_enabled(int fan, int enable); - -static int test_fan(void) -{ - /* "actual" fan speed from board/host/fan.c */ - extern int mock_rpm; - - sleep(2); - - /* Fans initialize disabled. */ - TEST_ASSERT(fan_get_rpm_actual(0) == 0); - - set_thermal_control_enabled(0, 1); - - /* - * fan_set_percent_needed() is normally called once a second by the - * thermal task, but we're not using a thermal test in this test so - * we can dink around with the fans without having to wait. The host - * implementation just sets mock_rpm to whatever it's asked for. - */ - - /* Off */ - fan_set_percent_needed(0, 0); - TEST_ASSERT(fan_get_rpm_actual(0) == 0); - fan_set_percent_needed(0, 0); - TEST_ASSERT(fan_get_rpm_actual(0) == 0); - - /* On, but just barely */ - fan_set_percent_needed(0, 1); - TEST_ASSERT(fan_get_rpm_actual(0) == FAN_RPM(0)->rpm_start); - /* fan is above min speed now, so should be set to min */ - fan_set_percent_needed(0, 1); - TEST_ASSERT(fan_get_rpm_actual(0) == FAN_RPM(0)->rpm_min); - - /* Full speed */ - fan_set_percent_needed(0, 100); - TEST_ASSERT(fan_get_rpm_actual(0) == FAN_RPM(0)->rpm_max); - fan_set_percent_needed(0, 100); - TEST_ASSERT(fan_get_rpm_actual(0) == FAN_RPM(0)->rpm_max); - - /* Slow again */ - fan_set_percent_needed(0, 1); - TEST_ASSERT(fan_get_rpm_actual(0) == FAN_RPM(0)->rpm_min); - fan_set_percent_needed(0, 1); - TEST_ASSERT(fan_get_rpm_actual(0) == FAN_RPM(0)->rpm_min); - - /* Off */ - fan_set_percent_needed(0, 0); - TEST_ASSERT(fan_get_rpm_actual(0) == 0); - fan_set_percent_needed(0, 0); - TEST_ASSERT(fan_get_rpm_actual(0) == 0); - - /* On, but just barely */ - fan_set_percent_needed(0, 1); - TEST_ASSERT(fan_get_rpm_actual(0) == FAN_RPM(0)->rpm_start); - /* Force the mock_rpm to be slow, to simulate dragging */ - mock_rpm = FAN_RPM(0)->rpm_min - 105; - /* It should keep trying for the start speed */ - fan_set_percent_needed(0, 1); - TEST_ASSERT(fan_get_rpm_actual(0) == FAN_RPM(0)->rpm_start); - /* But we have to keep forcing the mock_rpm back down */ - mock_rpm = FAN_RPM(0)->rpm_min - 105; - fan_set_percent_needed(0, 1); - TEST_ASSERT(fan_get_rpm_actual(0) == FAN_RPM(0)->rpm_start); - /* Now let it turn just under rpm_min. Should be okay there. */ - mock_rpm = FAN_RPM(0)->rpm_min - 10; - fan_set_percent_needed(0, 1); - TEST_ASSERT(fan_get_rpm_actual(0) == FAN_RPM(0)->rpm_min); - /* Let it go a little faster, still okay */ - mock_rpm = FAN_RPM(0)->rpm_min + 10; - fan_set_percent_needed(0, 1); - TEST_ASSERT(fan_get_rpm_actual(0) == FAN_RPM(0)->rpm_min); - /* But if it drops too low, it should go back to the start speed */ - mock_rpm = FAN_RPM(0)->rpm_min - 105; - fan_set_percent_needed(0, 1); - TEST_ASSERT(fan_get_rpm_actual(0) == FAN_RPM(0)->rpm_start); - /* And then relax */ - fan_set_percent_needed(0, 1); - TEST_ASSERT(fan_get_rpm_actual(0) == FAN_RPM(0)->rpm_min); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - RUN_TEST(test_fan); - - test_print_result(); -} diff --git a/test/fan.tasklist b/test/fan.tasklist deleted file mode 100644 index 25dcf124db..0000000000 --- a/test/fan.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/flash.c b/test/flash.c deleted file mode 100644 index 4f9ca74016..0000000000 --- a/test/flash.c +++ /dev/null @@ -1,507 +0,0 @@ -/* Copyright 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. - */ - -/* Console commands to trigger flash host commands */ - -#include "console.h" -#include "ec_commands.h" -#include "flash.h" -#include "gpio.h" -#include "hooks.h" -#include "host_command.h" -#include "system.h" -#include "task.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -static int mock_wp = -1; - -static int mock_flash_op_fail = EC_SUCCESS; - -const char *testdata = "TestData00000000"; /* 16 bytes excluding NULL end */ - -char flash_recorded_data[128]; - -#define BOOT_WP_MASK TEST_STATE_MASK(TEST_STATE_STEP_2) - -/*****************************************************************************/ -/* Emulator-only mock functions */ -#ifdef EMU_BUILD -static int mock_is_running_img; - -int system_unsafe_to_overwrite(uint32_t offset, uint32_t size) -{ - return mock_is_running_img; -} -#endif - -/*****************************************************************************/ -/* Mock functions */ -void host_send_response(struct host_cmd_handler_args *args) -{ - /* Do nothing */ -} - -int flash_pre_op(void) -{ - return mock_flash_op_fail; -} - -int gpio_get_level(enum gpio_signal signal) -{ - if (mock_wp == -1) - mock_wp = !!(test_get_state() & BOOT_WP_MASK); - -#if defined(CONFIG_WP_ACTIVE_HIGH) - if (signal == GPIO_WP) - return mock_wp; -#else - if (signal == GPIO_WP_L) - return !mock_wp; -#endif - - /* Signal other than write protect. Just return 0. */ - return 0; -} - -/*****************************************************************************/ -/* Test utilities */ - -static void record_flash(int offset, int size) -{ - memcpy(flash_recorded_data, __host_flash + offset, size); -} - -static int verify_flash(int offset, int size) -{ - TEST_ASSERT_ARRAY_EQ(flash_recorded_data, __host_flash + offset, size); - return EC_SUCCESS; -} - -static int verify_write(int offset, int size, const char *data) -{ - int i; - - for (i = 0; i < size; ++i) - if (__host_flash[offset + i] != data[i]) - return EC_ERROR_UNKNOWN; - - return EC_SUCCESS; -} - -static int verify_erase(int offset, int size) -{ - int i; - - for (i = 0; i < size; ++i) - if ((__host_flash[offset + i] & 0xff) != 0xff) - return EC_ERROR_UNKNOWN; - - return EC_SUCCESS; -} - - -#define VERIFY_NO_WRITE(off, sz, d) \ - do { \ - record_flash(off, sz); \ - TEST_ASSERT(host_command_write(off, sz, d) != EC_SUCCESS); \ - TEST_ASSERT(verify_flash(off, sz) == EC_SUCCESS); \ - } while (0) - -#define VERIFY_NO_ERASE(off, sz) \ - do { \ - record_flash(off, sz); \ - TEST_ASSERT(host_command_erase(off, sz) != EC_SUCCESS); \ - TEST_ASSERT(verify_flash(off, sz) == EC_SUCCESS); \ - } while (0) - -#define VERIFY_WRITE(off, sz, d) \ - do { \ - TEST_ASSERT(host_command_write(off, sz, d) == EC_SUCCESS); \ - TEST_ASSERT(verify_write(off, sz, d) == EC_SUCCESS); \ - } while (0) - -#define VERIFY_ERASE(off, sz) \ - do { \ - TEST_ASSERT(host_command_erase(off, sz) == EC_SUCCESS); \ - TEST_ASSERT(verify_erase(off, sz) == EC_SUCCESS); \ - } while (0) - -#define SET_WP_FLAGS(m, f) \ - TEST_ASSERT(host_command_protect(m, ((f) ? m : 0), \ - NULL, NULL, NULL) == EC_RES_SUCCESS) - -#define ASSERT_WP_FLAGS(f) \ - do { \ - uint32_t flags; \ - TEST_ASSERT(host_command_protect(0, 0, &flags, NULL, NULL) == \ - EC_RES_SUCCESS); \ - TEST_ASSERT(flags & (f)); \ - } while (0) - -#define ASSERT_WP_NO_FLAGS(f) \ - do { \ - uint32_t flags; \ - TEST_ASSERT(host_command_protect(0, 0, &flags, NULL, NULL) == \ - EC_RES_SUCCESS); \ - TEST_ASSERT((flags & (f)) == 0); \ - } while (0) - -#define VERIFY_REGION_INFO(r, o, s) \ - do { \ - uint32_t offset, size; \ - TEST_ASSERT(host_command_region_info(r, &offset, &size) == \ - EC_RES_SUCCESS); \ - TEST_ASSERT(offset == (o)); \ - TEST_ASSERT(size == (s)); \ - } while (0) - -int host_command_read(int offset, int size, char *out) -{ - struct ec_params_flash_read params; - - params.offset = offset; - params.size = size; - - return test_send_host_command(EC_CMD_FLASH_READ, 0, ¶ms, - sizeof(params), out, size); -} - -int host_command_write(int offset, int size, const char *data) -{ - uint8_t buf[256]; - struct ec_params_flash_write *params = - (struct ec_params_flash_write *)buf; - - params->offset = offset; - params->size = size; - memcpy(params + 1, data, size); - - return test_send_host_command(EC_CMD_FLASH_WRITE, EC_VER_FLASH_WRITE, - buf, size + sizeof(*params), NULL, 0); -} - -int host_command_erase(int offset, int size) -{ - struct ec_params_flash_write params; - - params.offset = offset; - params.size = size; - - return test_send_host_command(EC_CMD_FLASH_ERASE, 0, ¶ms, - sizeof(params), NULL, 0); -} - -int host_command_protect(uint32_t mask, uint32_t flags, - uint32_t *flags_out, uint32_t *valid_out, - uint32_t *writable_out) -{ - struct ec_params_flash_protect params; - struct ec_response_flash_protect resp; - int res; - - params.mask = mask; - params.flags = flags; - - res = test_send_host_command(EC_CMD_FLASH_PROTECT, 1, ¶ms, - sizeof(params), &resp, sizeof(resp)); - - if (res == EC_RES_SUCCESS) { - if (flags_out) - *flags_out = resp.flags; - if (valid_out) - *valid_out = resp.valid_flags; - if (writable_out) - *writable_out = resp.writable_flags; - } - - return res; -} - -int host_command_region_info(enum ec_flash_region reg, uint32_t *offset, - uint32_t *size) -{ - struct ec_params_flash_region_info params; - struct ec_response_flash_region_info resp; - int res; - - params.region = reg; - - res = test_send_host_command(EC_CMD_FLASH_REGION_INFO, 1, ¶ms, - sizeof(params), &resp, sizeof(resp)); - - *offset = resp.offset; - *size = resp.size; - - return res; -} - -/*****************************************************************************/ -/* Tests */ -static int test_read(void) -{ - char buf[16]; - -#ifdef EMU_BUILD - int i; - /* Fill in some numbers so they are not all 0xff */ - for (i = 0; i < sizeof(buf); ++i) - __host_flash[i] = i * i + i; -#endif - - /* The first few bytes in the flash should always contain some code */ - TEST_ASSERT(!crec_flash_is_erased(0, sizeof(buf))); - - TEST_ASSERT(host_command_read(0, sizeof(buf), buf) == EC_RES_SUCCESS); - TEST_ASSERT_ARRAY_EQ(buf, (char *)CONFIG_PROGRAM_MEMORY_BASE, - sizeof(buf)); - - return EC_SUCCESS; -} - -static int test_is_erased(void) -{ - int i; - -#ifdef EMU_BUILD - memset(__host_flash, 0xff, 1024); - TEST_ASSERT(crec_flash_is_erased(0, 1024)); - - for (i = 0; i < 1024; ++i) { - __host_flash[i] = 0xec; - TEST_ASSERT(!crec_flash_is_erased(0, 1024)); - __host_flash[i] = 0xff; - } -#else - ccprintf("Skip. Emulator only test.\n"); -#endif - - return EC_SUCCESS; -} - -static int test_overwrite_current(void) -{ - uint32_t offset, size; - - /* Test that we cannot overwrite current image */ - if (system_get_image_copy() == EC_IMAGE_RO) { - offset = CONFIG_RO_STORAGE_OFF; - size = CONFIG_RO_SIZE; - } else { - offset = CONFIG_RW_STORAGE_OFF; - size = CONFIG_RW_SIZE; - } - -#ifdef EMU_BUILD - mock_is_running_img = 1; -#endif - - VERIFY_NO_ERASE(offset, strlen(testdata)); - VERIFY_NO_ERASE(offset + size - strlen(testdata), strlen(testdata)); - VERIFY_NO_WRITE(offset, strlen(testdata), testdata); - VERIFY_NO_WRITE(offset + size - strlen(testdata), strlen(testdata), - testdata); - - return EC_SUCCESS; -} - -static int test_overwrite_other(void) -{ - uint32_t offset, size; - - /* Test that we can overwrite the other image */ - if (system_is_in_rw()) { - offset = CONFIG_RO_STORAGE_OFF; - size = CONFIG_RO_SIZE; - } else { - offset = CONFIG_RW_STORAGE_OFF; - size = CONFIG_RW_SIZE; - } - -#ifdef EMU_BUILD - mock_is_running_img = 0; -#endif - - VERIFY_ERASE(offset, strlen(testdata)); - VERIFY_ERASE(offset + size - strlen(testdata), strlen(testdata)); - VERIFY_WRITE(offset, strlen(testdata), testdata); - VERIFY_WRITE(offset + size - strlen(testdata), strlen(testdata), - testdata); - - return EC_SUCCESS; -} - -static int test_op_failure(void) -{ - mock_flash_op_fail = EC_ERROR_UNKNOWN; - VERIFY_NO_WRITE(CONFIG_RO_STORAGE_OFF, sizeof(testdata), testdata); - VERIFY_NO_WRITE(CONFIG_RW_STORAGE_OFF, sizeof(testdata), testdata); - VERIFY_NO_ERASE(CONFIG_RO_STORAGE_OFF, CONFIG_FLASH_ERASE_SIZE); - VERIFY_NO_ERASE(CONFIG_RW_STORAGE_OFF, CONFIG_FLASH_ERASE_SIZE); - mock_flash_op_fail = EC_SUCCESS; - - return EC_SUCCESS; -} - -static int test_flash_info(void) -{ - struct ec_response_flash_info_1 resp; - - TEST_ASSERT(test_send_host_command(EC_CMD_FLASH_INFO, 1, NULL, 0, - &resp, sizeof(resp)) == EC_RES_SUCCESS); - - TEST_CHECK((resp.flash_size == CONFIG_FLASH_SIZE_BYTES) && - (resp.write_block_size == CONFIG_FLASH_WRITE_SIZE) && - (resp.erase_block_size == CONFIG_FLASH_ERASE_SIZE) && - (resp.protect_block_size == CONFIG_FLASH_BANK_SIZE)); -} - -static int test_region_info(void) -{ - VERIFY_REGION_INFO(EC_FLASH_REGION_RO, - CONFIG_EC_PROTECTED_STORAGE_OFF + - CONFIG_RO_STORAGE_OFF, EC_FLASH_REGION_RO_SIZE); - VERIFY_REGION_INFO(EC_FLASH_REGION_ACTIVE, - CONFIG_EC_WRITABLE_STORAGE_OFF + - CONFIG_RW_STORAGE_OFF, - CONFIG_EC_WRITABLE_STORAGE_SIZE); - VERIFY_REGION_INFO(EC_FLASH_REGION_WP_RO, - CONFIG_WP_STORAGE_OFF, CONFIG_WP_STORAGE_SIZE); - VERIFY_REGION_INFO(EC_FLASH_REGION_UPDATE, - CONFIG_EC_WRITABLE_STORAGE_OFF + - CONFIG_RW_STORAGE_OFF, - CONFIG_EC_WRITABLE_STORAGE_SIZE); - - return EC_SUCCESS; -} - -static int test_write_protect(void) -{ - /* Test we can control write protect GPIO */ - mock_wp = 0; - ASSERT_WP_NO_FLAGS(EC_FLASH_PROTECT_GPIO_ASSERTED); - - mock_wp = 1; - ASSERT_WP_FLAGS(EC_FLASH_PROTECT_GPIO_ASSERTED); - - /* Test software WP can be disable if nothing is actually protected */ - SET_WP_FLAGS(EC_FLASH_PROTECT_RO_AT_BOOT, 1); - SET_WP_FLAGS(EC_FLASH_PROTECT_RO_AT_BOOT, 0); - ASSERT_WP_NO_FLAGS(EC_FLASH_PROTECT_RO_AT_BOOT); - - /* Actually protect flash and test software WP cannot be disabled */ - SET_WP_FLAGS(EC_FLASH_PROTECT_RO_AT_BOOT, 1); - SET_WP_FLAGS(EC_FLASH_PROTECT_ALL_NOW, 1); - SET_WP_FLAGS(EC_FLASH_PROTECT_RO_AT_BOOT, 0); - SET_WP_FLAGS(EC_FLASH_PROTECT_ALL_NOW, 0); - ASSERT_WP_FLAGS(EC_FLASH_PROTECT_ALL_NOW | EC_FLASH_PROTECT_RO_AT_BOOT); - - /* Check we cannot erase anything */ - TEST_ASSERT(crec_flash_physical_erase(CONFIG_RO_STORAGE_OFF, - CONFIG_FLASH_ERASE_SIZE) != EC_SUCCESS); - TEST_ASSERT(crec_flash_physical_erase(CONFIG_RW_STORAGE_OFF, - CONFIG_FLASH_ERASE_SIZE) != EC_SUCCESS); - - /* We should not even try to write/erase */ - VERIFY_NO_ERASE(CONFIG_RO_STORAGE_OFF, CONFIG_FLASH_ERASE_SIZE); - VERIFY_NO_ERASE(CONFIG_RW_STORAGE_OFF, CONFIG_FLASH_ERASE_SIZE); - VERIFY_NO_WRITE(CONFIG_RO_STORAGE_OFF, sizeof(testdata), testdata); - VERIFY_NO_WRITE(CONFIG_RW_STORAGE_OFF, sizeof(testdata), testdata); - - return EC_SUCCESS; -} - -static int test_boot_write_protect(void) -{ - /* Check write protect state persists through reboot */ - ASSERT_WP_FLAGS(EC_FLASH_PROTECT_RO_NOW | EC_FLASH_PROTECT_RO_AT_BOOT); - TEST_ASSERT(crec_flash_physical_erase(CONFIG_RO_STORAGE_OFF, - CONFIG_FLASH_ERASE_SIZE) != EC_SUCCESS); - - return EC_SUCCESS; -} - -static int test_boot_no_write_protect(void) -{ - /* Check write protect is not enabled if WP GPIO is deasserted */ - ASSERT_WP_NO_FLAGS(EC_FLASH_PROTECT_RO_NOW); - ASSERT_WP_FLAGS(EC_FLASH_PROTECT_RO_AT_BOOT); - - return EC_SUCCESS; -} - -int test_clean_up_(void) -{ - SET_WP_FLAGS(EC_FLASH_PROTECT_RO_AT_BOOT, 0); - return EC_SUCCESS; -} - -void test_clean_up(void) -{ - test_clean_up_(); /* Throw away return value */ -} - -static void run_test_step1(void) -{ - test_reset(); - mock_wp = 0; - - RUN_TEST(test_read); - RUN_TEST(test_is_erased); - RUN_TEST(test_overwrite_current); - RUN_TEST(test_overwrite_other); - RUN_TEST(test_op_failure); - RUN_TEST(test_flash_info); - RUN_TEST(test_region_info); - RUN_TEST(test_write_protect); - - if (test_get_error_count()) - test_reboot_to_next_step(TEST_STATE_FAILED); - else - test_reboot_to_next_step(TEST_STATE_STEP_2); -} - -static void run_test_step2(void) -{ - RUN_TEST(test_boot_write_protect); - - if (test_get_error_count()) - test_reboot_to_next_step(TEST_STATE_FAILED); - else - test_reboot_to_next_step(TEST_STATE_STEP_3); -} - -static void run_test_step3(void) -{ - RUN_TEST(test_boot_no_write_protect); - - if (test_get_error_count()) - test_reboot_to_next_step(TEST_STATE_FAILED); - else - test_reboot_to_next_step(TEST_STATE_PASSED); -} - -void test_run_step(uint32_t state) -{ - if (state & TEST_STATE_MASK(TEST_STATE_STEP_1)) - run_test_step1(); - else if (state & TEST_STATE_MASK(TEST_STATE_STEP_2)) - run_test_step2(); - else if (state & TEST_STATE_MASK(TEST_STATE_STEP_3)) - run_test_step3(); -} - -int task_test(void *data) -{ - test_run_multistep(); - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - msleep(30); /* Wait for TASK_ID_TEST to initialize */ - task_wake(TASK_ID_TEST); -} diff --git a/test/flash.tasklist b/test/flash.tasklist deleted file mode 100644 index dae84c1635..0000000000 --- a/test/flash.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(TEST, task_test, NULL, TASK_STACK_SIZE) diff --git a/test/flash_physical.c b/test/flash_physical.c deleted file mode 100644 index 06dd495254..0000000000 --- a/test/flash_physical.c +++ /dev/null @@ -1,132 +0,0 @@ -/* Copyright 2020 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 "chip/stm32/flash-regs.h" -#include "flash.h" -#include "panic.h" -#include "test_util.h" - -struct flash_info { - int num_flash_banks; - int write_protect_bank_offset; - int write_protect_bank_count; -}; - -#if defined(CHIP_VARIANT_STM32F412) -struct flash_info flash_info = { - .num_flash_banks = 12, - .write_protect_bank_offset = 0, - .write_protect_bank_count = 5, -}; -#elif defined(CHIP_VARIANT_STM32H7X3) -struct flash_info flash_info = { - .num_flash_banks = 16, - .write_protect_bank_offset = 0, - .write_protect_bank_count = 6, -}; -#else -#error "Flash info not defined for this chip. Please add it." -#endif - - -test_static int test_lock_option_bytes(void) -{ - TEST_EQ(flash_option_bytes_locked(), true, "%d"); - - unlock_flash_option_bytes(); - - TEST_EQ(flash_option_bytes_locked(), false, "%d"); - - lock_flash_option_bytes(); - - TEST_EQ(flash_option_bytes_locked(), true, "%d"); - - unlock_flash_option_bytes(); - - TEST_EQ(flash_option_bytes_locked(), false, "%d"); - - return EC_SUCCESS; -} - -test_static int test_disable_option_bytes(void) -{ - TEST_EQ(flash_option_bytes_locked(), false, "%d"); - - disable_flash_option_bytes(); - - TEST_EQ(flash_option_bytes_locked(), true, "%d"); - - /* Since we've disabled the option bytes we'll get a bus fault. */ - ignore_bus_fault(1); - - unlock_flash_option_bytes(); - - ignore_bus_fault(0); - - /* Option bytes should still be locked. */ - TEST_EQ(flash_option_bytes_locked(), true, "%d"); - - return EC_SUCCESS; -} - -test_static int test_lock_flash_control_register(void) -{ - TEST_EQ(flash_control_register_locked(), true, "%d"); - - unlock_flash_control_register(); - - TEST_EQ(flash_control_register_locked(), false, "%d"); - - lock_flash_control_register(); - - TEST_EQ(flash_control_register_locked(), true, "%d"); - - unlock_flash_control_register(); - - TEST_EQ(flash_control_register_locked(), false, "%d"); - - return EC_SUCCESS; -} - -test_static int test_disable_flash_control_register(void) -{ - TEST_EQ(flash_control_register_locked(), false, "%d"); - - disable_flash_control_register(); - - TEST_EQ(flash_control_register_locked(), true, "%d"); - - /* Since we've disabled the option bytes we'll get a bus fault. */ - ignore_bus_fault(1); - - unlock_flash_control_register(); - - ignore_bus_fault(0); - - /* Control register should still be locked. */ - TEST_EQ(flash_control_register_locked(), true, "%d"); - - return EC_SUCCESS; -} - -test_static int test_flash_config(void) -{ - TEST_EQ(PHYSICAL_BANKS, flash_info.num_flash_banks, "%d"); - TEST_EQ(WP_BANK_OFFSET, flash_info.write_protect_bank_offset, "%d"); - TEST_EQ(WP_BANK_COUNT, flash_info.write_protect_bank_count, "%d"); - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - ccprintf("Running flash physical test\n"); - RUN_TEST(test_flash_config); - - RUN_TEST(test_lock_option_bytes); - RUN_TEST(test_disable_option_bytes); - RUN_TEST(test_lock_flash_control_register); - RUN_TEST(test_disable_flash_control_register); - test_print_result(); -} diff --git a/test/flash_physical.tasklist b/test/flash_physical.tasklist deleted file mode 100644 index 51734f058d..0000000000 --- a/test/flash_physical.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2020 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* no tasks */ diff --git a/test/flash_write_protect.c b/test/flash_write_protect.c deleted file mode 100644 index df20ede3fd..0000000000 --- a/test/flash_write_protect.c +++ /dev/null @@ -1,143 +0,0 @@ -/* Copyright 2020 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 "flash.h" -#include "gpio.h" -#include "string.h" -#include "system.h" -#include "task.h" -#include "test_util.h" - -test_static int check_image_and_hardware_write_protect(void) -{ - int wp; - - if (system_get_image_copy() != EC_IMAGE_RO) { - ccprintf("This test is only works when running RO\n"); - return EC_ERROR_UNKNOWN; - } - -#ifdef CONFIG_WP_ALWAYS - wp = 1; -#elif defined(CONFIG_WP_ACTIVE_HIGH) - wp = gpio_get_level(GPIO_WP); -#else - wp = !gpio_get_level(GPIO_WP_L); -#endif - - if (!wp) { - ccprintf("Hardware write protect (GPIO_WP) must be enabled\n"); - return EC_ERROR_UNKNOWN; - } - - return EC_SUCCESS; -} - -test_static int test_flash_write_protect_enable(void) -{ - int rv; - - TEST_EQ(check_image_and_hardware_write_protect(), EC_SUCCESS, "%d"); - - /* Equivalent of ectool --name=cros_fp flashprotect enable */ - rv = crec_flash_set_protect(EC_FLASH_PROTECT_RO_AT_BOOT, - EC_FLASH_PROTECT_RO_AT_BOOT); - - return rv; -} - -test_static int test_flash_write_protect_disable(void) -{ - int rv; - - TEST_EQ(check_image_and_hardware_write_protect(), EC_SUCCESS, "%d"); - - /* Equivalent of ectool --name=cros_fp flashprotect disable */ - rv = crec_flash_set_protect(EC_FLASH_PROTECT_RO_AT_BOOT, 0); - TEST_NE(rv, EC_SUCCESS, "%d"); - - return EC_SUCCESS; -} - -test_static void run_test_step1(void) -{ - ccprintf("Step 1: Flash write protect test\n"); - RUN_TEST(test_flash_write_protect_enable); - - if (test_get_error_count()) - test_reboot_to_next_step(TEST_STATE_FAILED); - else - test_reboot_to_next_step(TEST_STATE_STEP_2); -} - -test_static void run_test_step2(void) -{ - ccprintf("Step 2: Flash write protect test\n"); - RUN_TEST(test_flash_write_protect_disable); - - if (test_get_error_count()) - test_reboot_to_next_step(TEST_STATE_FAILED); - else if (IS_ENABLED(CONFIG_EEPROM_CBI_WP)) - test_reboot_to_next_step(TEST_STATE_STEP_3); - else - test_reboot_to_next_step(TEST_STATE_PASSED); -} - -#ifdef CONFIG_EEPROM_CBI_WP -test_static int test_cbi_wb_asserted_immediately(void) -{ - int rv; - - TEST_EQ(check_image_and_hardware_write_protect(), EC_SUCCESS, "%d"); - - /* Ensure that EC_CBI_WP is not asserted. */ - TEST_EQ(gpio_get_level(GPIO_EC_CBI_WP), 0, "%d"); - - /* Equivalent of ectool --name=cros_fp flashprotect disable */ - rv = crec_flash_set_protect(EC_FLASH_PROTECT_RO_NOW, 0); - TEST_EQ(rv, EC_SUCCESS, "%d"); - - /* Now make sure EC_CBI_WP is asserted immediately. */ - TEST_EQ(gpio_get_level(GPIO_EC_CBI_WP), 1, "%d"); - - - return EC_SUCCESS; -} - -test_static void run_test_step3(void) -{ - ccprintf("Step 3: Flash write protect test\n"); - RUN_TEST(test_cbi_wb_asserted_immediately); - - if (test_get_error_count()) - test_reboot_to_next_step(TEST_STATE_FAILED); - else - test_reboot_to_next_step(TEST_STATE_PASSED); -} -#endif /* CONFIG_EEPROM_CBI_WP */ - -void test_run_step(uint32_t state) -{ - if (state & TEST_STATE_MASK(TEST_STATE_STEP_1)) - run_test_step1(); - else if (state & TEST_STATE_MASK(TEST_STATE_STEP_2)) - run_test_step2(); -#ifdef CONFIG_EEPROM_CBI_WP - else if (state & TEST_STATE_MASK(TEST_STATE_STEP_3)) - run_test_step3(); -#endif /* CONFIG_EEPROM_CBI_WP */ -} - -int task_test(void *unused) -{ - test_run_multistep(); - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - msleep(30); /* Wait for TASK_ID_TEST to initialize */ - task_wake(TASK_ID_TEST); -} diff --git a/test/flash_write_protect.tasklist b/test/flash_write_protect.tasklist deleted file mode 100644 index 21619decc3..0000000000 --- a/test/flash_write_protect.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2020 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(TEST, task_test, NULL, TASK_STACK_SIZE) diff --git a/test/float.tasklist b/test/float.tasklist deleted file mode 100644 index 9ad0114d8a..0000000000 --- a/test/float.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2018 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/fp.c b/test/fp.c deleted file mode 100644 index 0324da6c8d..0000000000 --- a/test/fp.c +++ /dev/null @@ -1,340 +0,0 @@ -/* Copyright 2018 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. - */ - -/* - * Explicitly include common.h to populate predefined macros in test_config.h - * early. e.g. CONFIG_FPU, which is needed in math_util.h - */ -#include "common.h" - -#include "mat33.h" -#include "mat44.h" -#include "math_util.h" -#include "test_util.h" -#include "vec3.h" - -#if defined(TEST_FP) && !defined(CONFIG_FPU) -#define NORM_TOLERANCE FLOAT_TO_FP(0.01f) -#define NORM_SQUARED_TOLERANCE FLOAT_TO_FP(0.0f) -#define DOT_TOLERANCE FLOAT_TO_FP(0.001f) -#define SCALAR_MUL_TOLERANCE FLOAT_TO_FP(0.005f) -#define EIGENBASIS_TOLERANCE FLOAT_TO_FP(0.03f) -#define LUP_TOLERANCE FLOAT_TO_FP(0.0005f) -#define SOLVE_TOLERANCE FLOAT_TO_FP(0.0005f) -#elif defined(TEST_FLOAT) && defined(CONFIG_FPU) -#define NORM_TOLERANCE FLOAT_TO_FP(0.00001f) -#define NORM_SQUARED_TOLERANCE FLOAT_TO_FP(0.0f) -#define DOT_TOLERANCE FLOAT_TO_FP(0.0f) -#define SCALAR_MUL_TOLERANCE FLOAT_TO_FP(0.005f) -#define EIGENBASIS_TOLERANCE FLOAT_TO_FP(0.02f) -#define LUP_TOLERANCE FLOAT_TO_FP(0.00001f) -#define SOLVE_TOLERANCE FLOAT_TO_FP(0.00001f) -#else -#error "No such test configuration." -#endif - -#define IS_FPV3_VECTOR_EQUAL(a, b, diff) \ - (IS_FP_EQUAL((a)[0], (b)[0], (diff)) && \ - IS_FP_EQUAL((a)[1], (b)[1], (diff)) && \ - IS_FP_EQUAL((a)[2], (b)[2], (diff))) -#define IS_FP_EQUAL(a, b, diff) ((a) >= ((b)-diff) && (a) <= ((b) + diff)) -#define IS_FLOAT_EQUAL(a, b, diff) IS_FP_EQUAL(a, b, diff) - -static int test_fpv3_scalar_mul(void) -{ - const int N = 3; - const float s = 2.0f; - floatv3_t r = {1.0f, 2.0f, 4.0f}; - /* Golden result g = s * r; */ - const floatv3_t g = {2.0f, 4.0f, 8.0f}; - int i; - fpv3_t a; - - for (i = 0; i < N; ++i) - a[i] = FLOAT_TO_FP(r[i]); - - fpv3_scalar_mul(a, FLOAT_TO_FP(s)); - - for (i = 0; i < N; ++i) - TEST_ASSERT(IS_FP_EQUAL(a[i], FLOAT_TO_FP(g[i]), 0)); - - return EC_SUCCESS; -} - -static int test_fpv3_dot(void) -{ - const int N = 3; - int i; - floatv3_t a = {1.8f, 2.12f, 4.12f}; - floatv3_t b = {3.1f, 4.3f, 5.8f}; - /* Golden result g = dot(a, b) */ - float g = 38.592f; - fpv3_t fpa, fpb; - volatile fp_t result; - - for (i = 0; i < N; ++i) { - fpa[i] = FLOAT_TO_FP(a[i]); - fpb[i] = FLOAT_TO_FP(b[i]); - } - - result = fpv3_dot(fpa, fpb); - TEST_ASSERT(IS_FP_EQUAL(result, FLOAT_TO_FP(g), - DOT_TOLERANCE)); - - return EC_SUCCESS; -} - -static int test_fpv3_norm_squared(void) -{ - const int N = 3; - int i; - floatv3_t a = {3.0f, 4.0f, 5.0f}; - /* Golden result g = norm_squared(a) */ - float g = 50.0f; - fpv3_t fpa; - - for (i = 0; i < N; ++i) - fpa[i] = FLOAT_TO_FP(a[i]); - - TEST_ASSERT(IS_FP_EQUAL(fpv3_norm_squared(fpa), FLOAT_TO_FP(g), - NORM_SQUARED_TOLERANCE)); - - return EC_SUCCESS; -} - -static int test_fpv3_norm(void) -{ - const int N = 3; - floatv3_t a = {3.1f, 4.2f, 5.3f}; - /* Golden result g = norm(a) */ - float g = 7.439086f; - int i; - fpv3_t fpa; - volatile fp_t result; - - for (i = 0; i < N; ++i) - fpa[i] = FLOAT_TO_FP(a[i]); - - result = fpv3_norm(fpa); - TEST_ASSERT(IS_FP_EQUAL(result, FLOAT_TO_FP(g), NORM_TOLERANCE)); - return EC_SUCCESS; -} - -static int test_int_sqrtf(void) -{ -#ifndef CONFIG_FPU - TEST_ASSERT(int_sqrtf(0) == 0); - TEST_ASSERT(int_sqrtf(15) == 3); - TEST_ASSERT(int_sqrtf(25) == 5); - TEST_ASSERT(int_sqrtf(1111088889) == 33333); - TEST_ASSERT(int_sqrtf(123456789) == 11111); - TEST_ASSERT(int_sqrtf(1000000000000000005) == 1000000000); - /* Return zero for imaginary numbers */ - TEST_ASSERT(int_sqrtf(-100) == 0); - /* Return INT32_MAX for input greater than INT32_MAX ^ 2 */ - TEST_ASSERT(int_sqrtf(INT64_MAX) == INT32_MAX); -#endif - - return EC_SUCCESS; -} - -static int test_mat33_fp_init_zero(void) -{ - const int N = 3; - int i, j; - mat33_fp_t a; - - for (i = 0; i < N; ++i) - for (j = 0; j < N; ++j) - a[i][j] = FLOAT_TO_FP(55.66f); - - mat33_fp_init_zero(a); - - for (i = 0; i < N; ++i) - for (j = 0; j < N; ++j) - TEST_ASSERT(a[i][j] == FLOAT_TO_FP(0.0f)); - - return EC_SUCCESS; -} - -static int test_mat33_fp_init_diagonal(void) -{ - const int N = 3; - int i, j; - mat33_fp_t a; - fp_t v = FLOAT_TO_FP(-3.45f); - - for (i = 0; i < N; ++i) - for (j = 0; j < N; ++j) - a[i][j] = FLOAT_TO_FP(55.66f); - - mat33_fp_init_diagonal(a, v); - - for (i = 0; i < N; ++i) - for (j = 0; j < N; ++j) { - if (i == j) - TEST_ASSERT(a[i][j] == v); - else - TEST_ASSERT(a[i][j] == FLOAT_TO_FP(0.0f)); - } - - return EC_SUCCESS; -} - -static int test_mat33_fp_scalar_mul(void) -{ - const int N = 3; - float scale = 3.11f; - mat33_float_t a = { - {1.0f, 2.0f, 3.0f}, - {1.1f, 2.2f, 3.3f}, - {0.38f, 13.2f, 88.3f} - }; - /* Golden result g = scalar_mul(a, scale) */ - mat33_float_t g = {{3.11f, 6.22f, 9.33f}, - {3.421f, 6.842f, 10.263f}, - {1.18179988861083984375f, 41.051998138427734375f, - 274.613006591796875f} - }; - int i, j; - mat33_fp_t fpa; - - for (i = 0; i < N; ++i) - for (j = 0; j < N; ++j) - fpa[i][j] = FLOAT_TO_FP(a[i][j]); - - mat33_fp_scalar_mul(fpa, FLOAT_TO_FP(scale)); - - for (i = 0; i < N; ++i) - for (j = 0; j < N; ++j) - TEST_ASSERT(IS_FP_EQUAL(fpa[i][j], FLOAT_TO_FP(g[i][j]), - SCALAR_MUL_TOLERANCE)); - - return EC_SUCCESS; -} - -static int test_mat33_fp_get_eigenbasis(void) -{ - mat33_fp_t s = { - {FLOAT_TO_FP(4.0f), FLOAT_TO_FP(2.0f), FLOAT_TO_FP(2.0f)}, - {FLOAT_TO_FP(2.0f), FLOAT_TO_FP(4.0f), FLOAT_TO_FP(2.0f)}, - {FLOAT_TO_FP(2.0f), FLOAT_TO_FP(2.0f), FLOAT_TO_FP(4.0f)} - }; - fpv3_t e_vals; - mat33_fp_t e_vecs; - int i, j; - - /* Golden result from float version. */ - mat33_fp_t gold_vecs = { - {FLOAT_TO_FP(0.55735206f), FLOAT_TO_FP(0.55735206f), - FLOAT_TO_FP(0.55735206f)}, - {FLOAT_TO_FP(0.70710677f), FLOAT_TO_FP(-0.70710677f), - FLOAT_TO_FP(0.0f)}, - {FLOAT_TO_FP(-0.40824828f), FLOAT_TO_FP(-0.40824828f), - FLOAT_TO_FP(0.81649655f)} - }; - fpv3_t gold_vals = {FLOAT_TO_FP(8.0f), FLOAT_TO_FP(2.0f), - FLOAT_TO_FP(2.0f)}; - - mat33_fp_get_eigenbasis(s, e_vals, e_vecs); - - for (i = 0; i < 3; ++i) { - TEST_ASSERT(IS_FP_EQUAL(gold_vals[i], e_vals[i], - EIGENBASIS_TOLERANCE)); - for (j = 0; j < 3; ++j) { - TEST_ASSERT(IS_FP_EQUAL(gold_vecs[i][j], e_vecs[i][j], - EIGENBASIS_TOLERANCE)); - } - } - - return EC_SUCCESS; -} - -static int test_mat44_fp_decompose_lup(void) -{ - int i, j; - sizev4_t pivot; - mat44_fp_t fpa = { - {FLOAT_TO_FP(11.0f), FLOAT_TO_FP(9.0f), - FLOAT_TO_FP(24.0f), FLOAT_TO_FP(2.0f)}, - {FLOAT_TO_FP(1.0f), FLOAT_TO_FP(5.0f), - FLOAT_TO_FP(2.0f), FLOAT_TO_FP(6.0f)}, - {FLOAT_TO_FP(3.0f), FLOAT_TO_FP(17.0f), - FLOAT_TO_FP(18.0f), FLOAT_TO_FP(1.0f)}, - {FLOAT_TO_FP(2.0f), FLOAT_TO_FP(5.0f), - FLOAT_TO_FP(7.0f), FLOAT_TO_FP(1.0f)} - }; - /* Golden result from float version. */ - mat44_fp_t gold_lu = { - {FLOAT_TO_FP(11.0f), FLOAT_TO_FP(0.8181818f), - FLOAT_TO_FP(2.1818182f), FLOAT_TO_FP(0.18181819f)}, - {FLOAT_TO_FP(3.0f), FLOAT_TO_FP(14.545455f), - FLOAT_TO_FP(0.78749999f), FLOAT_TO_FP(0.031249999f)}, - {FLOAT_TO_FP(1.0f), FLOAT_TO_FP(4.181818f), - FLOAT_TO_FP(-3.4749996f), FLOAT_TO_FP(-1.6366909f)}, - {FLOAT_TO_FP(2.0f), FLOAT_TO_FP(3.3636365f), - FLOAT_TO_FP(-0.012500112f), FLOAT_TO_FP(0.5107912f)} - }; - sizev4_t gold_pivot = {0, 2, 2, 3}; - - mat44_fp_decompose_lup(fpa, pivot); - - for (i = 0; i < 4; ++i) { - TEST_ASSERT(gold_pivot[i] == pivot[i]); - for (j = 0; j < 4; ++j) - TEST_ASSERT(IS_FP_EQUAL(gold_lu[i][j], fpa[i][j], - LUP_TOLERANCE)); - } - - return EC_SUCCESS; -} - -static int test_mat44_fp_solve(void) -{ - int i; - fpv4_t x; - mat44_fp_t A = { - {FLOAT_TO_FP(11.0f), FLOAT_TO_FP(0.8181818f), - FLOAT_TO_FP(2.1818182f), FLOAT_TO_FP(0.18181819f)}, - {FLOAT_TO_FP(3.0f), FLOAT_TO_FP(14.545454), - FLOAT_TO_FP(0.7875f), FLOAT_TO_FP(0.03125f)}, - {FLOAT_TO_FP(1.0f), FLOAT_TO_FP(4.181818f), - FLOAT_TO_FP(-3.4750001f), FLOAT_TO_FP(-1.6366906f)}, - {FLOAT_TO_FP(2.0f), FLOAT_TO_FP(3.3636365f), - FLOAT_TO_FP(-0.012500286f), FLOAT_TO_FP(0.5107909f)} - }; - sizev4_t pivot = {0, 2, 2, 3}; - fpv4_t b = {FLOAT_TO_FP(1.0f), FLOAT_TO_FP(3.3f), FLOAT_TO_FP(0.8f), - FLOAT_TO_FP(8.9f)}; - /* Golden result from float version. */ - fpv4_t gold_x = {FLOAT_TO_FP(-43.507435f), FLOAT_TO_FP(-21.459525f), - FLOAT_TO_FP(26.629248f), FLOAT_TO_FP(16.80776f)}; - - mat44_fp_solve(A, x, b, pivot); - - for (i = 0; i < 4; ++i) - TEST_ASSERT(IS_FP_EQUAL(gold_x[i], x[i], SOLVE_TOLERANCE)); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_fpv3_scalar_mul); - RUN_TEST(test_fpv3_dot); - RUN_TEST(test_fpv3_norm_squared); - RUN_TEST(test_fpv3_norm); - RUN_TEST(test_int_sqrtf); - RUN_TEST(test_mat33_fp_init_zero); - RUN_TEST(test_mat33_fp_init_diagonal); - RUN_TEST(test_mat33_fp_scalar_mul); - RUN_TEST(test_mat33_fp_get_eigenbasis); - RUN_TEST(test_mat44_fp_decompose_lup); - RUN_TEST(test_mat44_fp_solve); - - test_print_result(); -} diff --git a/test/fp.tasklist b/test/fp.tasklist deleted file mode 100644 index 9ad0114d8a..0000000000 --- a/test/fp.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2018 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/fpsensor.c b/test/fpsensor.c deleted file mode 100644 index 1e7015882d..0000000000 --- a/test/fpsensor.c +++ /dev/null @@ -1,120 +0,0 @@ -/* Copyright 2019 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 <stddef.h> -#include <stdbool.h> - -#include "ec_commands.h" -#include "mock/fpsensor_detect_mock.h" -#include "string.h" -#include "test_util.h" -#include "common/fpsensor/fpsensor_private.h" - -static const struct ec_response_get_protocol_info expected_info[] = { - [FP_TRANSPORT_TYPE_SPI] = { - .flags = 1, - .max_response_packet_size = 544, - .max_request_packet_size = 544, - .protocol_versions = 8, - }, - [FP_TRANSPORT_TYPE_UART] = { - .flags = 1, - .max_response_packet_size = 256, - .max_request_packet_size = 544, - .protocol_versions = 8, - } -}; - -test_static int test_validate_fp_buffer_offset_success(void) -{ - TEST_EQ(validate_fp_buffer_offset(1, 0, 1), EC_SUCCESS, "%d"); - return EC_SUCCESS; -} - -test_static int test_validate_fp_buffer_offset_failure_no_overflow(void) -{ - TEST_EQ(validate_fp_buffer_offset(1, 1, 1), EC_ERROR_INVAL, "%d"); - return EC_SUCCESS; -} - -test_static int test_validate_fp_buffer_offset_failure_overflow(void) -{ - TEST_EQ(validate_fp_buffer_offset(1, UINT32_MAX, 1), EC_ERROR_OVERFLOW, - "%d"); - return EC_SUCCESS; -} - -test_static int test_host_command_protocol_info( - enum fp_transport_type transport_type, - const struct ec_response_get_protocol_info *expected) -{ - struct ec_response_get_protocol_info info; - int rv; - - mock_ctrl_fpsensor_detect.get_fp_sensor_type_return = - FP_SENSOR_TYPE_FPC; - mock_ctrl_fpsensor_detect.get_fp_transport_type_return = transport_type; - - rv = test_send_host_command(EC_CMD_GET_PROTOCOL_INFO, 0, NULL, 0, &info, - sizeof(info)); - - TEST_EQ(rv, EC_RES_SUCCESS, "%d"); - - TEST_EQ(info.flags, expected->flags, "%d"); - TEST_EQ(info.max_request_packet_size, expected->max_request_packet_size, - "%d"); - TEST_EQ(info.max_response_packet_size, - expected->max_response_packet_size, "%d"); - TEST_EQ(info.protocol_versions, expected->protocol_versions, "%d"); - - return EC_SUCCESS; -} - -test_static int test_host_command_protocol_info_uart(void) -{ - return test_host_command_protocol_info( - FP_TRANSPORT_TYPE_UART, &expected_info[FP_TRANSPORT_TYPE_UART]); -} - -test_static int test_host_command_protocol_info_spi(void) -{ - return test_host_command_protocol_info( - FP_TRANSPORT_TYPE_SPI, &expected_info[FP_TRANSPORT_TYPE_SPI]); -} - -void run_test(int argc, char **argv) -{ - if (IS_ENABLED(HAS_TASK_FPSENSOR)) { - /* TODO(b/171924356): The "emulator" build only builds RO and - * the functions used in the tests are only in RW, so these - * tests are not run on the emulator. - */ - RUN_TEST(test_validate_fp_buffer_offset_success); - RUN_TEST(test_validate_fp_buffer_offset_failure_no_overflow); - RUN_TEST(test_validate_fp_buffer_offset_failure_overflow); - } - - /* The tests after this only work on device right now. */ - if (IS_ENABLED(EMU_BUILD)) { - test_print_result(); - return; - } - - if (argc < 2) { - ccprintf("usage: runtest [uart|spi]\n"); - test_fail(); - return; - } - - /* The transport type is cached in a static variable, so the tests - * cannot be run back to back (without reboot). - */ - if (strncmp(argv[1], "uart", 4) == 0 && IS_ENABLED(BOARD_BLOONCHIPPER)) - RUN_TEST(test_host_command_protocol_info_uart); - else if (strncmp(argv[1], "spi", 3) == 0) - RUN_TEST(test_host_command_protocol_info_spi); - - test_print_result(); -} diff --git a/test/fpsensor.mocklist b/test/fpsensor.mocklist deleted file mode 100644 index 7e8240bb8d..0000000000 --- a/test/fpsensor.mocklist +++ /dev/null @@ -1,20 +0,0 @@ -/* Copyright 2019 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 BOARD_HOST -#define CONFIG_TEST_MOCK_LIST \ - MOCK(FP_SENSOR) \ - MOCK(FPSENSOR_DETECT) \ - MOCK(FPSENSOR_STATE) \ - MOCK(MKBP_EVENTS) \ - MOCK(ROLLBACK) \ - MOCK(TIMER) -#elif defined(TEST_BUILD) -/* Mock the sensor detection on dragonclaw v0.2 dev boards since we can't - * otherwise change the detected version in hardware without a rework. See - * https://chromium.googlesource.com/chromiumos/platform/ec/+/refs/heads/master/docs/schematics/dragonclaw - */ -#define CONFIG_TEST_MOCK_LIST MOCK(FPSENSOR_DETECT) -#endif /* BOARD_HOST */ diff --git a/test/fpsensor.tasklist b/test/fpsensor.tasklist deleted file mode 100644 index ba137b7613..0000000000 --- a/test/fpsensor.tasklist +++ /dev/null @@ -1,15 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST - -#ifdef BOARD_HOST -#undef CONFIG_TEST_TASK_LIST -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(FPSENSOR, fp_task_simulate, NULL, TASK_STACK_SIZE) -#endif diff --git a/test/fpsensor_crypto.c b/test/fpsensor_crypto.c deleted file mode 100644 index d0fd92cf7c..0000000000 --- a/test/fpsensor_crypto.c +++ /dev/null @@ -1,643 +0,0 @@ -/* Copyright 2020 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 <stdbool.h> - -#include "common.h" -#include "ec_commands.h" -#include "fpsensor_crypto.h" -#include "fpsensor_state.h" -#include "mock/fpsensor_state_mock.h" -#include "mock/rollback_mock.h" -#include "mock/timer_mock.h" -#include "test_util.h" -#include "util.h" - -static const uint8_t fake_positive_match_salt[] = { - 0x04, 0x1f, 0x5a, 0xac, 0x5f, 0x79, 0x10, 0xaf, - 0x04, 0x1d, 0x46, 0x3a, 0x5f, 0x08, 0xee, 0xcb, -}; - -static const uint8_t fake_user_id[] = { - 0x28, 0xb5, 0x5a, 0x55, 0x57, 0x1b, 0x26, 0x88, - 0xce, 0xc5, 0xd1, 0xfe, 0x1d, 0x58, 0x5b, 0x94, - 0x51, 0xa2, 0x60, 0x49, 0x9f, 0xea, 0xb1, 0xea, - 0xf7, 0x04, 0x2f, 0x0b, 0x20, 0xa5, 0x93, 0x64, -}; - -/* - * |expected_positive_match_secret_for_empty_user_id| is obtained by running - * BoringSSL locally. - * From https://boringssl.googlesource.com/boringssl - * commit 365b7a0fcbf273b1fa704d151059e419abd6cfb8 - * - * Steps to reproduce: - * - * Open boringssl/crypto/hkdf/hkdf_test.cc - * Add the following case to static const HKDFTestVector kTests[] - * - * // test positive match secret - * { - * EVP_sha256, - * { - * // IKM: - * // fake_rollback_secret - * [ ***Copy 32 octets of fake_rollback_secret here*** ] - * // fake_tpm_seed - * [ ***Copy 32 octets of fake_tpm_seed here*** ] - * }, 64, - * { - * // fake_positive_match_salt - * [ ***Copy 16 octets of fake_positive_match_salt here*** ] - * }, 16, - * { - * // Info: - * // "positive_match_secret for user " - * 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, - * 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x73, - * 0x65, 0x63, 0x72, 0x65, 0x74, 0x20, 0x66, 0x6f, - * 0x72, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, - * // user_id - * [ ***Type 32 octets of 0x00 here*** ] - * }, 63, - * { // Expected PRK: - * 0xc2, 0xff, 0x50, 0x2d, 0xb1, 0x7e, 0x87, 0xb1, - * 0x25, 0x36, 0x3a, 0x88, 0xe1, 0xdb, 0x4f, 0x98, - * 0x22, 0xb5, 0x66, 0x8c, 0xab, 0xb7, 0xc7, 0x5e, - * 0xd7, 0x56, 0xbe, 0xde, 0x82, 0x3f, 0xd0, 0x62, - * }, 32, - * 32, { // 32 = L = FP_POSITIVE_MATCH_SECRET_BYTES - * // Expected positive match secret: - * [ ***Copy 32 octets of expected positive_match_secret here*** ] - * } - * }, - * - * Then from boringssl/ execute: - * mkdir build - * cd build - * cmake .. - * make - * cd .. - * go run util/all_tests.go - */ -static const uint8_t expected_positive_match_secret_for_empty_user_id[] = { - 0x8d, 0xc4, 0x5b, 0xdf, 0x55, 0x1e, 0xa8, 0x72, - 0xd6, 0xdd, 0xa1, 0x4c, 0xb8, 0xa1, 0x76, 0x2b, - 0xde, 0x38, 0xd5, 0x03, 0xce, 0xe4, 0x74, 0x51, - 0x63, 0x6c, 0x6a, 0x26, 0xa9, 0xb7, 0xfa, 0x68, -}; - -/* - * Same as |expected_positive_match_secret_for_empty_user_id| but use - * |fake_user_id| instead of all-zero user_id. - */ -static const uint8_t expected_positive_match_secret_for_fake_user_id[] = { - 0x0d, 0xf5, 0xac, 0x7c, 0xad, 0x37, 0x0a, 0x66, - 0x2f, 0x71, 0xf6, 0xc6, 0xca, 0x8a, 0x41, 0x69, - 0x8a, 0xd3, 0xcf, 0x0b, 0xc4, 0x5a, 0x5f, 0x4d, - 0x54, 0xeb, 0x7b, 0xad, 0x5d, 0x1b, 0xbe, 0x30, -}; - -static int test_hkdf_expand_raw(const uint8_t *prk, size_t prk_size, - const uint8_t *info, size_t info_size, - const uint8_t *expected_okm, size_t okm_size) -{ - uint8_t actual_okm[okm_size]; - - TEST_ASSERT(hkdf_expand(actual_okm, okm_size, prk, prk_size, - info, info_size) == EC_SUCCESS); - TEST_ASSERT_ARRAY_EQ(expected_okm, actual_okm, okm_size); - return EC_SUCCESS; -} - -test_static int test_hkdf_expand(void) -{ - /* Test vectors in https://tools.ietf.org/html/rfc5869#appendix-A */ - static const uint8_t prk1[] = { - 0x07, 0x77, 0x09, 0x36, 0x2c, 0x2e, 0x32, 0xdf, - 0x0d, 0xdc, 0x3f, 0x0d, 0xc4, 0x7b, 0xba, 0x63, - 0x90, 0xb6, 0xc7, 0x3b, 0xb5, 0x0f, 0x9c, 0x31, - 0x22, 0xec, 0x84, 0x4a, 0xd7, 0xc2, 0xb3, 0xe5, - }; - static const uint8_t info1[] = { - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, - }; - static const uint8_t expected_okm1[] = { - 0x3c, 0xb2, 0x5f, 0x25, 0xfa, 0xac, 0xd5, 0x7a, - 0x90, 0x43, 0x4f, 0x64, 0xd0, 0x36, 0x2f, 0x2a, - 0x2d, 0x2d, 0x0a, 0x90, 0xcf, 0x1a, 0x5a, 0x4c, - 0x5d, 0xb0, 0x2d, 0x56, 0xec, 0xc4, 0xc5, 0xbf, - 0x34, 0x00, 0x72, 0x08, 0xd5, 0xb8, 0x87, 0x18, - 0x58, 0x65, - }; - static const uint8_t prk2[] = { - 0x06, 0xa6, 0xb8, 0x8c, 0x58, 0x53, 0x36, 0x1a, - 0x06, 0x10, 0x4c, 0x9c, 0xeb, 0x35, 0xb4, 0x5c, - 0xef, 0x76, 0x00, 0x14, 0x90, 0x46, 0x71, 0x01, - 0x4a, 0x19, 0x3f, 0x40, 0xc1, 0x5f, 0xc2, 0x44, - }; - static const uint8_t info2[] = { - 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, - 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, - 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, - 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, - 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, - 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, - }; - static const uint8_t expected_okm2[] = { - 0xb1, 0x1e, 0x39, 0x8d, 0xc8, 0x03, 0x27, 0xa1, - 0xc8, 0xe7, 0xf7, 0x8c, 0x59, 0x6a, 0x49, 0x34, - 0x4f, 0x01, 0x2e, 0xda, 0x2d, 0x4e, 0xfa, 0xd8, - 0xa0, 0x50, 0xcc, 0x4c, 0x19, 0xaf, 0xa9, 0x7c, - 0x59, 0x04, 0x5a, 0x99, 0xca, 0xc7, 0x82, 0x72, - 0x71, 0xcb, 0x41, 0xc6, 0x5e, 0x59, 0x0e, 0x09, - 0xda, 0x32, 0x75, 0x60, 0x0c, 0x2f, 0x09, 0xb8, - 0x36, 0x77, 0x93, 0xa9, 0xac, 0xa3, 0xdb, 0x71, - 0xcc, 0x30, 0xc5, 0x81, 0x79, 0xec, 0x3e, 0x87, - 0xc1, 0x4c, 0x01, 0xd5, 0xc1, 0xf3, 0x43, 0x4f, - 0x1d, 0x87, - }; - static const uint8_t prk3[] = { - 0x19, 0xef, 0x24, 0xa3, 0x2c, 0x71, 0x7b, 0x16, - 0x7f, 0x33, 0xa9, 0x1d, 0x6f, 0x64, 0x8b, 0xdf, - 0x96, 0x59, 0x67, 0x76, 0xaf, 0xdb, 0x63, 0x77, - 0xac, 0x43, 0x4c, 0x1c, 0x29, 0x3c, 0xcb, 0x04, - }; - static const uint8_t expected_okm3[] = { - 0x8d, 0xa4, 0xe7, 0x75, 0xa5, 0x63, 0xc1, 0x8f, - 0x71, 0x5f, 0x80, 0x2a, 0x06, 0x3c, 0x5a, 0x31, - 0xb8, 0xa1, 0x1f, 0x5c, 0x5e, 0xe1, 0x87, 0x9e, - 0xc3, 0x45, 0x4e, 0x5f, 0x3c, 0x73, 0x8d, 0x2d, - 0x9d, 0x20, 0x13, 0x95, 0xfa, 0xa4, 0xb6, 0x1a, - 0x96, 0xc8, - }; - static uint8_t unused_output[SHA256_DIGEST_SIZE] = { 0 }; - - TEST_ASSERT(test_hkdf_expand_raw(prk1, sizeof(prk1), info1, - sizeof(info1), expected_okm1, - sizeof(expected_okm1)) - == EC_SUCCESS); - TEST_ASSERT(test_hkdf_expand_raw(prk2, sizeof(prk2), info2, - sizeof(info2), expected_okm2, - sizeof(expected_okm2)) - == EC_SUCCESS); - TEST_ASSERT(test_hkdf_expand_raw(prk3, sizeof(prk3), NULL, 0, - expected_okm3, sizeof(expected_okm3)) - == EC_SUCCESS); - - TEST_ASSERT(hkdf_expand(NULL, sizeof(unused_output), prk1, - sizeof(prk1), info1, sizeof(info1)) - == EC_ERROR_INVAL); - TEST_ASSERT(hkdf_expand(unused_output, sizeof(unused_output), - NULL, sizeof(prk1), info1, sizeof(info1)) - == EC_ERROR_INVAL); - TEST_ASSERT(hkdf_expand(unused_output, sizeof(unused_output), - prk1, sizeof(prk1), NULL, sizeof(info1)) - == EC_ERROR_INVAL); - /* Info size too long. */ - TEST_ASSERT(hkdf_expand(unused_output, sizeof(unused_output), - prk1, sizeof(prk1), info1, 1024) - == EC_ERROR_INVAL); - /* OKM size too big. */ - TEST_ASSERT(hkdf_expand(unused_output, 256 * SHA256_DIGEST_SIZE, - prk1, sizeof(prk1), info1, sizeof(info1)) - == EC_ERROR_INVAL); - return EC_SUCCESS; -} - -test_static int test_derive_encryption_key_failure_seed_not_set(void) -{ - static uint8_t unused_key[SBP_ENC_KEY_LEN]; - static const uint8_t unused_salt[FP_CONTEXT_ENCRYPTION_SALT_BYTES] - = { 0 }; - - /* GIVEN that the TPM seed is not set. */ - if (fp_tpm_seed_is_set()) { - ccprintf("%s:%s(): this test should be executed before setting" - " TPM seed.\n", - __FILE__, __func__); - return -1; - } - - /* THEN derivation will fail. */ - TEST_ASSERT(derive_encryption_key(unused_key, unused_salt) == - EC_ERROR_ACCESS_DENIED); - - return EC_SUCCESS; -} - -static int test_derive_encryption_key_raw(const uint32_t *user_id_, - const uint8_t *salt, - const uint8_t *expected_key) -{ - uint8_t key[SBP_ENC_KEY_LEN]; - int rv; - - /* - * |user_id| is a global variable used as "info" in HKDF expand - * in derive_encryption_key(). - */ - memcpy(user_id, user_id_, sizeof(user_id)); - rv = derive_encryption_key(key, salt); - - TEST_ASSERT(rv == EC_SUCCESS); - TEST_ASSERT_ARRAY_EQ(key, expected_key, sizeof(key)); - - memset(user_id, 0, sizeof(user_id)); - - return EC_SUCCESS; -} - -test_static int test_derive_encryption_key(void) -{ - /* - * These vectors are obtained by choosing the salt and the user_id - * (used as "info" in HKDF), and running boringSSL's HKDF - * (https://boringssl.googlesource.com/boringssl/+/c0b4c72b6d4c6f4828a373ec454bd646390017d4/crypto/hkdf/) - * locally to get the output key. The IKM used in the run is the - * concatenation of |fake_rollback_secret| and |fake_tpm_seed|. - */ - static const uint32_t user_id1[] = { - 0x608b1b0b, 0xe10d3d24, 0x0bbbe4e6, 0x807b36d9, - 0x2a1f8abc, 0xea38104a, 0x562d9431, 0x64d721c5, - }; - - static const uint8_t salt1[] = { - 0xd0, 0x88, 0x34, 0x15, 0xc0, 0xfa, 0x8e, 0x22, - 0x9f, 0xb4, 0xd5, 0xa9, 0xee, 0xd3, 0x15, 0x19, - }; - - static const uint8_t key1[] = { - 0xdb, 0x49, 0x6e, 0x1b, 0x67, 0x8a, 0x35, 0xc6, - 0xa0, 0x9d, 0xb6, 0xa0, 0x13, 0xf4, 0x21, 0xb3, - }; - - static const uint32_t user_id2[] = { - 0x2546a2ca, 0xf1891f7a, 0x44aad8b8, 0x0d6aac74, - 0x6a4ab846, 0x9c279796, 0x5a72eae1, 0x8276d2a3, - }; - - static const uint8_t salt2[] = { - 0x72, 0x6b, 0xc1, 0xe4, 0x64, 0xd4, 0xff, 0xa2, - 0x5a, 0xac, 0x5b, 0x0b, 0x06, 0x67, 0xe1, 0x53, - }; - - static const uint8_t key2[] = { - 0x8d, 0x53, 0xaf, 0x4c, 0x96, 0xa2, 0xee, 0x46, - 0x9c, 0xe2, 0xe2, 0x6f, 0xe6, 0x66, 0x3d, 0x3a, - }; - - /* - * GIVEN that the TPM seed is set, and reading the rollback secret will - * succeed. - */ - TEST_ASSERT(fp_tpm_seed_is_set() && - !mock_ctrl_rollback.get_secret_fail); - - /* THEN the derivation will succeed. */ - TEST_ASSERT(test_derive_encryption_key_raw(user_id1, salt1, key1) == - EC_SUCCESS); - - TEST_ASSERT(test_derive_encryption_key_raw(user_id2, salt2, key2) == - EC_SUCCESS); - - return EC_SUCCESS; -} - -test_static int test_derive_encryption_key_failure_rollback_fail(void) -{ - static uint8_t unused_key[SBP_ENC_KEY_LEN]; - static const uint8_t unused_salt[FP_CONTEXT_ENCRYPTION_SALT_BYTES] - = { 0 }; - - /* GIVEN that reading the rollback secret will fail. */ - mock_ctrl_rollback.get_secret_fail = true; - /* THEN the derivation will fail. */ - TEST_ASSERT(derive_encryption_key(unused_key, unused_salt) == - EC_ERROR_HW_INTERNAL); - - /* GIVEN that reading the rollback secret will succeed. */ - mock_ctrl_rollback.get_secret_fail = false; - /* GIVEN that the TPM seed has been set. */ - TEST_ASSERT(fp_tpm_seed_is_set()); - /* THEN the derivation will succeed. */ - TEST_ASSERT(derive_encryption_key(unused_key, unused_salt) == - EC_SUCCESS); - - return EC_SUCCESS; -} - -test_static int test_derive_positive_match_secret_fail_seed_not_set(void) -{ - static uint8_t output[FP_POSITIVE_MATCH_SECRET_BYTES]; - - /* GIVEN that seed is not set. */ - TEST_ASSERT(!fp_tpm_seed_is_set()); - /* THEN EVEN IF the encryption salt is not trivial. */ - TEST_ASSERT(!bytes_are_trivial(fake_positive_match_salt, - sizeof(fake_positive_match_salt))); - - /* Deriving positive match secret will fail. */ - TEST_ASSERT(derive_positive_match_secret(output, - fake_positive_match_salt) - == EC_ERROR_ACCESS_DENIED); - - return EC_SUCCESS; - -} - -test_static int test_derive_new_pos_match_secret(void) -{ - static uint8_t output[FP_POSITIVE_MATCH_SECRET_BYTES]; - - /* First, for empty user_id. */ - memset(user_id, 0, sizeof(user_id)); - - /* GIVEN that the encryption salt is not trivial. */ - TEST_ASSERT(!bytes_are_trivial(fake_positive_match_salt, - sizeof(fake_positive_match_salt))); - /* - * GIVEN that the TPM seed is set, and reading the rollback secret will - * succeed. - */ - TEST_ASSERT( - fp_tpm_seed_is_set() && !mock_ctrl_rollback.get_secret_fail); - - /* GIVEN that the salt is not trivial. */ - TEST_ASSERT(!bytes_are_trivial(fake_positive_match_salt, - sizeof(fake_positive_match_salt))); - - /* THEN the derivation will succeed. */ - TEST_ASSERT(derive_positive_match_secret(output, - fake_positive_match_salt) - == EC_SUCCESS); - TEST_ASSERT_ARRAY_EQ( - output, - expected_positive_match_secret_for_empty_user_id, - sizeof(expected_positive_match_secret_for_empty_user_id)); - - /* Now change the user_id to be non-trivial. */ - memcpy(user_id, fake_user_id, sizeof(fake_user_id)); - TEST_ASSERT(derive_positive_match_secret(output, - fake_positive_match_salt) - == EC_SUCCESS); - TEST_ASSERT_ARRAY_EQ( - output, - expected_positive_match_secret_for_fake_user_id, - sizeof(expected_positive_match_secret_for_fake_user_id)); - memset(user_id, 0, sizeof(user_id)); - - return EC_SUCCESS; -} - -test_static int test_derive_positive_match_secret_fail_rollback_fail(void) -{ - static uint8_t output[FP_POSITIVE_MATCH_SECRET_BYTES]; - - /* GIVEN that reading secret from anti-rollback block will fail. */ - mock_ctrl_rollback.get_secret_fail = true; - /* THEN EVEN IF the encryption salt is not trivial. */ - TEST_ASSERT(!bytes_are_trivial(fake_positive_match_salt, - sizeof(fake_positive_match_salt))); - - /* Deriving positive match secret will fail. */ - TEST_ASSERT(derive_positive_match_secret(output, - fake_positive_match_salt) - == EC_ERROR_HW_INTERNAL); - mock_ctrl_rollback.get_secret_fail = false; - - return EC_SUCCESS; -} - -test_static int test_derive_positive_match_secret_fail_salt_trivial(void) -{ - static uint8_t output[FP_POSITIVE_MATCH_SECRET_BYTES]; - - /* GIVEN that the salt is trivial. */ - static const uint8_t salt[FP_CONTEXT_ENCRYPTION_SALT_BYTES] = { 0 }; - - /* THEN deriving positive match secret will fail. */ - TEST_ASSERT(derive_positive_match_secret(output, salt) - == EC_ERROR_INVAL); - return EC_SUCCESS; -} - -static int test_enable_positive_match_secret_once( - struct positive_match_secret_state *dumb_state) -{ - const int8_t kIndexToEnable = 0; - timestamp_t now = get_time(); - - TEST_ASSERT(fp_enable_positive_match_secret( - kIndexToEnable, dumb_state) == EC_SUCCESS); - TEST_ASSERT(dumb_state->template_matched == kIndexToEnable); - TEST_ASSERT(dumb_state->readable); - TEST_ASSERT(dumb_state->deadline.val == now.val + (5 * SECOND)); - - return EC_SUCCESS; -} - -test_static int test_enable_positive_match_secret(void) -{ - struct positive_match_secret_state dumb_state = { - .template_matched = FP_NO_SUCH_TEMPLATE, - .readable = false, - .deadline.val = 0, - }; - - TEST_ASSERT(test_enable_positive_match_secret_once(&dumb_state) - == EC_SUCCESS); - - /* Trying to enable again before reading secret should fail. */ - TEST_ASSERT(fp_enable_positive_match_secret(0, &dumb_state) == - EC_ERROR_UNKNOWN); - TEST_ASSERT(dumb_state.template_matched == FP_NO_SUCH_TEMPLATE); - TEST_ASSERT(!dumb_state.readable); - TEST_ASSERT(dumb_state.deadline.val == 0); - - return EC_SUCCESS; -} - -test_static int test_disable_positive_match_secret(void) -{ - struct positive_match_secret_state dumb_state = { - .template_matched = FP_NO_SUCH_TEMPLATE, - .readable = false, - .deadline.val = 0, - }; - - TEST_ASSERT(test_enable_positive_match_secret_once(&dumb_state) - == EC_SUCCESS); - - fp_disable_positive_match_secret(&dumb_state); - TEST_ASSERT(dumb_state.template_matched == FP_NO_SUCH_TEMPLATE); - TEST_ASSERT(!dumb_state.readable); - TEST_ASSERT(dumb_state.deadline.val == 0); - - return EC_SUCCESS; -} - -test_static int test_command_read_match_secret(void) -{ - int rv; - struct ec_params_fp_read_match_secret params; - struct ec_response_fp_read_match_secret resp; - timestamp_t now = get_time(); - - /* For empty user_id. */ - memset(user_id, 0, sizeof(user_id)); - - /* Invalid finger index should be rejected. */ - params.fgr = FP_NO_SUCH_TEMPLATE; - rv = test_send_host_command(EC_CMD_FP_READ_MATCH_SECRET, 0, ¶ms, - sizeof(params), NULL, 0); - TEST_ASSERT(rv == EC_RES_INVALID_PARAM); - params.fgr = FP_MAX_FINGER_COUNT; - rv = test_send_host_command(EC_CMD_FP_READ_MATCH_SECRET, 0, ¶ms, - sizeof(params), NULL, 0); - TEST_ASSERT(rv == EC_RES_INVALID_PARAM); - - memset(&resp, 0, sizeof(resp)); - /* GIVEN that finger index is valid. */ - params.fgr = 0; - - /* GIVEN that positive match secret is enabled. */ - fp_enable_positive_match_secret(params.fgr, - &positive_match_secret_state); - - /* GIVEN that salt is non-trivial. */ - memcpy(fp_positive_match_salt[0], fake_positive_match_salt, - sizeof(fp_positive_match_salt[0])); - /* THEN reading positive match secret should succeed. */ - rv = test_send_host_command(EC_CMD_FP_READ_MATCH_SECRET, 0, ¶ms, - sizeof(params), &resp, sizeof(resp)); - if (rv != EC_RES_SUCCESS) { - ccprintf("%s:%s(): rv = %d\n", __FILE__, __func__, rv); - return -1; - } - /* AND the readable bit should be cleared after the read. */ - TEST_ASSERT(positive_match_secret_state.readable == false); - - TEST_ASSERT_ARRAY_EQ( - resp.positive_match_secret, - expected_positive_match_secret_for_empty_user_id, - sizeof(expected_positive_match_secret_for_empty_user_id)); - - /* - * Now try reading secret again. - * EVEN IF the deadline has not passed. - */ - positive_match_secret_state.deadline.val = now.val + 1 * SECOND; - rv = test_send_host_command(EC_CMD_FP_READ_MATCH_SECRET, 0, ¶ms, - sizeof(params), NULL, 0); - /* - * This time the command should fail because the - * fp_pos_match_secret_readable bit is cleared when the secret was read - * the first time. - */ - TEST_ASSERT(rv == EC_RES_ACCESS_DENIED); - - return EC_SUCCESS; -} - -test_static int test_command_read_match_secret_wrong_finger(void) -{ - int rv; - struct ec_params_fp_read_match_secret params; - - /* GIVEN that the finger is not the matched or enrolled finger. */ - params.fgr = 0; - /* - * GIVEN that positive match secret is enabled for a different - * finger. - */ - fp_enable_positive_match_secret(params.fgr + 1, - &positive_match_secret_state); - - /* Reading secret will fail. */ - rv = test_send_host_command(EC_CMD_FP_READ_MATCH_SECRET, 0, ¶ms, - sizeof(params), NULL, 0); - TEST_ASSERT(rv == EC_RES_ACCESS_DENIED); - return EC_SUCCESS; -} - -test_static int test_command_read_match_secret_timeout(void) -{ - int rv; - struct ec_params_fp_read_match_secret params; - - params.fgr = 0; - /* GIVEN that the read is too late. */ - fp_enable_positive_match_secret(params.fgr, - &positive_match_secret_state); - set_time(positive_match_secret_state.deadline); - - /* EVEN IF encryption salt is non-trivial. */ - memcpy(fp_positive_match_salt[0], fake_positive_match_salt, - sizeof(fp_positive_match_salt[0])); - /* Reading secret will fail. */ - rv = test_send_host_command(EC_CMD_FP_READ_MATCH_SECRET, 0, ¶ms, - sizeof(params), NULL, 0); - TEST_ASSERT(rv == EC_RES_TIMEOUT); - return EC_SUCCESS; -} - -test_static int test_command_read_match_secret_unreadable(void) -{ - int rv; - struct ec_params_fp_read_match_secret params; - - params.fgr = 0; - /* GIVEN that the readable bit is not set. */ - fp_enable_positive_match_secret(params.fgr, - &positive_match_secret_state); - positive_match_secret_state.readable = false; - - /* EVEN IF the finger is just matched. */ - TEST_ASSERT(positive_match_secret_state.template_matched - == params.fgr); - - /* EVEN IF encryption salt is non-trivial. */ - memcpy(fp_positive_match_salt[0], fake_positive_match_salt, - sizeof(fp_positive_match_salt[0])); - /* Reading secret will fail. */ - rv = test_send_host_command(EC_CMD_FP_READ_MATCH_SECRET, 0, ¶ms, - sizeof(params), NULL, 0); - TEST_ASSERT(rv == EC_RES_ACCESS_DENIED); - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - RUN_TEST(test_hkdf_expand); - RUN_TEST(test_derive_encryption_key_failure_seed_not_set); - RUN_TEST(test_derive_positive_match_secret_fail_seed_not_set); - - /* - * Set the TPM seed here because it can only be set once and cannot be - * cleared. - */ - ASSERT(fpsensor_state_mock_set_tpm_seed(default_fake_tpm_seed) == - EC_SUCCESS); - - /* The following test requires TPM seed to be already set. */ - RUN_TEST(test_derive_encryption_key); - RUN_TEST(test_derive_encryption_key_failure_rollback_fail); - RUN_TEST(test_derive_new_pos_match_secret); - RUN_TEST(test_derive_positive_match_secret_fail_rollback_fail); - RUN_TEST(test_derive_positive_match_secret_fail_salt_trivial); - RUN_TEST(test_enable_positive_match_secret); - RUN_TEST(test_disable_positive_match_secret); - RUN_TEST(test_command_read_match_secret); - RUN_TEST(test_command_read_match_secret_wrong_finger); - RUN_TEST(test_command_read_match_secret_timeout); - RUN_TEST(test_command_read_match_secret_unreadable); - test_print_result(); -} diff --git a/test/fpsensor_crypto.mocklist b/test/fpsensor_crypto.mocklist deleted file mode 120000 index 3ab27169be..0000000000 --- a/test/fpsensor_crypto.mocklist +++ /dev/null @@ -1 +0,0 @@ -fpsensor.mocklist
\ No newline at end of file diff --git a/test/fpsensor_crypto.tasklist b/test/fpsensor_crypto.tasklist deleted file mode 120000 index 7886010ad6..0000000000 --- a/test/fpsensor_crypto.tasklist +++ /dev/null @@ -1 +0,0 @@ -fpsensor.tasklist
\ No newline at end of file diff --git a/test/fpsensor_hw.c b/test/fpsensor_hw.c deleted file mode 100644 index 1ca4a9f505..0000000000 --- a/test/fpsensor_hw.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright 2021 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 "common.h" -#include "test_util.h" -#include "fpc_private.h" - -/* Hardware-dependent smoke test that makes a SPI transaction with the - * fingerprint sensor. - */ -test_static int test_fp_check_hwid(void) -{ - /* TODO(b/187134801): modify fpc_check_hwid() to return the hwid. */ - if (IS_ENABLED(SECTION_IS_RW)) - TEST_EQ(fpc_check_hwid(), EC_SUCCESS, "%d"); - - return EC_SUCCESS; -} - - -void run_test(int argc, char **argv) -{ - RUN_TEST(test_fp_check_hwid); - test_print_result(); -} diff --git a/test/fpsensor_hw.tasklist b/test/fpsensor_hw.tasklist deleted file mode 100644 index 299cf25390..0000000000 --- a/test/fpsensor_hw.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2021 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST diff --git a/test/fpsensor_state.c b/test/fpsensor_state.c deleted file mode 100644 index 3822fe49ab..0000000000 --- a/test/fpsensor_state.c +++ /dev/null @@ -1,198 +0,0 @@ -/* Copyright 2020 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 <stdbool.h> - -#include "common.h" -#include "ec_commands.h" -#include "fpsensor_state.h" -#include "mock/fpsensor_state_mock.h" -#include "test_util.h" -#include "util.h" - -test_static int test_fp_enc_status_valid_flags(void) -{ - /* Putting expected value here because test_static should take void */ - const uint32_t expected = FP_ENC_STATUS_SEED_SET; - int rv; - struct ec_response_fp_encryption_status resp = { 0 }; - - rv = test_send_host_command(EC_CMD_FP_ENC_STATUS, 0, NULL, 0, &resp, - sizeof(resp)); - if (rv != EC_RES_SUCCESS) { - ccprintf("%s:%s(): failed to get encryption status. rv = %d\n", - __FILE__, __func__, rv); - return -1; - } - - if (resp.valid_flags != expected) { - ccprintf("%s:%s(): expected valid flags 0x%08x, got 0x%08x\n", - __FILE__, __func__, expected, resp.valid_flags); - return -1; - } - - return EC_RES_SUCCESS; -} - -static int -check_seed_set_result(const int rv, const uint32_t expected, - const struct ec_response_fp_encryption_status *resp) -{ - const uint32_t actual = resp->status & FP_ENC_STATUS_SEED_SET; - - if (rv != EC_RES_SUCCESS || expected != actual) { - ccprintf("%s:%s(): rv = %d, seed is set: %d\n", __FILE__, - __func__, rv, actual); - return -1; - } - - return EC_SUCCESS; -} - -test_static int test_fp_tpm_seed_not_set(void) -{ - int rv; - struct ec_response_fp_encryption_status resp = { 0 }; - - /* Initially the seed should not have been set. */ - rv = test_send_host_command(EC_CMD_FP_ENC_STATUS, 0, NULL, 0, &resp, - sizeof(resp)); - - return check_seed_set_result(rv, 0, &resp); -} - -test_static int test_set_fp_tpm_seed(void) -{ - int rv; - struct ec_params_fp_seed params; - struct ec_response_fp_encryption_status resp = { 0 }; - - params.struct_version = FP_TEMPLATE_FORMAT_VERSION; - memcpy(params.seed, default_fake_tpm_seed, - sizeof(default_fake_tpm_seed)); - - rv = test_send_host_command(EC_CMD_FP_SEED, 0, ¶ms, sizeof(params), - NULL, 0); - if (rv != EC_RES_SUCCESS) { - ccprintf("%s:%s(): rv = %d, set seed failed\n", __FILE__, - __func__, rv); - return -1; - } - - /* Now seed should have been set. */ - rv = test_send_host_command(EC_CMD_FP_ENC_STATUS, 0, NULL, 0, &resp, - sizeof(resp)); - - return check_seed_set_result(rv, FP_ENC_STATUS_SEED_SET, &resp); -} - -test_static int test_set_fp_tpm_seed_again(void) -{ - int rv; - struct ec_params_fp_seed params; - struct ec_response_fp_encryption_status resp = { 0 }; - - TEST_ASSERT(fp_tpm_seed_is_set()); - - params.struct_version = FP_TEMPLATE_FORMAT_VERSION; - memcpy(params.seed, default_fake_tpm_seed, - sizeof(default_fake_tpm_seed)); - - rv = test_send_host_command(EC_CMD_FP_SEED, 0, ¶ms, sizeof(params), - NULL, 0); - if (rv != EC_RES_ACCESS_DENIED) { - ccprintf("%s:%s(): rv = %d, setting seed the second time " - "should result in EC_RES_ACCESS_DENIED but did not.\n", - __FILE__, __func__, rv); - return -1; - } - - /* Now seed should still be set. */ - rv = test_send_host_command(EC_CMD_FP_ENC_STATUS, 0, NULL, 0, &resp, - sizeof(resp)); - - return check_seed_set_result(rv, FP_ENC_STATUS_SEED_SET, &resp); -} - -test_static int test_fp_set_sensor_mode(void) -{ - uint32_t requested_mode = 0; - uint32_t output_mode = 0; - - /* Validate initial conditions */ - TEST_ASSERT(FP_MAX_FINGER_COUNT == 5); - TEST_ASSERT(templ_valid == 0); - TEST_ASSERT(sensor_mode == 0); - - /* GIVEN missing output parameter, THEN get error */ - TEST_ASSERT(fp_set_sensor_mode(0, NULL) == EC_RES_INVALID_PARAM); - /* THEN sensor_mode is unchanged */ - TEST_ASSERT(sensor_mode == 0); - - /* GIVEN requested mode includes FP_MODE_DONT_CHANGE, THEN succeed */ - TEST_ASSERT(sensor_mode == 0); - TEST_ASSERT(output_mode == 0); - requested_mode = FP_MODE_DONT_CHANGE; - TEST_ASSERT(fp_set_sensor_mode(requested_mode, &output_mode) == - EC_RES_SUCCESS); - /* THEN sensor_mode is unchanged */ - TEST_ASSERT(sensor_mode == 0); - /* THEN output_mode matches sensor_mode */ - TEST_ASSERT(output_mode == sensor_mode); - - /* GIVEN request to change to valid sensor mode */ - TEST_ASSERT(sensor_mode == 0); - requested_mode = FP_MODE_ENROLL_SESSION; - /* THEN succeed */ - TEST_ASSERT(fp_set_sensor_mode(requested_mode, &output_mode) == - EC_RES_SUCCESS); - /* THEN requested mode is returned */ - TEST_ASSERT(requested_mode == output_mode); - /* THEN sensor_mode is updated */ - TEST_ASSERT(sensor_mode == requested_mode); - - /* GIVEN max number of fingers already enrolled */ - sensor_mode = 0; - output_mode = 0xdeadbeef; - templ_valid = FP_MAX_FINGER_COUNT; - requested_mode = FP_MODE_ENROLL_SESSION; - /* THEN additional enroll attempt will fail */ - TEST_ASSERT(fp_set_sensor_mode(requested_mode, &output_mode) == - EC_RES_INVALID_PARAM); - /* THEN output parameters is unchanged */ - TEST_ASSERT(output_mode = 0xdeadbeef); - /* THEN sensor_mode is unchanged */ - TEST_ASSERT(sensor_mode == 0); - - return EC_SUCCESS; -} - -test_static int test_fp_set_maintenance_mode(void) -{ - uint32_t output_mode = 0; - - /* GIVEN request to change to maintenance sensor mode */ - TEST_ASSERT(sensor_mode == 0); - /* THEN succeed */ - TEST_ASSERT(fp_set_sensor_mode(FP_MODE_SENSOR_MAINTENANCE, - &output_mode) == EC_RES_SUCCESS); - /* THEN requested mode is returned */ - TEST_ASSERT(output_mode == FP_MODE_SENSOR_MAINTENANCE); - /* THEN sensor_mode is updated */ - TEST_ASSERT(sensor_mode == FP_MODE_SENSOR_MAINTENANCE); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - RUN_TEST(test_fp_enc_status_valid_flags); - RUN_TEST(test_fp_tpm_seed_not_set); - RUN_TEST(test_set_fp_tpm_seed); - RUN_TEST(test_set_fp_tpm_seed_again); - RUN_TEST(test_fp_set_sensor_mode); - RUN_TEST(test_fp_set_maintenance_mode); - test_print_result(); -} diff --git a/test/fpsensor_state.mocklist b/test/fpsensor_state.mocklist deleted file mode 120000 index 3ab27169be..0000000000 --- a/test/fpsensor_state.mocklist +++ /dev/null @@ -1 +0,0 @@ -fpsensor.mocklist
\ No newline at end of file diff --git a/test/fpsensor_state.tasklist b/test/fpsensor_state.tasklist deleted file mode 120000 index 69b4562a97..0000000000 --- a/test/fpsensor_state.tasklist +++ /dev/null @@ -1 +0,0 @@ -./fpsensor.tasklist
\ No newline at end of file diff --git a/test/genvif/.gitignore b/test/genvif/.gitignore deleted file mode 100644 index eabdcbd17f..0000000000 --- a/test/genvif/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -genvif -vif_output diff --git a/test/genvif/Makefile b/test/genvif/Makefile deleted file mode 100644 index 566b6bb042..0000000000 --- a/test/genvif/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2020 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. -# - -CC=gcc -CFLAGS=-O2 -Isrc -I../../include - -genvif: ../../util/genvif.c src/helper.c - @$(CC) -o $@ $^ $(CFLAGS) - -test: genvif - @mkdir vif_output 2>/dev/null - @./genvif -b test -o vif_output - @./genvif -b exp_test -o vif_output -n -v vif/exp_test_vif.xml - @diff vif_output/test_vif.xml vif_output/exp_test_vif.xml - @./genvif -b test_over -o vif_output -v vif/over_test_vif.xml - @./genvif -b exp_test_over -o vif_output -n -v vif/exp_test_over_vif.xml - @diff vif_output/test_over_vif.xml vif_output/exp_test_over_vif.xml - -.PHONY: clean -clean: - @rm -f genvif - @rm -rf vif_output diff --git a/test/genvif/genvif.sh b/test/genvif/genvif.sh deleted file mode 100755 index 4a275ed2c1..0000000000 --- a/test/genvif/genvif.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -e -# Copyright 2020 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. - -cd test/genvif -make clean -make test diff --git a/test/genvif/src/atomic.h b/test/genvif/src/atomic.h deleted file mode 100644 index f2fa112e81..0000000000 --- a/test/genvif/src/atomic.h +++ /dev/null @@ -1,8 +0,0 @@ -/* Copyright 2020 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. - */ - -/* - * Blank shell to avoid including the real file - */ diff --git a/test/genvif/src/board.h b/test/genvif/src/board.h deleted file mode 100644 index 8f175443d0..0000000000 --- a/test/genvif/src/board.h +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2020 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 PD_OPERATING_POWER_MW 15000 -#define PD_MAX_POWER_MW 65000 -#define PD_MAX_CURRENT_MA 3250 -#define PD_MAX_VOLTAGE_MV 20000 diff --git a/test/genvif/src/config_chip.h b/test/genvif/src/config_chip.h deleted file mode 100644 index f2fa112e81..0000000000 --- a/test/genvif/src/config_chip.h +++ /dev/null @@ -1,8 +0,0 @@ -/* Copyright 2020 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. - */ - -/* - * Blank shell to avoid including the real file - */ diff --git a/test/genvif/src/fuzz_config.h b/test/genvif/src/fuzz_config.h deleted file mode 100644 index f2fa112e81..0000000000 --- a/test/genvif/src/fuzz_config.h +++ /dev/null @@ -1,8 +0,0 @@ -/* Copyright 2020 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. - */ - -/* - * Blank shell to avoid including the real file - */ diff --git a/test/genvif/src/helper.c b/test/genvif/src/helper.c deleted file mode 100644 index d604e63cfa..0000000000 --- a/test/genvif/src/helper.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright 2020 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 "common.h" -#include "usb_pd.h" - -#ifndef CONFIG_USB_PD_CUSTOM_PDO -#define PDO_FIXED_FLAGS (PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP |\ - PDO_FIXED_COMM_CAP) - -const uint32_t pd_src_pdo[] = { - PDO_FIXED(5000, 1500, PDO_FIXED_FLAGS), -}; -const int pd_src_pdo_cnt = ARRAY_SIZE(pd_src_pdo); -const uint32_t pd_src_pdo_max[] = { - PDO_FIXED(5000, 3000, PDO_FIXED_FLAGS), -}; -const int pd_src_pdo_max_cnt = ARRAY_SIZE(pd_src_pdo_max); - -const uint32_t pd_snk_pdo[] = { - PDO_FIXED(5000, 500, PDO_FIXED_FLAGS), - PDO_BATT(4750, PD_MAX_VOLTAGE_MV, PD_OPERATING_POWER_MW), - PDO_VAR(4750, PD_MAX_VOLTAGE_MV, PD_MAX_CURRENT_MA), -}; -const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo); -#endif /* CONFIG_USB_PD_CUSTOM_PDO */ - -uint8_t board_get_usb_pd_port_count(void) -{ - return 1; -} diff --git a/test/genvif/src/test_config.h b/test/genvif/src/test_config.h deleted file mode 100644 index f2fa112e81..0000000000 --- a/test/genvif/src/test_config.h +++ /dev/null @@ -1,8 +0,0 @@ -/* Copyright 2020 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. - */ - -/* - * Blank shell to avoid including the real file - */ diff --git a/test/genvif/src/timer.h b/test/genvif/src/timer.h deleted file mode 100644 index f2fa112e81..0000000000 --- a/test/genvif/src/timer.h +++ /dev/null @@ -1,8 +0,0 @@ -/* Copyright 2020 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. - */ - -/* - * Blank shell to avoid including the real file - */ diff --git a/test/genvif/vif/exp_test_over_vif.xml b/test/genvif/vif/exp_test_over_vif.xml deleted file mode 100644 index 258430fd96..0000000000 --- a/test/genvif/vif/exp_test_over_vif.xml +++ /dev/null @@ -1,86 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<VIF>
- <VIF_Specification>3.12</VIF_Specification>
- <Vendor_Name>Google</Vendor_Name>
- <Model_Part_Number>SuperTestWithOverride</Model_Part_Number>
- <Product_Revision>Final</Product_Revision>
- <TID>12345</TID>
- <VIF_Product_Type value="0">Port Product</VIF_Product_Type>
- <Certification_Type value="0">End Product</Certification_Type>
- <Product>
- <Product_VID value="6353">18D1</Product_VID>
- </Product>
- <Component>
- <Port_Label>0</Port_Label>
- <Connector_Type value="2">Type-C®</Connector_Type>
- <USB4_Supported value="false">NO</USB4_Supported>
- <USB_PD_Support value="true">YES</USB_PD_Support>
- <PD_Port_Type value="4">DRP</PD_Port_Type>
- <Type_C_State_Machine value="2">DRP</Type_C_State_Machine>
- <Captive_Cable value="false">NO</Captive_Cable>
- <Port_Battery_Powered value="false">NO</Port_Battery_Powered>
- <BC_1_2_Support value="0">None</BC_1_2_Support>
- <PD_Spec_Revision_Major value="3" />
- <PD_Spec_Revision_Minor value="0" />
- <PD_Spec_Version_Major value="2" />
- <PD_Spec_Version_Minor value="0" />
- <PD_Specification_Revision value="2">Revision 3</PD_Specification_Revision>
- <USB_Comms_Capable value="true">YES</USB_Comms_Capable>
- <DR_Swap_To_DFP_Supported value="true">YES</DR_Swap_To_DFP_Supported>
- <DR_Swap_To_UFP_Supported value="false">NO</DR_Swap_To_UFP_Supported>
- <Unconstrained_Power value="false">NO</Unconstrained_Power>
- <VCONN_Swap_To_On_Supported value="false">NO</VCONN_Swap_To_On_Supported>
- <VCONN_Swap_To_Off_Supported value="false">NO</VCONN_Swap_To_Off_Supported>
- <Responds_To_Discov_SOP_UFP value="false">NO</Responds_To_Discov_SOP_UFP>
- <Responds_To_Discov_SOP_DFP value="false">NO</Responds_To_Discov_SOP_DFP>
- <Attempts_Discov_SOP value="true">YES</Attempts_Discov_SOP>
- <Chunking_Implemented_SOP value="false">NO</Chunking_Implemented_SOP>
- <Unchunked_Extended_Messages_Supported value="false">NO</Unchunked_Extended_Messages_Supported>
- <Manufacturer_Info_Supported_Port value="false">NO</Manufacturer_Info_Supported_Port>
- <Security_Msgs_Supported_SOP value="false">NO</Security_Msgs_Supported_SOP>
- <Num_Fixed_Batteries value="1" />
- <Num_Swappable_Battery_Slots value="0" />
- <ID_Header_Connector_Type_SOP value="2">USB Type-C® Receptacle</ID_Header_Connector_Type_SOP>
- <SOP_Capable value="true">YES</SOP_Capable>
- <SOP_P_Capable value="false">NO</SOP_P_Capable>
- <SOP_PP_Capable value="false">NO</SOP_PP_Capable>
- <SOP_P_Debug_Capable value="false">NO</SOP_P_Debug_Capable>
- <SOP_PP_Debug_Capable value="false">NO</SOP_PP_Debug_Capable>
- <Type_C_Implements_Try_SRC value="false">NO</Type_C_Implements_Try_SRC>
- <Type_C_Implements_Try_SNK value="false">NO</Type_C_Implements_Try_SNK>
- <RP_Value value="1">1.5A</RP_Value>
- <Type_C_Is_VCONN_Powered_Accessory value="false">NO</Type_C_Is_VCONN_Powered_Accessory>
- <Type_C_Is_Debug_Target_SRC value="true">YES</Type_C_Is_Debug_Target_SRC>
- <Type_C_Is_Debug_Target_SNK value="true">YES</Type_C_Is_Debug_Target_SNK>
- <Type_C_Can_Act_As_Host value="true">YES</Type_C_Can_Act_As_Host>
- <Type_C_Is_Alt_Mode_Controller value="false">NO</Type_C_Is_Alt_Mode_Controller>
- <Type_C_Can_Act_As_Device value="false">NO</Type_C_Can_Act_As_Device>
- <Type_C_Power_Source value="1">UFP-powered</Type_C_Power_Source>
- <Type_C_Port_On_Hub value="false">NO</Type_C_Port_On_Hub>
- <Type_C_Supports_Audio_Accessory value="false">NO</Type_C_Supports_Audio_Accessory>
- <Type_C_Sources_VCONN value="false">NO</Type_C_Sources_VCONN>
- <PD_Power_As_Source value="15000">15000 mW</PD_Power_As_Source>
- <USB_Suspend_May_Be_Cleared value="false">NO</USB_Suspend_May_Be_Cleared>
- <FR_Swap_Type_C_Current_Capability_As_Initial_Sink value="0">FR_Swap not supported</FR_Swap_Type_C_Current_Capability_As_Initial_Sink>
- <Master_Port value="false">NO</Master_Port>
- <Num_Src_PDOs value="1" />
- <Host_Supports_USB_Data value="true">YES</Host_Supports_USB_Data>
- <Host_Speed value="1">USB 3.2 GEN 1x1</Host_Speed>
- <Is_DFP_On_Hub value="false">NO</Is_DFP_On_Hub>
- <Host_Contains_Captive_Retimer value="false">NO</Host_Contains_Captive_Retimer>
- <Host_Is_Embedded value="false">NO</Host_Is_Embedded>
- <PD_OC_Protection value="false">NO</PD_OC_Protection>
- <Product_Total_Source_Power_mW value="15000">15000 mW</Product_Total_Source_Power_mW>
- <Port_Source_Power_Type value="0">Assured</Port_Source_Power_Type>
- <SrcPdoList>
- <SrcPDO>
- <Src_PDO_Supply_Type value="0">Fixed</Src_PDO_Supply_Type>
- <Src_PDO_Peak_Current value="0">100% IOC</Src_PDO_Peak_Current>
- <Src_PDO_Voltage value="100">5000 mV</Src_PDO_Voltage>
- <Src_PDO_Max_Current value="300">3000 mA</Src_PDO_Max_Current>
- <Src_PD_OCP_OC_Debounce value="50">50 msec</Src_PD_OCP_OC_Debounce>
- <Src_PD_OCP_OC_Threshold value="360">3600 mA</Src_PD_OCP_OC_Threshold>
- </SrcPDO>
- </SrcPdoList>
- </Component>
-</VIF>
diff --git a/test/genvif/vif/exp_test_vif.xml b/test/genvif/vif/exp_test_vif.xml deleted file mode 100644 index b04bfbe9e1..0000000000 --- a/test/genvif/vif/exp_test_vif.xml +++ /dev/null @@ -1,84 +0,0 @@ -<VIF>
- <VIF_Specification>3.12</VIF_Specification>
- <Vendor_Name>Google</Vendor_Name>
- <Model_Part_Number>test</Model_Part_Number>
- <Product_Revision>FIX-ME</Product_Revision>
- <TID>65535</TID>
- <VIF_Product_Type value="0">Port Product</VIF_Product_Type>
- <Certification_Type value="0">End Product</Certification_Type>
- <Product>
- <Product_VID value="6353">18D1</Product_VID>
- </Product>
- <Component>
- <Port_Label>0</Port_Label>
- <Connector_Type value="2">Type-C®</Connector_Type>
- <USB4_Supported value="false">NO</USB4_Supported>
- <USB_PD_Support value="true">YES</USB_PD_Support>
- <PD_Port_Type value="4">DRP</PD_Port_Type>
- <Type_C_State_Machine value="2">DRP</Type_C_State_Machine>
- <Captive_Cable value="false">NO</Captive_Cable>
- <Port_Battery_Powered value="false">NO</Port_Battery_Powered>
- <BC_1_2_Support value="0">None</BC_1_2_Support>
- <PD_Spec_Revision_Major value="3" />
- <PD_Spec_Revision_Minor value="0" />
- <PD_Spec_Version_Major value="2" />
- <PD_Spec_Version_Minor value="0" />
- <PD_Specification_Revision value="2">Revision 3</PD_Specification_Revision>
- <USB_Comms_Capable value="true">YES</USB_Comms_Capable>
- <DR_Swap_To_DFP_Supported value="true">YES</DR_Swap_To_DFP_Supported>
- <DR_Swap_To_UFP_Supported value="false">NO</DR_Swap_To_UFP_Supported>
- <Unconstrained_Power value="false">NO</Unconstrained_Power>
- <VCONN_Swap_To_On_Supported value="false">NO</VCONN_Swap_To_On_Supported>
- <VCONN_Swap_To_Off_Supported value="false">NO</VCONN_Swap_To_Off_Supported>
- <Responds_To_Discov_SOP_UFP value="false">NO</Responds_To_Discov_SOP_UFP>
- <Responds_To_Discov_SOP_DFP value="false">NO</Responds_To_Discov_SOP_DFP>
- <Attempts_Discov_SOP value="true">YES</Attempts_Discov_SOP>
- <Chunking_Implemented_SOP value="false">NO</Chunking_Implemented_SOP>
- <Unchunked_Extended_Messages_Supported value="false">NO</Unchunked_Extended_Messages_Supported>
- <Manufacturer_Info_Supported_Port value="false">NO</Manufacturer_Info_Supported_Port>
- <Security_Msgs_Supported_SOP value="false">NO</Security_Msgs_Supported_SOP>
- <Num_Fixed_Batteries value="1" />
- <Num_Swappable_Battery_Slots value="0" />
- <ID_Header_Connector_Type_SOP value="2">USB Type-C® Receptacle</ID_Header_Connector_Type_SOP>
- <SOP_Capable value="true">YES</SOP_Capable>
- <SOP_P_Capable value="false">NO</SOP_P_Capable>
- <SOP_PP_Capable value="false">NO</SOP_PP_Capable>
- <SOP_P_Debug_Capable value="false">NO</SOP_P_Debug_Capable>
- <SOP_PP_Debug_Capable value="false">NO</SOP_PP_Debug_Capable>
- <Type_C_Implements_Try_SRC value="false">NO</Type_C_Implements_Try_SRC>
- <Type_C_Implements_Try_SNK value="false">NO</Type_C_Implements_Try_SNK>
- <RP_Value value="1">1.5A</RP_Value>
- <Type_C_Is_VCONN_Powered_Accessory value="false">NO</Type_C_Is_VCONN_Powered_Accessory>
- <Type_C_Is_Debug_Target_SRC value="true">YES</Type_C_Is_Debug_Target_SRC>
- <Type_C_Is_Debug_Target_SNK value="true">YES</Type_C_Is_Debug_Target_SNK>
- <Type_C_Can_Act_As_Host value="true">YES</Type_C_Can_Act_As_Host>
- <Type_C_Is_Alt_Mode_Controller value="false">NO</Type_C_Is_Alt_Mode_Controller>
- <Type_C_Can_Act_As_Device value="false">NO</Type_C_Can_Act_As_Device>
- <Type_C_Power_Source value="1">UFP-powered</Type_C_Power_Source>
- <Type_C_Port_On_Hub value="false">NO</Type_C_Port_On_Hub>
- <Type_C_Supports_Audio_Accessory value="false">NO</Type_C_Supports_Audio_Accessory>
- <Type_C_Sources_VCONN value="false">NO</Type_C_Sources_VCONN>
- <PD_Power_As_Source value="15000">15000 mW</PD_Power_As_Source>
- <USB_Suspend_May_Be_Cleared value="false">NO</USB_Suspend_May_Be_Cleared>
- <Sends_Pings value="false">NO</Sends_Pings>
- <FR_Swap_Type_C_Current_Capability_As_Initial_Sink value="0">FR_Swap not supported</FR_Swap_Type_C_Current_Capability_As_Initial_Sink>
- <Master_Port value="false">NO</Master_Port>
- <Num_Src_PDOs value="1" />
- <Host_Supports_USB_Data value="true">YES</Host_Supports_USB_Data>
- <Host_Speed value="1">USB 3.2 GEN 1x1</Host_Speed>
- <Is_DFP_On_Hub value="false">NO</Is_DFP_On_Hub>
- <Host_Contains_Captive_Retimer value="false">NO</Host_Contains_Captive_Retimer>
- <Host_Is_Embedded value="false">NO</Host_Is_Embedded>
- <PD_OC_Protection value="false">NO</PD_OC_Protection>
- <Product_Total_Source_Power_mW value="15000">15000 mW</Product_Total_Source_Power_mW>
- <Port_Source_Power_Type value="0">Assured</Port_Source_Power_Type>
- <SrcPdoList>
- <SrcPDO>
- <Src_PDO_Supply_Type value="0">Fixed</Src_PDO_Supply_Type>
- <Src_PDO_Peak_Current value="0">100% IOC</Src_PDO_Peak_Current>
- <Src_PDO_Voltage value="100">5000 mV</Src_PDO_Voltage>
- <Src_PDO_Max_Current value="300">3000 mA</Src_PDO_Max_Current>
- </SrcPDO>
- </SrcPdoList>
- </Component>
-</VIF>
diff --git a/test/genvif/vif/over_test_vif.xml b/test/genvif/vif/over_test_vif.xml deleted file mode 100644 index 64e1148c68..0000000000 --- a/test/genvif/vif/over_test_vif.xml +++ /dev/null @@ -1,19 +0,0 @@ -<VIF>
- <!-- Override the following fields -->
- <Model_Part_Number>SuperTestWithOverride</Model_Part_Number>
- <Product_Revision>Final</Product_Revision>
- <TID>12345</TID>
-
- <Component>
- <!-- Remove Sends_Pings -->
- <Sends_Pings />
-
- <SrcPdoList>
- <SrcPDO>
- <!-- Add in missing fields for SrcPdo0 -->
- <Src_PD_OCP_OC_Debounce value="50">50 msec</Src_PD_OCP_OC_Debounce>
- <Src_PD_OCP_OC_Threshold value="360">3600 mA</Src_PD_OCP_OC_Threshold>
- </SrcPDO>
- </SrcPdoList>
- </Component>
-</VIF>
diff --git a/test/gyro_cal.c b/test/gyro_cal.c deleted file mode 100644 index 10d48ca18e..0000000000 --- a/test/gyro_cal.c +++ /dev/null @@ -1,511 +0,0 @@ -/* Copyright 2020 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 "common.h" -#include "gyro_cal.h" -#include "gyro_still_det.h" -#include "gyro_cal_init_for_test.h" -#include "motion_sense.h" -#include "test_util.h" -#include <string.h> -#include <stdlib.h> -#include <math.h> -#include <stdio.h> - -float kToleranceGyroRps = 1e-6f; -float kDefaultGravityMps2 = 9.81f; -int kDefaultTemperatureKelvin = 298; - -#define NANOS_TO_SEC (1.0e-9f) -#define NANO_PI (3.14159265359f) -/** Unit conversion: milli-degrees to radians. */ -#define MDEG_TO_RAD (NANO_PI / 180.0e3f) - -#define MSEC_TO_NANOS(x) ((uint64_t)((x) * (uint64_t)(1000000))) -#define SEC_TO_NANOS(x) MSEC_TO_NANOS((x) * (uint64_t)(1000)) -#define HZ_TO_PERIOD_NANOS(hz) (SEC_TO_NANOS(1024) / ((uint64_t)((hz)*1024))) - -struct motion_sensor_t motion_sensors[] = { - [BASE] = {}, - [LID] = {}, -}; - -const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); - -/** - * This function will return a uniformly distributed random value in the range - * of (0,1). This is important that 0 and 1 are excluded because of how the - * value is used in normal_random. For references: - * - rand() / RAND_MAX yields the range [0,1] - * - rand() / (RAND_MAX + 1) yields the range [0,1) - * - (rand() + 1) / (RAND_MAX + 1) yields the range (0, 1) - * - * @return A uniformly distributed random value. - */ -static double rand_gen(void) -{ - return ((double)(rand()) + 1.0) / ((double)(RAND_MAX) + 1.0); -} - -/** - * @return A normally distributed random value - */ -static float normal_random(void) -{ - double v1 = rand_gen(); - double v2 = rand_gen(); - - return (float)(cos(2 * 3.14 * v2) * sqrt(-2.0 * log(v1))); -} - -/** - * @param mean The mean to use for the normal distribution. - * @param stddev The standard deviation to use for the normal distribution. - * @return A normally distributed random value based on mean and stddev. - */ -static float normal_random2(float mean, float stddev) -{ - return normal_random() * stddev + mean; -} - -/** - * Tests that a calibration is updated after a period where the IMU device is - * stationary. Accelerometer and gyroscope measurements are simulated with data - * sheet specs for the BMI160 at their respective noise floors. A magnetometer - * sensor is also included in this test. - * - * @return EC_SUCCESS on success. - */ -static int test_gyro_cal_calibration(void) -{ - int i; - struct gyro_cal gyro_cal; - - /* - * Statistics for simulated gyroscope data. - * RMS noise = 70mDPS, offset = 150mDPS. - */ - /* [Hz] */ - const float sample_rate = 400.0f; - /* [rad/sec] */ - const float gyro_bias = MDEG_TO_RAD * 150.0f; - /* [rad/sec] */ - const float gyro_rms_noise = MDEG_TO_RAD * 70.0f; - const uint64_t sample_interval_nanos = HZ_TO_PERIOD_NANOS(sample_rate); - - /* - * Statistics for simulated accelerometer data. - * noise density = 200ug/rtHz, offset = 50mg. - */ - /* [m/sec^2] */ - const float accel_bias = 0.05f * kDefaultGravityMps2; - /* [m/sec^2] */ - const float accel_rms_noise = - 0.0002f * kDefaultGravityMps2 * fp_sqrtf(0.5f * sample_rate); - - /* - * Statistics for simulated magnetometer data. - * RMS noise = 0.4 micro Tesla (uT), offset = 0.2uT. - */ - const float mag_bias = 0.2f; /* [uT] */ - const float mag_rms_noise = 0.4f; /* [uT] */ - - float bias[3]; - float bias_residual[3]; - int temperature_kelvin; - uint32_t calibration_time_us = 0; - - bool calibration_received = false; - - gyro_cal_initialization_for_test(&gyro_cal); - - /* No calibration should be available yet. */ - TEST_EQ(gyro_cal_new_bias_available(&gyro_cal), false, "%d"); - - /* - * Simulate up to 20 seconds of sensor data (zero mean, additive white - * Gaussian noise). - */ - for (i = 0; i < (int)(20.0f * sample_rate); ++i) { - const uint32_t timestamp_us = - (i * sample_interval_nanos) / 1000; - - /* Generate and add an accelerometer sample. */ - gyro_cal_update_accel( - &gyro_cal, timestamp_us, - normal_random2(accel_bias, accel_rms_noise), - normal_random2(accel_bias, accel_rms_noise), - normal_random2(accel_bias, accel_rms_noise)); - - /* Generate and add a gyroscrope sample. */ - gyro_cal_update_gyro(&gyro_cal, timestamp_us, - normal_random2(gyro_bias, gyro_rms_noise), - normal_random2(gyro_bias, gyro_rms_noise), - normal_random2(gyro_bias, gyro_rms_noise), - kDefaultTemperatureKelvin); - - /* - * The simulated magnetometer here has a sampling rate that is - * 4x slower than the accel/gyro - */ - if (i % 4 == 0) { - gyro_cal_update_mag( - &gyro_cal, timestamp_us, - normal_random2(mag_bias, mag_rms_noise), - normal_random2(mag_bias, mag_rms_noise), - normal_random2(mag_bias, mag_rms_noise)); - } - calibration_received = gyro_cal_new_bias_available(&gyro_cal); - if (calibration_received) - break; - } - - TEST_EQ(calibration_received, true, "%d"); - - gyro_cal_get_bias(&gyro_cal, bias, &temperature_kelvin, - &calibration_time_us); - bias_residual[0] = gyro_bias - bias[0]; - bias_residual[1] = gyro_bias - bias[1]; - bias_residual[2] = gyro_bias - bias[2]; - - /* - * Make sure that the bias estimate is within 20 milli-degrees per - * second. - */ - TEST_LT(bias_residual[0], 20.f * MDEG_TO_RAD, "%f"); - TEST_LT(bias_residual[1], 20.f * MDEG_TO_RAD, "%f"); - TEST_LT(bias_residual[2], 20.f * MDEG_TO_RAD, "%f"); - - TEST_NEAR(gyro_cal.stillness_confidence, 1.0f, 0.0001f, "%f"); - - TEST_EQ(temperature_kelvin, kDefaultTemperatureKelvin, "%d"); - - return EC_SUCCESS; -} - -/** - * Tests that calibration does not falsely occur for low-level motion. - * - * @return EC_SUCCESS on success. - */ -static int test_gyro_cal_no_calibration(void) -{ - int i; - struct gyro_cal gyro_cal; - - /* Statistics for simulated gyroscope data. */ - /* RMS noise = 70mDPS, offset = 150mDPS. */ - const float sample_rate = 400.0f; /* [Hz] */ - const float gyro_bias = MDEG_TO_RAD * 150.0f; /* [rad/sec] */ - const float gyro_rms_noise = MDEG_TO_RAD * 70.0f; /* [rad/sec] */ - const uint64_t sample_interval_nanos = HZ_TO_PERIOD_NANOS(sample_rate); - - /* Statistics for simulated accelerometer data. */ - /* noise density = 200ug/rtHz, offset = 50mg. */ - /* [m/sec^2] */ - const float accel_bias = 0.05f * kDefaultGravityMps2; - /* [m/sec^2] */ - const float accel_rms_noise = - 200.0e-6f * kDefaultGravityMps2 * fp_sqrtf(0.5f * sample_rate); - - /* Define sinusoidal gyroscope motion parameters. */ - const float omega_dt = - 2.0f * NANO_PI * sample_interval_nanos * NANOS_TO_SEC; - const float amplitude = MDEG_TO_RAD * 550.0f; /* [rad/sec] */ - - bool calibration_received = false; - - gyro_cal_initialization_for_test(&gyro_cal); - - for (i = 0; i < (int)(20.0f * sample_rate); ++i) { - const uint32_t timestamp_us = - (i * sample_interval_nanos) / 1000; - - /* Generate and add an accelerometer sample. */ - gyro_cal_update_accel( - &gyro_cal, timestamp_us, - normal_random2(accel_bias, accel_rms_noise), - normal_random2(accel_bias, accel_rms_noise), - normal_random2(accel_bias, accel_rms_noise)); - - /* Generate and add a gyroscope sample. */ - gyro_cal_update_gyro( - &gyro_cal, timestamp_us, - normal_random2(gyro_bias, gyro_rms_noise) + - amplitude * sin(2.0f * omega_dt * i), - normal_random2(gyro_bias, gyro_rms_noise) - - amplitude * sin(2.1f * omega_dt * i), - normal_random2(gyro_bias, gyro_rms_noise) + - amplitude * cos(4.3f * omega_dt * i), - kDefaultTemperatureKelvin); - - /* Check for calibration update. Break after first one. */ - calibration_received = gyro_cal_new_bias_available(&gyro_cal); - if (calibration_received) - break; - } - - /* Determine that NO calibration had occurred. */ - TEST_EQ(calibration_received, false, "%d"); - - /* Make sure that the device was NOT classified as "still". */ - TEST_GT(1.0f, gyro_cal.stillness_confidence, "%f"); - - return EC_SUCCESS; -} - -/** - * Tests that a shift in a stillness window mean does not trigger a calibration. - * - * @return EC_SUCCESS on success. - */ -static int test_gyro_cal_win_mean_shift(void) -{ - struct gyro_cal gyro_cal; - int i; - - /* Statistics for simulated gyroscope data. */ - const float sample_rate = 400.0f; /* [Hz] */ - const float gyro_bias = MDEG_TO_RAD * 150.0f; /* [rad/sec] */ - const float gyro_bias_shift = MDEG_TO_RAD * 60.0f; /* [rad/sec] */ - const uint64_t sample_interval_nanos = HZ_TO_PERIOD_NANOS(sample_rate); - - /* Initialize the gyro calibration. */ - gyro_cal_initialization_for_test(&gyro_cal); - - /* - * Simulates 8 seconds of sensor data (no noise, just a gyro mean shift - * after 4 seconds). - * Assumptions: The max stillness period is 6 seconds, and the mean - * delta limit is 50mDPS. The mean shift should be detected and exceed - * the 50mDPS limit, and no calibration should be triggered. NOTE: This - * step is not large enough to trip the variance checking within the - * stillness detectors. - */ - for (i = 0; i < (int)(8.0f * sample_rate); i++) { - const uint32_t timestamp_us = - (i * sample_interval_nanos) / 1000; - - /* Generate and add a accelerometer sample. */ - gyro_cal_update_accel(&gyro_cal, timestamp_us, 0.0f, 0.0f, - 9.81f); - - /* Generate and add a gyroscope sample. */ - if (timestamp_us > 4 * SECOND) { - gyro_cal_update_gyro(&gyro_cal, timestamp_us, - gyro_bias + gyro_bias_shift, - gyro_bias + gyro_bias_shift, - gyro_bias + gyro_bias_shift, - kDefaultTemperatureKelvin); - } else { - gyro_cal_update_gyro(&gyro_cal, timestamp_us, gyro_bias, - gyro_bias, gyro_bias, - kDefaultTemperatureKelvin); - } - } - - /* Determine that NO calibration had occurred. */ - TEST_EQ(gyro_cal_new_bias_available(&gyro_cal), false, "%d"); - - return EC_SUCCESS; -} - -/** - * Tests that a temperature variation outside the acceptable range prevents a - * calibration. - * - * @return EC_SUCCESS on success. - */ -static int test_gyro_cal_temperature_shift(void) -{ - int i; - struct gyro_cal gyro_cal; - - /* Statistics for simulated gyroscope data. */ - const float sample_rate = 400.0f; /* [Hz] */ - const float gyro_bias = MDEG_TO_RAD * 150.0f; /* [rad/sec] */ - const float temperature_shift_kelvin = 2.6f; - const uint64_t sample_interval_nanos = HZ_TO_PERIOD_NANOS(sample_rate); - - gyro_cal_initialization_for_test(&gyro_cal); - - /* - * Simulates 8 seconds of sensor data (no noise, just a temperature - * shift after 4 seconds). - * Assumptions: The max stillness period is 6 seconds, and the - * temperature delta limit is 1.5C. The shift should be detected and - * exceed the limit, and no calibration should be triggered. - */ - for (i = 0; i < (int)(8.0f * sample_rate); i++) { - const uint32_t timestamp_us = - (i * sample_interval_nanos) / 1000; - float temperature_kelvin = kDefaultTemperatureKelvin; - - /* Generate and add a accelerometer sample. */ - gyro_cal_update_accel(&gyro_cal, timestamp_us, 0.0f, 0.0f, - 9.81f); - - /* Sets the temperature value. */ - if (timestamp_us > 4 * SECOND) - temperature_kelvin += temperature_shift_kelvin; - - /* Generate and add a gyroscope sample. */ - gyro_cal_update_gyro(&gyro_cal, timestamp_us, gyro_bias, - gyro_bias, gyro_bias, - (int)temperature_kelvin); - } - - /* Determine that NO calibration had occurred. */ - TEST_EQ(gyro_cal_new_bias_available(&gyro_cal), false, "%d"); - - return EC_SUCCESS; -} - -/** - * Verifies that complete sensor stillness results in the correct bias estimate - * and produces the correct timestamp. - * - * @return EC_SUCCESS on success; - */ -static int test_gyro_cal_stillness_timestamp(void) -{ - struct gyro_cal gyro_cal; - int64_t time_us; - - /* - * 10Hz update rate for 11 seconds should trigger the in-situ - * algorithms. - */ - const float gyro_bias_x = 0.09f; - const float gyro_bias_y = -0.04f; - const float gyro_bias_z = 0.05f; - - float bias[3]; - int temperature_kelvin = 273; - uint32_t calibration_time_us = 0; - - gyro_cal_initialization_for_test(&gyro_cal); - for (time_us = 0; time_us < 11 * SECOND; time_us += 100 * MSEC) { - /* Generate and add a accelerometer sample. */ - gyro_cal_update_accel(&gyro_cal, time_us, 0.0f, 0.0f, 9.81f); - - /* Generate and add a gyroscope sample. */ - gyro_cal_update_gyro(&gyro_cal, time_us, gyro_bias_x, - gyro_bias_y, gyro_bias_z, - kDefaultTemperatureKelvin); - } - - /* Determine if there is a new calibration. Get the calibration value. - */ - TEST_EQ(gyro_cal_new_bias_available(&gyro_cal), 1, "%d"); - - gyro_cal_get_bias(&gyro_cal, bias, &temperature_kelvin, - &calibration_time_us); - - /* Make sure that the bias estimate is within kToleranceGyroRps. */ - TEST_NEAR(gyro_bias_x - bias[0], 0.0f, 0.0001f, "%f"); - TEST_NEAR(gyro_bias_y - bias[1], 0.0f, 0.0001f, "%f"); - TEST_NEAR(gyro_bias_z - bias[2], 0.0f, 0.0001f, "%f"); - - /* Checks that the calibration occurred at the expected time. */ - TEST_EQ(6 * SECOND, gyro_cal.calibration_time_us, "%u"); - - /* Make sure that the device was classified as 100% "still". */ - TEST_NEAR(1.0f, gyro_cal.stillness_confidence, 0.0001f, "%f"); - - /* Make sure that the calibration temperature is correct. */ - TEST_EQ(kDefaultTemperatureKelvin, temperature_kelvin, "%d"); - - return EC_SUCCESS; -} - -/** - * Verifies that setting an initial bias works. - * - * @return EC_SUCCESS on success. - */ -static int test_gyro_cal_set_bias(void) -{ - struct gyro_cal gyro_cal; - - /* Get the initialized bias value; should be zero. */ - float bias[3] = { 0.0f, 0.0f, 0.0f }; - int temperature_kelvin = 273; - uint32_t calibration_time_us = 10; - - /* Initialize the gyro calibration. */ - gyro_cal_initialization_for_test(&gyro_cal); - gyro_cal_get_bias(&gyro_cal, bias, &temperature_kelvin, - &calibration_time_us); - TEST_NEAR(0.0f, bias[0], 0.0001f, "%f"); - TEST_NEAR(0.0f, bias[1], 0.0001f, "%f"); - TEST_NEAR(0.0f, bias[2], 0.0001f, "%f"); - TEST_EQ(0, temperature_kelvin, "%d"); - TEST_EQ(0, calibration_time_us, "%d"); - - /* Set the calibration bias estimate. */ - bias[0] = 1.0f; - bias[1] = 2.0f; - bias[2] = 3.0f; - gyro_cal_set_bias(&gyro_cal, bias, 31, 3 * 60 * SECOND); - - bias[0] = 0.0f; - bias[1] = 0.0f; - bias[2] = 0.0f; - /* Check that it was set correctly. */ - gyro_cal_get_bias(&gyro_cal, bias, &temperature_kelvin, - &calibration_time_us); - TEST_NEAR(1.0f, bias[0], 0.0001f, "%f"); - TEST_NEAR(2.0f, bias[1], 0.0001f, "%f"); - TEST_NEAR(3.0f, bias[2], 0.0001f, "%f"); - TEST_EQ(31, temperature_kelvin, "%d"); - TEST_EQ(3 * 60 * SECOND, calibration_time_us, "%u"); - - return EC_SUCCESS; -} - -/** - * Verifies that the gyroCalRemoveBias function works as intended. - * - * @return EC_SUCCESS on success - */ -static int test_gyro_cal_remove_bias(void) -{ - struct gyro_cal gyro_cal; - float bias[3] = { 1.0f, 2.0f, 3.0f }; - float bias_out[3]; - - /* Initialize the gyro calibration. */ - gyro_cal_initialization_for_test(&gyro_cal); - - /* Set an calibration bias estimate. */ - gyro_cal_set_bias(&gyro_cal, bias, kDefaultTemperatureKelvin, - 5 * 60 * SECOND); - - /* Correct the bias, and check that it has been adequately removed. */ - gyro_cal_remove_bias(&gyro_cal, bias, bias_out); - - /* Make sure that the bias estimate is within kToleranceGyroRps. */ - TEST_NEAR(0.0f, bias_out[0], 0.0001f, "%f"); - TEST_NEAR(0.0f, bias_out[1], 0.0001f, "%f"); - TEST_NEAR(0.0f, bias_out[2], 0.0001f, "%f"); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_gyro_cal_calibration); - RUN_TEST(test_gyro_cal_no_calibration); - RUN_TEST(test_gyro_cal_win_mean_shift); - RUN_TEST(test_gyro_cal_temperature_shift); - RUN_TEST(test_gyro_cal_stillness_timestamp); - RUN_TEST(test_gyro_cal_set_bias); - RUN_TEST(test_gyro_cal_remove_bias); - - test_print_result(); -} diff --git a/test/gyro_cal.tasklist b/test/gyro_cal.tasklist deleted file mode 100644 index 7d28eb5b64..0000000000 --- a/test/gyro_cal.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2020 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(MOTIONSENSE, motion_sense_task, NULL, TASK_STACK_SIZE) diff --git a/test/gyro_cal_init_for_test.c b/test/gyro_cal_init_for_test.c deleted file mode 100644 index 3963e5a207..0000000000 --- a/test/gyro_cal_init_for_test.c +++ /dev/null @@ -1,114 +0,0 @@ -/* Copyright 2020 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 "common.h" -#include "timer.h" -#include "gyro_cal_init_for_test.h" -#include <string.h> - -#define NANO_PI (3.14159265359f) -/** Unit conversion: milli-degrees to radians. */ -#define MDEG_TO_RAD (NANO_PI / 180.0e3f) - -/** - * - * @param det Pointer to the stillness detector - * @param var_threshold The variance threshold in units^2 - * @param confidence_delta The confidence delta in units^2 - */ -static void gyro_still_det_initialization_for_test(struct gyro_still_det *det, - float var_threshold, - float confidence_delta) -{ - /* Clear all data structure variables to 0. */ - memset(det, 0, sizeof(struct gyro_still_det)); - - /* - * Set the delta about the variance threshold for calculation - * of the stillness confidence score. - */ - if (confidence_delta < var_threshold) - det->confidence_delta = confidence_delta; - else - det->confidence_delta = var_threshold; - - /* - * Set the variance threshold parameter for the stillness - * confidence score. - */ - det->var_threshold = var_threshold; - - /* Signal to start capture of next stillness data window. */ - det->start_new_window = true; -} - -void gyro_cal_initialization_for_test(struct gyro_cal *gyro_cal) -{ - /* GyroCal initialization. */ - memset(gyro_cal, 0, sizeof(struct gyro_cal)); - - /* - * Initialize the stillness detectors. - * Gyro parameter input units are [rad/sec]. - * Accel parameter input units are [m/sec^2]. - * Magnetometer parameter input units are [uT]. - */ - gyro_still_det_initialization_for_test(&gyro_cal->gyro_stillness_detect, - /* var_threshold */ 5e-5f, - /* confidence_delta */ 1e-5f); - gyro_still_det_initialization_for_test( - &gyro_cal->accel_stillness_detect, - /* var_threshold */ 8e-3f, - /* confidence_delta */ 1.6e-3f); - gyro_still_det_initialization_for_test(&gyro_cal->mag_stillness_detect, - /* var_threshold */ 1.4f, - /* confidence_delta */ 0.25f); - - /* Reset stillness flag and start timestamp. */ - gyro_cal->prev_still = false; - gyro_cal->start_still_time_us = 0; - - /* Set the min and max window stillness duration. */ - gyro_cal->min_still_duration_us = 5 * SECOND; - gyro_cal->max_still_duration_us = 6 * SECOND; - - /* Sets the duration of the stillness processing windows. */ - gyro_cal->window_time_duration_us = 1500000; - - /* Set the window timeout duration. */ - gyro_cal->gyro_window_timeout_duration_us = 5 * SECOND; - - /* Load the last valid cal from system memory. */ - gyro_cal->bias_x = 0.0f; /* [rad/sec] */ - gyro_cal->bias_y = 0.0f; /* [rad/sec] */ - gyro_cal->bias_z = 0.0f; /* [rad/sec] */ - gyro_cal->calibration_time_us = 0; - - /* Set the stillness threshold required for gyro bias calibration. */ - gyro_cal->stillness_threshold = 0.95f; - - /* - * Current window end-time used to assist in keeping sensor data - * collection in sync. Setting this to zero signals that sensor data - * will be dropped until a valid end-time is set from the first gyro - * timestamp received. - */ - gyro_cal->stillness_win_endtime_us = 0; - - /* Gyro calibrations will be applied (see, gyro_cal_remove_bias()). */ - gyro_cal->gyro_calibration_enable = true; - - /* - * Sets the stability limit for the stillness window mean acceptable - * delta. - */ - gyro_cal->stillness_mean_delta_limit = 50.0f * MDEG_TO_RAD; - - /* Sets the min/max temperature delta limit for the stillness period. */ - gyro_cal->temperature_delta_limit_kelvin = 1.5f; - - /* Ensures that the data tracking functionality is reset. */ - init_gyro_cal(gyro_cal); -} diff --git a/test/gyro_cal_init_for_test.h b/test/gyro_cal_init_for_test.h deleted file mode 100644 index e32040bab9..0000000000 --- a/test/gyro_cal_init_for_test.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright 2020 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. - */ - -#ifndef __CROS_EC_GYRO_CAL_INIT_FOR_TEST -#define __CROS_EC_GYRO_CAL_INIT_FOR_TEST - -#include "gyro_cal.h" -#include "gyro_still_det.h" - -/** - * Initialization function used for testing the gyroscope calibration. - * This function will initialize to the following values: - * - Gyrscope stillness detector - * - variance threshold: 5e-5 - * - confidence delta: 1e-5 - * - Accelerometer stillness detector - * - variance threshold: 8e-3 - * - confidence delta: 1.6e-3 - * - Magnetometer stillness detector - * - variance threshold: 1.4 - * - confidence delta: 2.5e-1 - * - Minimum stillness duration: 5 seconds - * - Maximum stillness duration: 6 seconds - * - Window duration: 1.5 seconds - * - Window timeout duration: 5 seconds - * - Stillness threshold: 0.95 - * - Stillness mean delta limit: 50 millidegrees - * - Temperature delta limit: 1.5K - * - * Once all the values are set, this function will call init_gyro_cal() - * to finish initializing/resetting the struct data. - * - * @param gyro_cal Pointer to the calibration data structure to initialize. - */ -void gyro_cal_initialization_for_test(struct gyro_cal *gyro_cal); - -#endif /* __CROS_EC_GYRO_CAL_INIT_FOR_TEST */ diff --git a/test/hooks.c b/test/hooks.c deleted file mode 100644 index 8d12494688..0000000000 --- a/test/hooks.c +++ /dev/null @@ -1,173 +0,0 @@ -/* Copyright 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. - * - * Test hooks. - */ - -#include "common.h" -#include "console.h" -#include "hooks.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -static int init_hook_count; -static int tick_hook_count; -static int tick2_hook_count; -static int tick_count_seen_by_tick2; -static timestamp_t tick_time[2]; -static int second_hook_count; -static timestamp_t second_time[2]; -static int deferred_call_count; - -static void init_hook(void) -{ - init_hook_count++; -} -DECLARE_HOOK(HOOK_INIT, init_hook, HOOK_PRIO_DEFAULT); - -static void tick_hook(void) -{ - tick_hook_count++; - tick_time[0] = tick_time[1]; - tick_time[1] = get_time(); -} -DECLARE_HOOK(HOOK_TICK, tick_hook, HOOK_PRIO_DEFAULT); - -static void tick2_hook(void) -{ - tick2_hook_count++; - tick_count_seen_by_tick2 = tick_hook_count; -} -/* tick2_hook() prio means it should be called after tick_hook() */ -DECLARE_HOOK(HOOK_TICK, tick2_hook, HOOK_PRIO_DEFAULT+1); - -static void second_hook(void) -{ - second_hook_count++; - second_time[0] = second_time[1]; - second_time[1] = get_time(); -} -DECLARE_HOOK(HOOK_SECOND, second_hook, HOOK_PRIO_DEFAULT); - -static void deferred_func(void) -{ - deferred_call_count++; -} -DECLARE_DEFERRED(deferred_func); - -static void non_deferred_func(void) -{ - deferred_call_count++; -} - -static const struct deferred_data non_deferred_func_data = { - non_deferred_func -}; - -static int test_init_hook(void) -{ - TEST_ASSERT(init_hook_count == 1); - return EC_SUCCESS; -} - -static int test_ticks(void) -{ - int64_t interval; - int error_pct; - - /* - * HOOK_SECOND must have been fired at least once when HOOK - * task starts. We only need to wait for just more than a second - * to allow it fires for the second time. - */ - usleep(1300 * MSEC); - - interval = tick_time[1].val - tick_time[0].val; - error_pct = (interval - HOOK_TICK_INTERVAL) * 100 / - HOOK_TICK_INTERVAL; - TEST_ASSERT_ABS_LESS(error_pct, 10); - - interval = second_time[1].val - second_time[0].val; - error_pct = (interval - SECOND) * 100 / SECOND; - TEST_ASSERT_ABS_LESS(error_pct, 10); - - return EC_SUCCESS; -} - -static int test_priority(void) -{ - usleep(HOOK_TICK_INTERVAL); - TEST_ASSERT(tick_hook_count == tick2_hook_count); - TEST_ASSERT(tick_hook_count == tick_count_seen_by_tick2); - - return EC_SUCCESS; -} - -static int test_deferred(void) -{ - deferred_call_count = 0; - hook_call_deferred(&deferred_func_data, 50 * MSEC); - usleep(100 * MSEC); - TEST_ASSERT(deferred_call_count == 1); - - hook_call_deferred(&deferred_func_data, 50 * MSEC); - usleep(25 * MSEC); - hook_call_deferred(&deferred_func_data, -1); - usleep(75 * MSEC); - TEST_ASSERT(deferred_call_count == 1); - - hook_call_deferred(&deferred_func_data, 50 * MSEC); - usleep(25 * MSEC); - hook_call_deferred(&deferred_func_data, -1); - usleep(15 * MSEC); - hook_call_deferred(&deferred_func_data, 25 * MSEC); - usleep(50 * MSEC); - TEST_ASSERT(deferred_call_count == 2); - - TEST_ASSERT(hook_call_deferred(&non_deferred_func_data, 50 * MSEC) != - EC_SUCCESS); - usleep(100 * MSEC); - TEST_ASSERT(deferred_call_count == 2); - - return EC_SUCCESS; -} - -static int repeating_deferred_count; -static void deferred_repeating_func(void); -DECLARE_DEFERRED(deferred_repeating_func); - -static void deferred_repeating_func(void) -{ - ++repeating_deferred_count; - - usleep(100 * MSEC); - if (repeating_deferred_count < 5) - hook_call_deferred(&deferred_repeating_func_data, SECOND); - - usleep(100 * MSEC); -} - -static int test_repeating_deferred(void) -{ - repeating_deferred_count = 0; - hook_call_deferred(&deferred_repeating_func_data, 0); - usleep(MINUTE); - TEST_EQ(repeating_deferred_count, 5, "%d"); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_init_hook); - RUN_TEST(test_ticks); - RUN_TEST(test_priority); - RUN_TEST(test_deferred); - RUN_TEST(test_repeating_deferred); - - test_print_result(); -} diff --git a/test/hooks.tasklist b/test/hooks.tasklist deleted file mode 100644 index da0ab6211a..0000000000 --- a/test/hooks.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/host_command.c b/test/host_command.c deleted file mode 100644 index ba1d4dcd96..0000000000 --- a/test/host_command.c +++ /dev/null @@ -1,320 +0,0 @@ -/* Copyright 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. - * - * Test host command. - */ - -#include "common.h" -#include "console.h" -#include "host_command.h" -#include "task.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -/* Request/response buffer size (and maximum command length) */ -#define BUFFER_SIZE 128 - -struct host_packet pkt; -static char resp_buf[BUFFER_SIZE]; -static char req_buf[BUFFER_SIZE + 4]; -struct ec_host_request *req = (struct ec_host_request *)req_buf; -struct ec_params_hello *p = (struct ec_params_hello *)(req_buf + sizeof(*req)); -struct ec_host_response *resp = (struct ec_host_response *)resp_buf; -struct ec_response_hello *r = - (struct ec_response_hello *)(resp_buf + sizeof(*resp)); -struct ec_response_get_chip_info *chip_info_r = - (struct ec_response_get_chip_info *)(resp_buf + sizeof(*resp)); - -static void hostcmd_respond(struct host_packet *pkt) -{ - task_wake(TASK_ID_TEST_RUNNER); -} - -static char calculate_checksum(const char *buf, int size) -{ - int c = 0; - int i; - - for (i = 0; i < size; ++i) - c += buf[i]; - - return -c; -} - -static void hostcmd_send(void) -{ - req->checksum = calculate_checksum(req_buf, pkt.request_size); - host_packet_receive(&pkt); - task_wait_event(-1); -} - -static void hostcmd_fill_in_default(void) -{ - req->struct_version = 3; - req->checksum = 0; - req->command = EC_CMD_HELLO; - req->command_version = 0; - req->reserved = 0; - req->data_len = 4; - p->in_data = 0x11223344; - - pkt.send_response = hostcmd_respond; - pkt.request = (const void *)req_buf; - pkt.request_temp = NULL; - pkt.request_max = BUFFER_SIZE; - pkt.request_size = sizeof(*req) + sizeof(*p); - pkt.response = (void *)resp_buf; - pkt.response_max = BUFFER_SIZE; - pkt.driver_result = 0; -} - -static int test_hostcmd_ok(void) -{ - hostcmd_fill_in_default(); - - hostcmd_send(); - - TEST_ASSERT(calculate_checksum(resp_buf, - sizeof(*resp) + resp->data_len) == 0); - TEST_ASSERT(resp->result == EC_RES_SUCCESS); - TEST_ASSERT(r->out_data == 0x12243648); - - return EC_SUCCESS; -} - -static int test_hostcmd_too_short(void) -{ - hostcmd_fill_in_default(); - - /* Smaller than header */ - pkt.request_size = sizeof(*req) - 4; - hostcmd_send(); - TEST_ASSERT(resp->result == EC_RES_REQUEST_TRUNCATED); - - /* Smaller than expected data size */ - pkt.request_size = sizeof(*req); - hostcmd_send(); - TEST_ASSERT(resp->result == EC_RES_REQUEST_TRUNCATED); - - return EC_SUCCESS; -} - -static int test_hostcmd_too_long(void) -{ - hostcmd_fill_in_default(); - - /* Larger than request buffer */ - pkt.request_size = BUFFER_SIZE + 4; - hostcmd_send(); - TEST_ASSERT(resp->result == EC_RES_REQUEST_TRUNCATED); - - return EC_SUCCESS; -} - -static int test_hostcmd_driver_error(void) -{ - hostcmd_fill_in_default(); - - pkt.driver_result = EC_RES_ERROR; - hostcmd_send(); - TEST_ASSERT(resp->result == EC_RES_ERROR); - - return EC_SUCCESS; -} - -static int test_hostcmd_invalid_command(void) -{ - hostcmd_fill_in_default(); - - req->command = 0xff; - hostcmd_send(); - TEST_ASSERT(resp->result == EC_RES_INVALID_COMMAND); - - return EC_SUCCESS; -} - -static int test_hostcmd_wrong_command_version(void) -{ - hostcmd_fill_in_default(); - - req->command_version = 1; - hostcmd_send(); - TEST_ASSERT(resp->result == EC_RES_INVALID_VERSION); - - return EC_SUCCESS; -} - -static int test_hostcmd_wrong_struct_version(void) -{ - hostcmd_fill_in_default(); - - req->struct_version = 4; - hostcmd_send(); - TEST_ASSERT(resp->result == EC_RES_INVALID_HEADER); - - req->struct_version = 2; - hostcmd_send(); - TEST_ASSERT(resp->result == EC_RES_INVALID_HEADER); - - return EC_SUCCESS; -} - -static int test_hostcmd_invalid_checksum(void) -{ - hostcmd_fill_in_default(); - - req->checksum++; - hostcmd_send(); - TEST_ASSERT(resp->result == EC_RES_INVALID_CHECKSUM); - - return EC_SUCCESS; -} - -static int test_hostcmd_reuse_response_buffer(void) -{ - struct ec_host_request *h = (struct ec_host_request *)resp_buf; - struct ec_params_hello *d = - (struct ec_params_hello *)(resp_buf + sizeof(*h)); - - h->struct_version = 3; - h->checksum = 0; - h->command = EC_CMD_HELLO; - h->command_version = 0; - h->reserved = 0; - h->data_len = 4; - d->in_data = 0x11223344; - - pkt.send_response = hostcmd_respond; - /* - * The original request buffer is shared with the response and the - * request buffer is used as the temporary buffer - */ - pkt.request = (const void *)resp_buf; - pkt.request_temp = req_buf; - pkt.request_max = BUFFER_SIZE; - pkt.request_size = sizeof(*h) + sizeof(*d); - pkt.response = (void *)resp_buf; - pkt.response_max = BUFFER_SIZE; - pkt.driver_result = 0; - - h->checksum = calculate_checksum(resp_buf, pkt.request_size); - - ccprintf("\nBuffer contents before process 0x%ph\n", - HEX_BUF(resp_buf, BUFFER_SIZE)); - host_packet_receive(&pkt); - task_wait_event(-1); - - ccprintf("\nBuffer contents after process 0x%ph\n", - HEX_BUF(resp_buf, BUFFER_SIZE)); - - TEST_EQ(calculate_checksum(resp_buf, - sizeof(*resp) + resp->data_len), 0, "%d"); - TEST_EQ(resp->result, EC_RES_SUCCESS, "%d"); - TEST_EQ(r->out_data, 0x12243648, "0x%x"); - - return EC_SUCCESS; -} - -static void hostcmd_fill_chip_info(void) -{ - req->struct_version = 3; - req->checksum = 0; - req->command = EC_CMD_GET_CHIP_INFO; - req->command_version = 0; - req->reserved = 0; - req->data_len = 0; - - pkt.send_response = hostcmd_respond; - pkt.request = (const void *)req_buf; - pkt.request_temp = NULL; - pkt.request_max = BUFFER_SIZE; - pkt.request_size = sizeof(*req); - pkt.response = (void *)resp_buf; - pkt.response_max = BUFFER_SIZE; - pkt.driver_result = 0; -} - -static int test_hostcmd_clears_unused_data(void) -{ - int i, found_null; - - /* Set the buffer to junk and ensure that is gets cleared */ - memset(resp_buf, 0xAA, BUFFER_SIZE); - hostcmd_fill_chip_info(); - - hostcmd_send(); - - ccprintf("\nBuffer contents 0x%ph\n", - HEX_BUF(resp_buf, BUFFER_SIZE)); - - TEST_EQ(calculate_checksum(resp_buf, - sizeof(*resp) + resp->data_len), 0, "%d"); - TEST_EQ(resp->result, EC_RES_SUCCESS, "%d"); - - /* Ensure partial strings have 0s after the NULL byte */ - found_null = 0; - for (i = 0; i < sizeof(chip_info_r->name); ++i) { - if (!chip_info_r->name[i]) - found_null = 1; - - if (found_null) { - if (chip_info_r->name[i]) - ccprintf("\nByte %d is not zero!\n", i); - TEST_EQ(chip_info_r->name[i], 0, "0x%x"); - } - } - - found_null = 0; - for (i = 0; i < sizeof(chip_info_r->revision); ++i) { - if (!chip_info_r->revision[i]) - found_null = 1; - - if (found_null) { - if (chip_info_r->revision[i]) - ccprintf("\nByte %d is not zero!\n", i); - TEST_EQ(chip_info_r->revision[i], 0, "0x%x"); - } - } - - found_null = 0; - for (i = 0; i < sizeof(chip_info_r->vendor); ++i) { - if (!chip_info_r->vendor[i]) - found_null = 1; - - if (found_null) { - if (chip_info_r->vendor[i]) - ccprintf("\nByte %d is not zero!\n", i); - TEST_EQ(chip_info_r->vendor[i], 0, "0x%x"); - } - } - - /* Ensure rest of buffer after valid response is also 0 */ - for (i = resp->data_len + sizeof(*resp) + 1; i < BUFFER_SIZE; ++i) { - if (resp_buf[i]) - ccprintf("\nByte %d is not zero!\n", i); - TEST_EQ(resp_buf[i], 0, "0x%x"); - } - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - wait_for_task_started(); - test_reset(); - - RUN_TEST(test_hostcmd_ok); - RUN_TEST(test_hostcmd_too_short); - RUN_TEST(test_hostcmd_too_long); - RUN_TEST(test_hostcmd_driver_error); - RUN_TEST(test_hostcmd_invalid_command); - RUN_TEST(test_hostcmd_wrong_command_version); - RUN_TEST(test_hostcmd_wrong_struct_version); - RUN_TEST(test_hostcmd_invalid_checksum); - RUN_TEST(test_hostcmd_reuse_response_buffer); - RUN_TEST(test_hostcmd_clears_unused_data); - - test_print_result(); -} diff --git a/test/host_command.tasklist b/test/host_command.tasklist deleted file mode 100644 index da0ab6211a..0000000000 --- a/test/host_command.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/i2c_bitbang.c b/test/i2c_bitbang.c deleted file mode 100644 index ab1136a922..0000000000 --- a/test/i2c_bitbang.c +++ /dev/null @@ -1,192 +0,0 @@ -/* Copyright 2019 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 "common.h" -#include "console.h" -#include "i2c.h" -#include "i2c_bitbang.h" -#include "test_util.h" -#include "util.h" - -const struct i2c_port_t i2c_bitbang_ports[] = { - {"", 0, 100, GPIO_I2C_SCL, GPIO_I2C_SDA} -}; -const unsigned int i2c_bitbang_ports_used = 1; - -struct pin_state { - int scl, sda; -} history[64]; - -int history_count; - -void reset_state(void) -{ - history[0] = (struct pin_state) {1, 1}; - history_count = 1; - bitbang_set_started(0); -} - -void gpio_set_level(enum gpio_signal signal, int level) -{ - struct pin_state new = history[history_count - 1]; - - /* reject if stack is full */ - if (history_count >= ARRAY_SIZE(history)) - return; - - if (signal == GPIO_I2C_SDA) - new.sda = level; - else if (signal == GPIO_I2C_SCL) - new.scl = level; - - if (new.scl != history[history_count - 1].scl || - new.sda != history[history_count - 1].sda) - history[history_count++] = new; -} - -int gpio_get_level(enum gpio_signal signal) -{ - if (signal == GPIO_I2C_SDA) - return history[history_count - 1].sda; - else if (signal == GPIO_I2C_SCL) - return history[history_count - 1].scl; - - return 0; -} - -static int test_i2c_start_stop(void) -{ - struct pin_state expected[] = { - /* start */ - {1, 1}, - {1, 0}, - {0, 0}, - /* stop */ - {1, 0}, - {1, 1}, - }; - int i; - - reset_state(); - - bitbang_start_cond(&i2c_bitbang_ports[0]); - bitbang_stop_cond(&i2c_bitbang_ports[0]); - - TEST_EQ((int)ARRAY_SIZE(expected), history_count, "%d"); - - for (i = 0; i < ARRAY_SIZE(expected); i++) { - TEST_EQ(expected[i].scl, history[i].scl, "%d"); - TEST_EQ(expected[i].sda, history[i].sda, "%d"); - } - - return EC_SUCCESS; -} - -static int test_i2c_repeated_start(void) -{ - struct pin_state expected[] = { - /* start */ - {1, 1}, - {1, 0}, - {0, 0}, - /* repeated start */ - {0, 1}, - {1, 1}, - {1, 0}, - {0, 0}, - }; - int i; - - reset_state(); - - bitbang_start_cond(&i2c_bitbang_ports[0]); - bitbang_start_cond(&i2c_bitbang_ports[0]); - - TEST_EQ((int)ARRAY_SIZE(expected), history_count, "%d"); - - for (i = 0; i < ARRAY_SIZE(expected); i++) { - TEST_EQ(expected[i].scl, history[i].scl, "%d"); - TEST_EQ(expected[i].sda, history[i].sda, "%d"); - } - - return EC_SUCCESS; -} - -static int test_i2c_write(void) -{ - struct pin_state expected[] = { - /* start */ - {1, 1}, - {1, 0}, - {0, 0}, - /* bit 7: 0 */ - {1, 0}, - {0, 0}, - /* bit 6: 1 */ - {0, 1}, - {1, 1}, - {0, 1}, - /* bit 5: 0 */ - {0, 0}, - {1, 0}, - {0, 0}, - /* bit 4: 1 */ - {0, 1}, - {1, 1}, - {0, 1}, - /* bit 3: 0 */ - {0, 0}, - {1, 0}, - {0, 0}, - /* bit 2: 1 */ - {0, 1}, - {1, 1}, - {0, 1}, - /* bit 1: 1 */ - {1, 1}, - {0, 1}, - /* bit 0: 0 */ - {0, 0}, - {1, 0}, - {0, 0}, - /* read bit */ - {0, 1}, - {1, 1}, - {0, 1}, - /* stop */ - {0, 0}, - {1, 0}, - {1, 1}, - }; - int i, ret; - - reset_state(); - - bitbang_start_cond(&i2c_bitbang_ports[0]); - ret = bitbang_write_byte(&i2c_bitbang_ports[0], 0x56); - - /* expected to fail because no slave answering the nack bit */ - TEST_EQ(EC_ERROR_BUSY, ret, "%d"); - - TEST_EQ((int)ARRAY_SIZE(expected), history_count, "%d"); - - for (i = 0; i < ARRAY_SIZE(expected); i++) { - TEST_EQ(expected[i].scl, history[i].scl, "%d"); - TEST_EQ(expected[i].sda, history[i].sda, "%d"); - } - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_i2c_start_stop); - RUN_TEST(test_i2c_repeated_start); - RUN_TEST(test_i2c_write); - - test_print_result(); -} diff --git a/test/i2c_bitbang.tasklist b/test/i2c_bitbang.tasklist deleted file mode 100644 index 9fc1a80f4d..0000000000 --- a/test/i2c_bitbang.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST diff --git a/test/inductive_charging.c b/test/inductive_charging.c deleted file mode 100644 index d487e171fd..0000000000 --- a/test/inductive_charging.c +++ /dev/null @@ -1,170 +0,0 @@ -/* Copyright 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. - * - * Test inductive charging module. - */ - -#include "common.h" -#include "console.h" -#include "gpio.h" -#include "hooks.h" -#include "inductive_charging.h" -#include "lid_switch.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -#define START_CHARGE_DELAY 5000 /* ms */ -#define MONITOR_CHARGE_DONE_DELAY 1000 /* ms */ -#define TEST_CHECK_CHARGE_DELAY (START_CHARGE_DELAY + \ - MONITOR_CHARGE_DONE_DELAY + 500) /* ms */ - -static void wait_for_lid_debounce(void) -{ - while (lid_is_open() != gpio_get_level(GPIO_LID_OPEN)) - msleep(20); -} - -static void set_lid_open(int lid_open) -{ - gpio_set_level(GPIO_LID_OPEN, lid_open); - wait_for_lid_debounce(); -} - -static int test_lid(void) -{ - /* Lid is open initially */ - set_lid_open(1); - gpio_set_level(GPIO_CHARGE_DONE, 0); - TEST_ASSERT(gpio_get_level(GPIO_BASE_CHG_VDD_EN) == 0); - - /* - * Close the lid. The EC should wait for 5 second before - * enabling transmitter. - */ - set_lid_open(0); - TEST_ASSERT(gpio_get_level(GPIO_BASE_CHG_VDD_EN) == 0); - msleep(TEST_CHECK_CHARGE_DELAY); - - /* Transmitter should now be enabled. */ - TEST_ASSERT(gpio_get_level(GPIO_BASE_CHG_VDD_EN) == 1); - TEST_ASSERT(gpio_get_level(GPIO_CHARGE_EN) == 1); - - /* Open the lid. Charging should stop. */ - set_lid_open(1); - msleep(TEST_CHECK_CHARGE_DELAY); - TEST_ASSERT(gpio_get_level(GPIO_BASE_CHG_VDD_EN) == 0); - TEST_ASSERT(gpio_get_level(GPIO_CHARGE_EN) == 0); - - return EC_SUCCESS; -} - -static int test_charge_done(void) -{ - /* Close the lid to start charging */ - set_lid_open(0); - msleep(TEST_CHECK_CHARGE_DELAY); - TEST_ASSERT(gpio_get_level(GPIO_BASE_CHG_VDD_EN) == 1); - TEST_ASSERT(gpio_get_level(GPIO_CHARGE_EN) == 1); - - /* Charging is done. Stop charging, but don't turn off transmitter. */ - gpio_set_level(GPIO_CHARGE_DONE, 1); - TEST_ASSERT(gpio_get_level(GPIO_BASE_CHG_VDD_EN) == 1); - TEST_ASSERT(gpio_get_level(GPIO_CHARGE_EN) == 0); - - /* Oops, CHARGE_DONE changes again. We should ignore it. */ - gpio_set_level(GPIO_CHARGE_DONE, 0); - TEST_ASSERT(gpio_get_level(GPIO_BASE_CHG_VDD_EN) == 1); - TEST_ASSERT(gpio_get_level(GPIO_CHARGE_EN) == 0); - - /* Open the lid. Charger should be turned off. */ - set_lid_open(1); - msleep(TEST_CHECK_CHARGE_DELAY); - TEST_ASSERT(gpio_get_level(GPIO_BASE_CHG_VDD_EN) == 0); - TEST_ASSERT(gpio_get_level(GPIO_CHARGE_EN) == 0); - - return EC_SUCCESS; -} - -static int test_lid_open_during_charging(void) -{ - /* Close the lid. Start charging. */ - set_lid_open(0); - msleep(TEST_CHECK_CHARGE_DELAY); - gpio_set_level(GPIO_CHARGE_DONE, 0); - TEST_ASSERT(gpio_get_level(GPIO_BASE_CHG_VDD_EN) == 1); - TEST_ASSERT(gpio_get_level(GPIO_CHARGE_EN) == 1); - - /* Open the lid. Transmitter should be turned off. */ - set_lid_open(1); - msleep(TEST_CHECK_CHARGE_DELAY); - TEST_ASSERT(gpio_get_level(GPIO_BASE_CHG_VDD_EN) == 0); - TEST_ASSERT(gpio_get_level(GPIO_CHARGE_EN) == 0); - - /* Toggle charge done signal. Charging should not start. */ - gpio_set_level(GPIO_CHARGE_DONE, 1); - TEST_ASSERT(gpio_get_level(GPIO_BASE_CHG_VDD_EN) == 0); - TEST_ASSERT(gpio_get_level(GPIO_CHARGE_EN) == 0); - gpio_set_level(GPIO_CHARGE_DONE, 0); - TEST_ASSERT(gpio_get_level(GPIO_BASE_CHG_VDD_EN) == 0); - TEST_ASSERT(gpio_get_level(GPIO_CHARGE_EN) == 0); - - return EC_SUCCESS; -} - -static int test_debounce_charge_done(void) -{ - /* Lid is open initially. */ - set_lid_open(1); - gpio_set_level(GPIO_CHARGE_DONE, 0); - msleep(TEST_CHECK_CHARGE_DELAY); - TEST_ASSERT(gpio_get_level(GPIO_BASE_CHG_VDD_EN) == 0); - TEST_ASSERT(gpio_get_level(GPIO_CHARGE_EN) == 0); - - /* Close the lid. Charging should start. */ - set_lid_open(0); - msleep(START_CHARGE_DELAY + 100); - TEST_ASSERT(gpio_get_level(GPIO_BASE_CHG_VDD_EN) == 1); - TEST_ASSERT(gpio_get_level(GPIO_CHARGE_EN) == 1); - - /* Within the first second, changes on CHARGE_DONE should be ignore. */ - gpio_set_level(GPIO_CHARGE_DONE, 1); - TEST_ASSERT(gpio_get_level(GPIO_BASE_CHG_VDD_EN) == 1); - TEST_ASSERT(gpio_get_level(GPIO_CHARGE_EN) == 1); - msleep(100); - TEST_ASSERT(gpio_get_level(GPIO_BASE_CHG_VDD_EN) == 1); - TEST_ASSERT(gpio_get_level(GPIO_CHARGE_EN) == 1); - gpio_set_level(GPIO_CHARGE_DONE, 0); - TEST_ASSERT(gpio_get_level(GPIO_BASE_CHG_VDD_EN) == 1); - TEST_ASSERT(gpio_get_level(GPIO_CHARGE_EN) == 1); - msleep(100); - TEST_ASSERT(gpio_get_level(GPIO_BASE_CHG_VDD_EN) == 1); - TEST_ASSERT(gpio_get_level(GPIO_CHARGE_EN) == 1); - - /* Changes on CHARGE_DONE after take effect. */ - msleep(MONITOR_CHARGE_DONE_DELAY); - gpio_set_level(GPIO_CHARGE_DONE, 1); - TEST_ASSERT(gpio_get_level(GPIO_BASE_CHG_VDD_EN) == 1); - TEST_ASSERT(gpio_get_level(GPIO_CHARGE_EN) == 0); - - /* Open the lid. Charger should be turned off. */ - set_lid_open(1); - msleep(TEST_CHECK_CHARGE_DELAY); - TEST_ASSERT(gpio_get_level(GPIO_BASE_CHG_VDD_EN) == 0); - TEST_ASSERT(gpio_get_level(GPIO_CHARGE_EN) == 0); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_lid); - RUN_TEST(test_charge_done); - RUN_TEST(test_lid_open_during_charging); - RUN_TEST(test_debounce_charge_done); - - test_print_result(); -} diff --git a/test/inductive_charging.tasklist b/test/inductive_charging.tasklist deleted file mode 100644 index f5c894ccaf..0000000000 --- a/test/inductive_charging.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/interrupt.c b/test/interrupt.c deleted file mode 100644 index ca98309e1f..0000000000 --- a/test/interrupt.c +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright 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. - * - * Test interrupt support of EC emulator. - */ -#include <stdio.h> - -#include "common.h" -#include "console.h" -#include "task.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -static int main_count; -static int has_error; -static int interrupt_count; - -/* period between 50us and 3.2ms */ -#define PERIOD_US(num) (((num % 64) + 1) * 50) - -void my_isr(void) -{ - int i = main_count; - udelay(3 * PERIOD_US(prng_no_seed())); - if (i != main_count || !in_interrupt_context()) - has_error = 1; - interrupt_count++; -} - -static volatile uint32_t enable_ready_reg; - -static void set_ready_bit(void) -{ - if (enable_ready_reg & BIT(0)) - enable_ready_reg |= BIT(1); -} - -void interrupt_generator(void) -{ - while (1) { - udelay(3 * PERIOD_US(prng_no_seed())); - task_trigger_test_interrupt(my_isr); - task_trigger_test_interrupt(set_ready_bit); - } -} - -static int interrupt_test(void) -{ - timestamp_t deadline = get_time(); - deadline.val += SECOND / 2; - while (!timestamp_expired(deadline, NULL)) - ++main_count; - - ccprintf("Interrupt count: %d\n", interrupt_count); - ccprintf("Main thread tick: %d\n", main_count); - - TEST_ASSERT(!has_error); - TEST_ASSERT(!in_interrupt_context()); - - return EC_SUCCESS; -} - -static int interrupt_disable_test(void) -{ - timestamp_t deadline = get_time(); - int start_int_cnt, end_int_cnt; - deadline.val += SECOND / 2; - - interrupt_disable(); - start_int_cnt = interrupt_count; - while (!timestamp_expired(deadline, NULL)) - ; - end_int_cnt = interrupt_count; - interrupt_enable(); - - TEST_ASSERT(start_int_cnt == end_int_cnt); - - return EC_SUCCESS; -} - -static int test_wait_for_ready(void) -{ - wait_for_ready(&enable_ready_reg, BIT(0), BIT(1)); - TEST_EQ(enable_ready_reg, BIT(0) | BIT(1), "%x"); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(interrupt_test); - RUN_TEST(interrupt_disable_test); - RUN_TEST(test_wait_for_ready); - - test_print_result(); -} diff --git a/test/interrupt.tasklist b/test/interrupt.tasklist deleted file mode 100644 index da0ab6211a..0000000000 --- a/test/interrupt.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/irq_locking.c b/test/irq_locking.c deleted file mode 100644 index 6d08b1175d..0000000000 --- a/test/irq_locking.c +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright 2020 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 "task.h" -#include "test_util.h" - -static uint32_t interrupt_disable_count; -static uint32_t interrupt_enable_count; - -/** Mock implementation of interrupt_disable. */ -void interrupt_disable(void) -{ - ++interrupt_disable_count; -} - -/** Mock implementation of interrupt_enable. */ -void interrupt_enable(void) -{ - ++interrupt_enable_count; -} - -static int test_simple_lock_unlock(void) -{ - uint32_t key = irq_lock(); - - irq_unlock(key); - - TEST_EQ(interrupt_disable_count, 1, "%u"); - TEST_EQ(interrupt_enable_count, 1, "%u"); - - return EC_SUCCESS; -} - -static int test_unlock_when_all_keys_removed(void) -{ - uint32_t key0 = irq_lock(); - uint32_t key1 = irq_lock(); - - TEST_EQ(interrupt_disable_count, 2, "%u"); - - irq_unlock(key1); - - TEST_EQ(interrupt_enable_count, 0, "%u"); - - irq_unlock(key0); - - TEST_EQ(interrupt_enable_count, 1, "%u"); - - return EC_SUCCESS; -} - -static int test_unlock_from_root_key(void) -{ - uint32_t key0 = irq_lock(); - uint32_t key1 = irq_lock(); - - TEST_NE(key0, key1, "%u"); - TEST_EQ(interrupt_disable_count, 2, "%u"); - - irq_unlock(key0); - TEST_EQ(interrupt_enable_count, 1, "%u"); - - return EC_SUCCESS; -} - -void before_test(void) -{ - interrupt_disable_count = 0; - interrupt_enable_count = 0; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_simple_lock_unlock); - RUN_TEST(test_unlock_when_all_keys_removed); - RUN_TEST(test_unlock_from_root_key); - - test_print_result(); -} diff --git a/test/irq_locking.tasklist b/test/irq_locking.tasklist deleted file mode 100644 index 2d7fbb0541..0000000000 --- a/test/irq_locking.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2020 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task. */ diff --git a/test/is_enabled.c b/test/is_enabled.c deleted file mode 100644 index fe93bafc31..0000000000 --- a/test/is_enabled.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright 2019 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. - * - * Test the IS_ENABLED macro. - */ -#include "common.h" -#include "test_util.h" - -#undef CONFIG_UNDEFINED -#define CONFIG_BLANK - -static int test_undef(void) -{ - TEST_ASSERT(IS_ENABLED(CONFIG_UNDEFINED) == 0); - - return EC_SUCCESS; -} - -static int test_blank(void) -{ - TEST_ASSERT(IS_ENABLED(CONFIG_BLANK) == 1); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_undef); - RUN_TEST(test_blank); - - test_print_result(); -} diff --git a/test/is_enabled.tasklist b/test/is_enabled.tasklist deleted file mode 100644 index 5ffe662d01..0000000000 --- a/test/is_enabled.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/is_enabled_error.c b/test/is_enabled_error.c deleted file mode 100644 index 3fcd80afe0..0000000000 --- a/test/is_enabled_error.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright 2019 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. - * - * Test the IS_ENABLED macro fails on unexpected input. - */ -#include "common.h" -#include "test_util.h" - -#define CONFIG_VALUE TEST_VALUE - -static int test_invalid_value(void) -{ - /* This will cause a compilation error */ - TEST_ASSERT(IS_ENABLED(CONFIG_VALUE) == 0); - - return EC_ERROR_UNKNOWN; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_invalid_value); - - test_print_result(); -} diff --git a/test/is_enabled_error.sh b/test/is_enabled_error.sh deleted file mode 100644 index 1e5407f31f..0000000000 --- a/test/is_enabled_error.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -e -# Copyright 2019 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. - -TEST_DIR="$(dirname "${BASH_SOURCE[0]}")" - -TEST_CMD="$(cat "${TEST_DIR}/RO/test/is_enabled_error.o.cmd")" - -TEST_ERROR_COUNT=0 - -for test_value in 0 1 2 A "5 + 5"; do - echo -n "Running TEST_VALUE=${test_value}..." - TEST_CMD_COMPLETE="${TEST_CMD} \"-DTEST_VALUE=${test_value}\"" - if BUILD_OUTPUT="$(sh -c "$TEST_CMD_COMPLETE" 2>&1)"; then - echo "Fail" - echo "Compilation should not have succeeded for" \ - "TEST_VALUE=${test_value}" - echo "$BUILD_OUTPUT" - TEST_ERROR_COUNT=$((TEST_ERROR_COUNT+1)) - continue - fi - - EXPECTED_ERROR="CONFIG_VALUE must be <blank>, or not defined" - if grep -q "$EXPECTED_ERROR" <<< "$BUILD_OUTPUT"; then - echo "OK" - else - echo "Fail" - echo "Expected to find: $EXPECTED_ERROR" - echo "Actual error:" - echo "$BUILD_OUTPUT" - TEST_ERROR_COUNT=$((TEST_ERROR_COUNT+1)) - fi -done - -if [[ $TEST_ERROR_COUNT -eq 0 ]]; then - echo "Pass!" -else - echo "Fail! (${TEST_ERROR_COUNT} tests)" -fi diff --git a/test/is_enabled_error.tasklist b/test/is_enabled_error.tasklist deleted file mode 100644 index 5ffe662d01..0000000000 --- a/test/is_enabled_error.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/kasa.c b/test/kasa.c deleted file mode 100644 index 3ecd32a556..0000000000 --- a/test/kasa.c +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright 2020 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 "common.h" -#include "kasa.h" -#include "test_util.h" -#include "motion_sense.h" -#include <stdio.h> - -struct motion_sensor_t motion_sensors[] = {}; -const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); - -static int test_kasa_reset(void) -{ - struct kasa_fit kasa; - - kasa_reset(&kasa); - - TEST_EQ(kasa.nsamples, 0, "%u"); - TEST_NEAR(kasa.acc_x, 0.0f, 0.000001f, "%f"); - TEST_NEAR(kasa.acc_y, 0.0f, 0.000001f, "%f"); - TEST_NEAR(kasa.acc_z, 0.0f, 0.000001f, "%f"); - TEST_NEAR(kasa.acc_w, 0.0f, 0.000001f, "%f"); - - TEST_NEAR(kasa.acc_xx, 0.0f, 0.000001f, "%f"); - TEST_NEAR(kasa.acc_xy, 0.0f, 0.000001f, "%f"); - TEST_NEAR(kasa.acc_xz, 0.0f, 0.000001f, "%f"); - TEST_NEAR(kasa.acc_xw, 0.0f, 0.000001f, "%f"); - - TEST_NEAR(kasa.acc_yy, 0.0f, 0.000001f, "%f"); - TEST_NEAR(kasa.acc_yz, 0.0f, 0.000001f, "%f"); - TEST_NEAR(kasa.acc_yw, 0.0f, 0.000001f, "%f"); - - TEST_NEAR(kasa.acc_zz, 0.0f, 0.000001f, "%f"); - TEST_NEAR(kasa.acc_zw, 0.0f, 0.000001f, "%f"); - - return EC_SUCCESS; -} - -static int test_kasa_calculate(void) -{ - struct kasa_fit kasa; - fpv3_t bias; - float radius; - - kasa_reset(&kasa); - kasa_accumulate(&kasa, 1.01f, 0.01f, 0.01f); - kasa_accumulate(&kasa, -0.99f, 0.01f, 0.01f); - kasa_accumulate(&kasa, 0.01f, 1.01f, 0.01f); - kasa_accumulate(&kasa, 0.01f, -0.99f, 0.01f); - kasa_accumulate(&kasa, 0.01f, 0.01f, 1.01f); - kasa_accumulate(&kasa, 0.01f, 0.01f, -0.99f); - kasa_compute(&kasa, bias, &radius); - - TEST_NEAR(bias[0], 0.01f, 0.0001f, "%f"); - TEST_NEAR(bias[1], 0.01f, 0.0001f, "%f"); - TEST_NEAR(bias[2], 0.01f, 0.0001f, "%f"); - TEST_NEAR(radius, 1.0f, 0.0001f, "%f"); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_kasa_reset); - RUN_TEST(test_kasa_calculate); - - test_print_result(); -} diff --git a/test/kasa.tasklist b/test/kasa.tasklist deleted file mode 100644 index 0e3696c3f0..0000000000 --- a/test/kasa.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(MOTIONSENSE, motion_sense_task, NULL, TASK_STACK_SIZE) diff --git a/test/kb_8042.c b/test/kb_8042.c deleted file mode 100644 index 9705b506fe..0000000000 --- a/test/kb_8042.c +++ /dev/null @@ -1,345 +0,0 @@ -/* Copyright 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. - * - * Tests for keyboard MKBP protocol - */ - -#include "common.h" -#include "console.h" -#include "ec_commands.h" -#include "gpio.h" -#include "i8042_protocol.h" -#include "keyboard_8042.h" -#include "keyboard_protocol.h" -#include "keyboard_scan.h" -#include "lpc.h" -#include "power_button.h" -#include "system.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -static const char *action[2] = {"release", "press"}; - -#define BUF_SIZE 16 -static char lpc_char_buf[BUF_SIZE]; -static unsigned int lpc_char_cnt; - -/*****************************************************************************/ -/* Mock functions */ - -int lid_is_open(void) -{ - return 1; -} - -void lpc_keyboard_put_char(uint8_t chr, int send_irq) -{ - lpc_char_buf[lpc_char_cnt++] = chr; -} - -/*****************************************************************************/ -/* Test utilities */ - -static void press_key(int c, int r, int pressed) -{ - ccprintf("Input %s (%d, %d)\n", action[pressed], c, r); - keyboard_state_changed(r, c, pressed); -} - -static void enable_keystroke(int enabled) -{ - uint8_t data = enabled ? I8042_CMD_ENABLE : I8042_CMD_RESET_DIS; - keyboard_host_write(data, 0); - msleep(30); -} - -static void reset_8042(void) -{ - keyboard_host_write(I8042_CMD_RESET_DEF, 0); - msleep(30); -} - -static void set_typematic(uint8_t val) -{ - keyboard_host_write(I8042_CMD_SETREP, 0); - msleep(30); - keyboard_host_write(val, 0); - msleep(30); -} - -static void set_scancode(uint8_t s) -{ - keyboard_host_write(I8042_CMD_SSCANSET, 0); - msleep(30); - keyboard_host_write(s, 0); - msleep(30); -} - -static void write_cmd_byte(uint8_t val) -{ - keyboard_host_write(I8042_WRITE_CMD_BYTE, 1); - msleep(30); - keyboard_host_write(val, 0); - msleep(30); -} - -static uint8_t read_cmd_byte(void) -{ - lpc_char_cnt = 0; - keyboard_host_write(I8042_READ_CMD_BYTE, 1); - msleep(30); - return lpc_char_buf[0]; -} - -static int __verify_lpc_char(char *arr, unsigned int sz, int delay_ms) -{ - int i; - - lpc_char_cnt = 0; - for (i = 0; i < sz; ++i) - lpc_char_buf[i] = 0; - msleep(delay_ms); - TEST_ASSERT_ARRAY_EQ(arr, lpc_char_buf, sz); - return EC_SUCCESS; -} - -#define VERIFY_LPC_CHAR(s) \ - TEST_ASSERT(__verify_lpc_char(s, strlen(s), 30) == EC_SUCCESS) -#define VERIFY_LPC_CHAR_DELAY(s, t) \ - TEST_ASSERT(__verify_lpc_char(s, strlen(s), t) == EC_SUCCESS) - -static int __verify_no_char(void) -{ - lpc_char_cnt = 0; - msleep(30); - TEST_CHECK(lpc_char_cnt == 0); -} - -#define VERIFY_NO_CHAR() TEST_ASSERT(__verify_no_char() == EC_SUCCESS) - -/*****************************************************************************/ -/* Tests */ - -static int test_single_key_press(void) -{ - enable_keystroke(1); - press_key(1, 1, 1); - VERIFY_LPC_CHAR("\x01"); - press_key(1, 1, 0); - VERIFY_LPC_CHAR("\x81"); - - press_key(12, 6, 1); - VERIFY_LPC_CHAR("\xe0\x4d"); - press_key(12, 6, 0); - VERIFY_LPC_CHAR("\xe0\xcd"); - - return EC_SUCCESS; -} - -static int test_disable_keystroke(void) -{ - enable_keystroke(0); - press_key(1, 1, 1); - VERIFY_NO_CHAR(); - press_key(1, 1, 0); - VERIFY_NO_CHAR(); - - return EC_SUCCESS; -} - -static int test_typematic(void) -{ - enable_keystroke(1); - - /* - * 250ms delay, 8 chars / sec. - */ - set_typematic(0xf); - - press_key(1, 1, 1); - VERIFY_LPC_CHAR_DELAY("\x01\x01\x01\x01\x01", 650); - press_key(1, 1, 0); - VERIFY_LPC_CHAR_DELAY("\x81", 300); - - /* - * 500ms delay, 10.9 chars / sec. - */ - reset_8042(); - - press_key(1, 1, 1); - VERIFY_LPC_CHAR_DELAY("\x01\x01\x01", 650); - press_key(1, 1, 0); - VERIFY_LPC_CHAR_DELAY("\x81", 200); - - return EC_SUCCESS; -} - -static int test_scancode_set2(void) -{ - set_scancode(2); - - write_cmd_byte(read_cmd_byte() | I8042_XLATE); - press_key(1, 1, 1); - VERIFY_LPC_CHAR("\x01"); - press_key(1, 1, 0); - VERIFY_LPC_CHAR("\x81"); - - write_cmd_byte(read_cmd_byte() & ~I8042_XLATE); - press_key(1, 1, 1); - VERIFY_LPC_CHAR("\x76"); - press_key(1, 1, 0); - VERIFY_LPC_CHAR("\xf0\x76"); - - return EC_SUCCESS; -} - -static int test_power_button(void) -{ - gpio_set_level(GPIO_POWER_BUTTON_L, 1); - set_scancode(1); - test_chipset_on(); - - gpio_set_level(GPIO_POWER_BUTTON_L, 0); - VERIFY_LPC_CHAR_DELAY("\xe0\x5e", 100); - - gpio_set_level(GPIO_POWER_BUTTON_L, 1); - VERIFY_LPC_CHAR_DELAY("\xe0\xde", 100); - - set_scancode(2); - write_cmd_byte(read_cmd_byte() & ~I8042_XLATE); - - gpio_set_level(GPIO_POWER_BUTTON_L, 0); - VERIFY_LPC_CHAR_DELAY("\xe0\x37", 100); - - gpio_set_level(GPIO_POWER_BUTTON_L, 1); - VERIFY_LPC_CHAR_DELAY("\xe0\xf0\x37", 100); - - test_chipset_off(); - - gpio_set_level(GPIO_POWER_BUTTON_L, 0); - VERIFY_NO_CHAR(); - - gpio_set_level(GPIO_POWER_BUTTON_L, 1); - VERIFY_NO_CHAR(); - - return EC_SUCCESS; -} - -static int test_sysjump(void) -{ - set_scancode(2); - enable_keystroke(1); - - system_run_image_copy(EC_IMAGE_RW); - - /* Shouldn't reach here */ - return EC_ERROR_UNKNOWN; -} - -static int test_sysjump_cont(void) -{ - write_cmd_byte(read_cmd_byte() | I8042_XLATE); - press_key(1, 1, 1); - VERIFY_LPC_CHAR("\x01"); - press_key(1, 1, 0); - VERIFY_LPC_CHAR("\x81"); - - write_cmd_byte(read_cmd_byte() & ~I8042_XLATE); - press_key(1, 1, 1); - VERIFY_LPC_CHAR("\x76"); - press_key(1, 1, 0); - VERIFY_LPC_CHAR("\xf0\x76"); - - return EC_SUCCESS; -} - -static const struct ec_response_keybd_config keybd_config = { - .num_top_row_keys = 13, - .action_keys = { - TK_BACK, /* T1 */ - TK_REFRESH, /* T2 */ - TK_FULLSCREEN, /* T3 */ - TK_OVERVIEW, /* T4 */ - TK_SNAPSHOT, /* T5 */ - TK_BRIGHTNESS_DOWN, /* T6 */ - TK_BRIGHTNESS_UP, /* T7 */ - TK_KBD_BKLIGHT_DOWN, /* T8 */ - TK_KBD_BKLIGHT_UP, /* T9 */ - TK_PLAY_PAUSE, /* T10 */ - TK_VOL_MUTE, /* T11 */ - TK_VOL_DOWN, /* T12 */ - TK_VOL_UP, /* T13 */ - }, -}; - -__override const struct ec_response_keybd_config -*board_vivaldi_keybd_config(void) -{ - return &keybd_config; -} - -static int test_ec_cmd_get_keybd_config(void) -{ - struct ec_response_keybd_config resp; - int rv; - - rv = test_send_host_command(EC_CMD_GET_KEYBD_CONFIG, 0, NULL, 0, - &resp, sizeof(resp)); - if (rv != EC_RES_SUCCESS) { - ccprintf("Error: EC_CMD_GET_KEYBD_CONFIG cmd returns %d\n", rv); - return EC_ERROR_INVAL; - } - - if (memcmp(&resp, &keybd_config, sizeof(resp))) { - ccprintf("Error: EC_CMD_GET_KEYBD_CONFIG returned bad cfg\n"); - return EC_ERROR_INVAL; - } - - ccprintf("EC_CMD_GET_KEYBD_CONFIG response is good\n"); - return EC_SUCCESS; -} - -static int test_vivaldi_top_keys(void) -{ - set_scancode(2); - - /* Test REFRESH key */ - write_cmd_byte(read_cmd_byte() | I8042_XLATE); - press_key(2, 3, 1); /* Press T2 */ - VERIFY_LPC_CHAR("\xe0\x67"); /* Check REFRESH scancode in set-1 */ - - /* Test SNAPSHOT key */ - write_cmd_byte(read_cmd_byte() | I8042_XLATE); - press_key(4, 3, 1); /* Press T2 */ - VERIFY_LPC_CHAR("\xe0\x13"); /* Check SNAPSHOT scancode in set-1 */ - - /* Test VOL_UP key */ - write_cmd_byte(read_cmd_byte() | I8042_XLATE); - press_key(5, 3, 1); /* Press T2 */ - VERIFY_LPC_CHAR("\xe0\x30"); /* Check VOL_UP scancode in set-1 */ - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - wait_for_task_started(); - - if (system_get_image_copy() == EC_IMAGE_RO) { - RUN_TEST(test_single_key_press); - RUN_TEST(test_disable_keystroke); - RUN_TEST(test_typematic); - RUN_TEST(test_scancode_set2); - RUN_TEST(test_power_button); - RUN_TEST(test_ec_cmd_get_keybd_config); - RUN_TEST(test_vivaldi_top_keys); - RUN_TEST(test_sysjump); - } else { - RUN_TEST(test_sysjump_cont); - } - - test_print_result(); -} diff --git a/test/kb_8042.tasklist b/test/kb_8042.tasklist deleted file mode 100644 index 8cd35e6145..0000000000 --- a/test/kb_8042.tasklist +++ /dev/null @@ -1,12 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \ - TASK_TEST(KEYSCAN, keyboard_scan_task, NULL, 256) \ - TASK_TEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) diff --git a/test/kb_mkbp.c b/test/kb_mkbp.c deleted file mode 100644 index 3b191a47ac..0000000000 --- a/test/kb_mkbp.c +++ /dev/null @@ -1,303 +0,0 @@ -/* Copyright 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. - * - * Tests for keyboard MKBP protocol - */ - -#include "common.h" -#include "console.h" -#include "ec_commands.h" -#include "gpio.h" -#include "host_command.h" -#include "keyboard_mkbp.h" -#include "keyboard_protocol.h" -#include "keyboard_scan.h" -#include "test_util.h" -#include "util.h" - -static uint8_t state[KEYBOARD_COLS_MAX]; -static int ec_int_level; - -static const char *action[2] = {"release", "press"}; - -/*****************************************************************************/ -/* Mock functions */ - -void host_send_response(struct host_cmd_handler_args *args) -{ - /* Do nothing */ -} - -void gpio_set_level(enum gpio_signal signal, int level) -{ - if (signal == GPIO_EC_INT_L) - ec_int_level = !!level; -} - -int lid_is_open(void) -{ - return 1; -} - -/*****************************************************************************/ -/* Test utilities */ - -#define FIFO_EMPTY() (ec_int_level == 1) -#define FIFO_NOT_EMPTY() (ec_int_level == 0) - -void clear_state(void) -{ - memset(state, 0xff, KEYBOARD_COLS_MAX); -} - -void set_state(int c, int r, int pressed) -{ - uint8_t mask = (1 << r); - - if (pressed) - state[c] &= ~mask; - else - state[c] |= mask; -} - -int press_key(int c, int r, int pressed) -{ - ccprintf("Input %s (%d, %d)\n", action[pressed], c, r); - set_state(c, r, pressed); - return mkbp_keyboard_add(state); -} - -int verify_key(int c, int r, int pressed) -{ - struct host_cmd_handler_args args; - struct ec_response_get_next_event event; - int i; - - args.version = 0; - args.command = EC_CMD_GET_NEXT_EVENT; - args.params = NULL; - args.params_size = 0; - args.response = &event; - args.response_max = sizeof(event); - args.response_size = 0; - - if (c >= 0 && r >= 0) { - ccprintf("Verify %s (%d, %d)\n", action[pressed], c, r); - set_state(c, r, pressed); - - if (host_command_process(&args) != EC_RES_SUCCESS) - return 0; - - for (i = 0; i < KEYBOARD_COLS_MAX; ++i) - if (event.data.key_matrix[i] != state[i]) - return 0; - } else { - ccprintf("Verify no events available\n"); - if (host_command_process(&args) != EC_RES_UNAVAILABLE) - return 0; - } - - return 1; -} - -int verify_key_v2(int c, int r, int pressed, int expect_more) -{ - struct host_cmd_handler_args args; - struct ec_response_get_next_event_v1 event; - int i; - - args.version = 2; - args.command = EC_CMD_GET_NEXT_EVENT; - args.params = NULL; - args.params_size = 0; - args.response = &event; - args.response_max = sizeof(event); - args.response_size = 0; - - if (c >= 0 && r >= 0) { - ccprintf("Verify %s (%d, %d). Expect %smore.\n", - action[pressed], c, r, expect_more ? "" : "no "); - set_state(c, r, pressed); - - if (host_command_process(&args) != EC_RES_SUCCESS) - return 0; - - if (!!(event.event_type & EC_MKBP_HAS_MORE_EVENTS) != - expect_more) { - ccprintf("Incorrect more events!\n"); - return 0; - } - - for (i = 0; i < KEYBOARD_COLS_MAX; ++i) - if (event.data.key_matrix[i] != state[i]) - return 0; - } else { - ccprintf("Verify no events available\n"); - if (host_command_process(&args) != EC_RES_UNAVAILABLE) - return 0; - } - - return 1; -} - -int mkbp_config(struct ec_params_mkbp_set_config params) -{ - struct host_cmd_handler_args args; - - args.version = 0; - args.command = EC_CMD_MKBP_SET_CONFIG; - args.params = ¶ms; - args.params_size = sizeof(params); - args.response = NULL; - args.response_max = 0; - args.response_size = 0; - - return host_command_process(&args) == EC_RES_SUCCESS; -} - -int set_fifo_size(int sz) -{ - struct ec_params_mkbp_set_config params; - - params.config.valid_mask = EC_MKBP_VALID_FIFO_MAX_DEPTH; - params.config.valid_flags = 0; - params.config.fifo_max_depth = sz; - - return mkbp_config(params); -} - -int set_kb_scan_enabled(int enabled) -{ - struct ec_params_mkbp_set_config params; - - params.config.valid_mask = 0; - params.config.valid_flags = EC_MKBP_FLAGS_ENABLE; - params.config.flags = (enabled ? EC_MKBP_FLAGS_ENABLE : 0); - - return mkbp_config(params); -} - -void clear_mkbp_events(void) -{ - struct host_cmd_handler_args args; - struct ec_response_get_next_event event; - - args.version = 0; - args.command = EC_CMD_GET_NEXT_EVENT; - args.params = NULL; - args.params_size = 0; - args.response = &event; - args.response_max = sizeof(event); - args.response_size = 0; - - /* - * We should return EC_RES_UNAVAILABLE if there are no MKBP events left. - */ - while (host_command_process(&args) != EC_RES_UNAVAILABLE) - ; -} - -/*****************************************************************************/ -/* Tests */ - -int single_key_press(void) -{ - keyboard_clear_buffer(); - clear_state(); - TEST_ASSERT(press_key(0, 0, 1) == EC_SUCCESS); - TEST_ASSERT(FIFO_NOT_EMPTY()); - TEST_ASSERT(press_key(0, 0, 0) == EC_SUCCESS); - TEST_ASSERT(FIFO_NOT_EMPTY()); - - clear_state(); - TEST_ASSERT(verify_key(0, 0, 1)); - TEST_ASSERT(FIFO_NOT_EMPTY()); - TEST_ASSERT(verify_key(0, 0, 0)); - TEST_ASSERT(FIFO_EMPTY()); - - return EC_SUCCESS; -} - -int single_key_press_v2(void) -{ - keyboard_clear_buffer(); - clear_state(); - TEST_ASSERT(press_key(0, 0, 1) == EC_SUCCESS); - TEST_ASSERT(FIFO_NOT_EMPTY()); - TEST_ASSERT(press_key(0, 0, 0) == EC_SUCCESS); - TEST_ASSERT(FIFO_NOT_EMPTY()); - - clear_state(); - TEST_ASSERT(verify_key_v2(0, 0, 1, 1)); - TEST_ASSERT(FIFO_NOT_EMPTY()); - TEST_ASSERT(verify_key_v2(0, 0, 0, 0)); - TEST_ASSERT(FIFO_EMPTY()); - - return EC_SUCCESS; -} - -int test_fifo_size(void) -{ - keyboard_clear_buffer(); - clear_state(); - TEST_ASSERT(set_fifo_size(1)); - TEST_ASSERT(press_key(0, 0, 1) == EC_SUCCESS); - TEST_ASSERT(press_key(0, 0, 0) == EC_ERROR_OVERFLOW); - - clear_state(); - TEST_ASSERT(verify_key(0, 0, 1)); - TEST_ASSERT(FIFO_EMPTY()); - - /* Restore FIFO size */ - TEST_ASSERT(set_fifo_size(100)); - - return EC_SUCCESS; -} - -int test_enable(void) -{ - keyboard_clear_buffer(); - clear_state(); - TEST_ASSERT(set_kb_scan_enabled(0)); - TEST_ASSERT(press_key(0, 0, 1) == EC_SUCCESS); - TEST_ASSERT(FIFO_EMPTY()); - - TEST_ASSERT(set_kb_scan_enabled(1)); - TEST_ASSERT(press_key(0, 0, 1) == EC_SUCCESS); - TEST_ASSERT(FIFO_NOT_EMPTY()); - TEST_ASSERT(verify_key(0, 0, 1)); - - return EC_SUCCESS; -} - -int fifo_underrun(void) -{ - keyboard_clear_buffer(); - clear_state(); - TEST_ASSERT(press_key(0, 0, 1) == EC_SUCCESS); - - clear_state(); - TEST_ASSERT(verify_key(0, 0, 1)); - - /* When FIFO under run, host command reutns last known state */ - TEST_ASSERT(verify_key(-1, -1, -1)); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - ec_int_level = 1; - test_reset(); - - /* Clear any pending events such as lid open. */ - clear_mkbp_events(); - RUN_TEST(single_key_press); - RUN_TEST(single_key_press_v2); - RUN_TEST(test_fifo_size); - RUN_TEST(test_enable); - RUN_TEST(fifo_underrun); - - test_print_result(); -} diff --git a/test/kb_mkbp.tasklist b/test/kb_mkbp.tasklist deleted file mode 100644 index d84996c71c..0000000000 --- a/test/kb_mkbp.tasklist +++ /dev/null @@ -1,11 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(KEYSCAN, keyboard_scan_task, NULL, 256) \ - TASK_TEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) diff --git a/test/kb_scan.c b/test/kb_scan.c deleted file mode 100644 index a43808c0c1..0000000000 --- a/test/kb_scan.c +++ /dev/null @@ -1,653 +0,0 @@ -/* Copyright 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. - * Copyright 2013 Google Inc. - * - * Tests for keyboard scan deghosting and debouncing. - */ - -#include "common.h" -#include "console.h" -#include "gpio.h" -#include "hooks.h" -#include "host_command.h" -#include "keyboard_raw.h" -#include "keyboard_scan.h" -#include "lid_switch.h" -#include "system.h" -#include "task.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -#define KEYDOWN_DELAY_MS 10 -#define KEYDOWN_RETRY 10 -#define NO_KEYDOWN_DELAY_MS 100 - -#define CHECK_KEY_COUNT(old, expected) \ - do { \ - if (verify_key_presses(old, expected) != EC_SUCCESS) \ - return EC_ERROR_UNKNOWN; \ - old = fifo_add_count; \ - } while (0) - -/* Emulated physical key state */ -static uint8_t mock_state[KEYBOARD_COLS_MAX]; - -/* Snapshot of last known key state */ -static uint8_t key_state[KEYBOARD_COLS_MAX]; - -/* Counters for key state changes (UP/DOWN) */ -static int key_state_change[KEYBOARD_COLS_MAX][KEYBOARD_ROWS]; -static int total_key_state_change; - -static int column_driven; -static int fifo_add_count; -static int lid_open; -#ifdef EMU_BUILD -static int hibernated; -static int reset_called; -#endif - -/* - * Helper method to wake a given task, and provide immediate opportunity to run. - */ -static void task_wake_then_sleep_1ms(int task_id) -{ - task_wake(task_id); - msleep(1); -} - -#ifdef CONFIG_LID_SWITCH -int lid_is_open(void) -{ - return lid_open; -} -#endif - -void keyboard_raw_drive_column(int out) -{ - column_driven = out; -} - -int keyboard_raw_read_rows(void) -{ - int i; - int r = 0; - - if (column_driven == KEYBOARD_COLUMN_NONE) { - return 0; - } else if (column_driven == KEYBOARD_COLUMN_ALL) { - for (i = 0; i < KEYBOARD_COLS_MAX; ++i) - r |= mock_state[i]; - return r; - } else { - return mock_state[column_driven]; - } -} - -int mkbp_keyboard_add(const uint8_t *buffp) -{ - int c, r; - - fifo_add_count++; - - for (c = 0; c < KEYBOARD_COLS_MAX; c++) { - uint8_t diff = key_state[c] ^ buffp[c]; - - for (r = 0; r < KEYBOARD_ROWS; r++) { - if (diff & BIT(r)) { - key_state_change[c][r]++; - total_key_state_change++; - } - } - } - - /* Save a snapshot. */ - memcpy(key_state, buffp, sizeof(key_state)); - - return EC_SUCCESS; -} - -#ifdef EMU_BUILD -void system_hibernate(uint32_t s, uint32_t us) -{ - hibernated = 1; -} - -void chipset_reset(void) -{ - reset_called = 1; -} -#endif - -#define mock_defined_key(k, p) mock_key(KEYBOARD_ROW_ ## k, \ - KEYBOARD_COL_ ## k, \ - p) - -#define mock_default_key(k, p) mock_key(KEYBOARD_DEFAULT_ROW_ ## k, \ - KEYBOARD_DEFAULT_COL_ ## k, \ - p) - -static void mock_key(int r, int c, int keydown) -{ - ccprintf(" %s (%d, %d)\n", keydown ? "Pressing" : "Releasing", r, c); - if (keydown) - mock_state[c] |= (1 << r); - else - mock_state[c] &= ~(1 << r); -} - -static void reset_key_state(void) -{ - memset(mock_state, 0, sizeof(mock_state)); - memset(key_state, 0, sizeof(key_state)); - memset(key_state_change, 0, sizeof(key_state_change)); - task_wake(TASK_ID_KEYSCAN); - msleep(NO_KEYDOWN_DELAY_MS); - total_key_state_change = 0; -} - -static int expect_keychange(void) -{ - int old_count = fifo_add_count; - int retry = KEYDOWN_RETRY; - task_wake(TASK_ID_KEYSCAN); - while (retry--) { - msleep(KEYDOWN_DELAY_MS); - if (fifo_add_count > old_count) - return EC_SUCCESS; - } - return EC_ERROR_UNKNOWN; -} - -static int expect_no_keychange(void) -{ - int old_count = fifo_add_count; - task_wake(TASK_ID_KEYSCAN); - msleep(NO_KEYDOWN_DELAY_MS); - return (fifo_add_count == old_count) ? EC_SUCCESS : EC_ERROR_UNKNOWN; -} - -static int host_command_simulate(int r, int c, int keydown) -{ - struct ec_params_mkbp_simulate_key params; - - params.col = c; - params.row = r; - params.pressed = keydown; - - return test_send_host_command(EC_CMD_MKBP_SIMULATE_KEY, 0, ¶ms, - sizeof(params), NULL, 0); -} - -static int verify_key_presses(int old, int expected) -{ - int retry = KEYDOWN_RETRY; - - if (expected == 0) { - msleep(NO_KEYDOWN_DELAY_MS); - return (fifo_add_count == old) ? EC_SUCCESS : EC_ERROR_UNKNOWN; - } else { - while (retry--) { - msleep(KEYDOWN_DELAY_MS); - if (fifo_add_count == old + expected) - return EC_SUCCESS; - } - return EC_ERROR_UNKNOWN; - } -} - -static int deghost_test(void) -{ - reset_key_state(); - - /* Test we can detect a keypress */ - mock_key(1, 1, 1); - TEST_ASSERT(expect_keychange() == EC_SUCCESS); - mock_key(1, 1, 0); - TEST_ASSERT(expect_keychange() == EC_SUCCESS); - - /* (1, 1) (1, 2) (2, 1) (2, 2) form ghosting keys */ - mock_key(1, 1, 1); - TEST_ASSERT(expect_keychange() == EC_SUCCESS); - mock_key(2, 2, 1); - TEST_ASSERT(expect_keychange() == EC_SUCCESS); - mock_key(1, 2, 1); - mock_key(2, 1, 1); - TEST_ASSERT(expect_no_keychange() == EC_SUCCESS); - mock_key(2, 1, 0); - mock_key(1, 2, 0); - TEST_ASSERT(expect_no_keychange() == EC_SUCCESS); - mock_key(2, 2, 0); - TEST_ASSERT(expect_keychange() == EC_SUCCESS); - mock_key(1, 1, 0); - TEST_ASSERT(expect_keychange() == EC_SUCCESS); - - /* (1, 1) (2, 0) (2, 1) don't form ghosting keys */ - mock_key(1, 1, 1); - TEST_ASSERT(expect_keychange() == EC_SUCCESS); - mock_key(2, 0, 1); - TEST_ASSERT(expect_keychange() == EC_SUCCESS); - mock_key(1, 0, 1); - mock_key(2, 1, 1); - TEST_ASSERT(expect_keychange() == EC_SUCCESS); - mock_key(1, 0, 0); - mock_key(2, 1, 0); - TEST_ASSERT(expect_keychange() == EC_SUCCESS); - mock_key(2, 0, 0); - TEST_ASSERT(expect_keychange() == EC_SUCCESS); - mock_key(1, 1, 0); - TEST_ASSERT(expect_keychange() == EC_SUCCESS); - - return EC_SUCCESS; -} - -static int strict_debounce_test(void) -{ - reset_key_state(); - - ccprintf("Test key press & hold.\n"); - mock_key(1, 1, 1); - TEST_EQ(expect_keychange(), EC_SUCCESS, "%d"); - TEST_EQ(key_state_change[1][1], 1, "%d"); - TEST_EQ(total_key_state_change, 1, "%d"); - ccprintf("Pass.\n"); - - reset_key_state(); - - ccprintf("Test a short stroke.\n"); - mock_key(1, 1, 1); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - mock_key(1, 1, 0); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - TEST_EQ(expect_no_keychange(), EC_SUCCESS, "%d"); - TEST_EQ(key_state_change[1][1], 0, "%d"); - ccprintf("Pass.\n"); - - reset_key_state(); - - ccprintf("Test ripples being suppressed.\n"); - /* DOWN */ - mock_key(1, 1, 1); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - mock_key(1, 1, 0); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - mock_key(1, 1, 1); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - TEST_EQ(expect_keychange(), EC_SUCCESS, "%d"); - TEST_EQ(key_state_change[1][1], 1, "%d"); - TEST_EQ(total_key_state_change, 1, "%d"); - /* UP */ - mock_key(1, 1, 0); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - mock_key(1, 1, 1); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - mock_key(1, 1, 0); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - TEST_EQ(expect_keychange(), EC_SUCCESS, "%d"); - TEST_EQ(key_state_change[1][1], 2, "%d"); - TEST_EQ(total_key_state_change, 2, "%d"); - ccprintf("Pass.\n"); - - reset_key_state(); - - ccprintf("Test simultaneous strokes.\n"); - mock_key(1, 1, 1); - mock_key(2, 1, 1); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - TEST_EQ(expect_keychange(), EC_SUCCESS, "%d"); - TEST_EQ(key_state_change[1][1], 1, "%d"); - TEST_EQ(key_state_change[1][2], 1, "%d"); - TEST_EQ(total_key_state_change, 2, "%d"); - ccprintf("Pass.\n"); - - reset_key_state(); - - ccprintf("Test simultaneous strokes in two columns.\n"); - mock_key(1, 1, 1); - mock_key(1, 2, 1); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - TEST_EQ(expect_keychange(), EC_SUCCESS, "%d"); - TEST_EQ(key_state_change[1][1], 1, "%d"); - TEST_EQ(key_state_change[2][1], 1, "%d"); - TEST_EQ(total_key_state_change, 2, "%d"); - ccprintf("Pass.\n"); - - reset_key_state(); - - ccprintf("Test normal & short simultaneous strokes.\n"); - mock_key(1, 1, 1); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - mock_key(2, 1, 1); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - mock_key(1, 1, 0); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - TEST_EQ(expect_keychange(), EC_SUCCESS, "%d"); - TEST_EQ(key_state_change[1][1], 0, "%d"); - TEST_EQ(key_state_change[1][2], 1, "%d"); - TEST_EQ(total_key_state_change, 1, "%d"); - ccprintf("Pass.\n"); - - reset_key_state(); - - ccprintf("Test normal & short simultaneous strokes in two columns.\n"); - reset_key_state(); - mock_key(1, 1, 1); - task_wake(TASK_ID_KEYSCAN); - mock_key(1, 2, 1); - task_wake(TASK_ID_KEYSCAN); - mock_key(1, 1, 0); - task_wake(TASK_ID_KEYSCAN); - TEST_EQ(expect_keychange(), EC_SUCCESS, "%d"); - TEST_EQ(key_state_change[1][1], 0, "%d"); - TEST_EQ(key_state_change[2][1], 1, "%d"); - TEST_EQ(total_key_state_change, 1, "%d"); - ccprintf("Pass.\n"); - - return EC_SUCCESS; -} - -static int debounce_test(void) -{ - int old_count = fifo_add_count; - int i; - - reset_key_state(); - - /* One brief keypress is detected. */ - msleep(40); - mock_key(1, 1, 1); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - mock_key(1, 1, 0); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - CHECK_KEY_COUNT(old_count, 2); - - /* Brief bounce, followed by continuous press is detected as one. */ - msleep(40); - mock_key(1, 1, 1); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - mock_key(1, 1, 0); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - mock_key(1, 1, 1); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - CHECK_KEY_COUNT(old_count, 1); - - /* Brief lifting, then re-presseing is detected as new keypress. */ - msleep(40); - mock_key(1, 1, 0); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - mock_key(1, 1, 1); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - CHECK_KEY_COUNT(old_count, 2); - - /* One bouncy re-contact while lifting is ignored. */ - msleep(40); - mock_key(1, 1, 0); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - mock_key(1, 1, 1); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - mock_key(1, 1, 0); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - CHECK_KEY_COUNT(old_count, 1); - - /* - * Debounce interval of first key is not affected by continued - * activity of other keys. - */ - msleep(40); - /* Push the first key */ - mock_key(0, 1, 0); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - /* - * Push down each subsequent key, until all 8 are pressed, each - * time bouncing the former one once. - */ - for (i = 1 ; i < 8; i++) { - mock_key(i, 1, 1); - task_wake(TASK_ID_KEYSCAN); - msleep(3); - mock_key(i - 1, 1, 0); - task_wake(TASK_ID_KEYSCAN); - msleep(1); - mock_key(i - 1, 1, 1); - task_wake(TASK_ID_KEYSCAN); - msleep(1); - } - /* Verify that the bounces were. ignored */ - CHECK_KEY_COUNT(old_count, 8); - /* - * Now briefly lift and re-press the first one, which should now be past - * its debounce interval - */ - mock_key(0, 1, 0); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - CHECK_KEY_COUNT(old_count, 1); - mock_key(0, 1, 1); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - CHECK_KEY_COUNT(old_count, 1); - /* For good measure, release all keys before proceeding. */ - for (i = 0; i < 8; i++) - mock_key(i, 1, 0); - task_wake_then_sleep_1ms(TASK_ID_KEYSCAN); - - return EC_SUCCESS; -} - -static int simulate_key_test(void) -{ - int old_count; - - reset_key_state(); - - task_wake(TASK_ID_KEYSCAN); - msleep(40); /* Wait for debouncing to settle */ - - old_count = fifo_add_count; - host_command_simulate(1, 1, 1); - TEST_ASSERT(fifo_add_count > old_count); - msleep(40); - old_count = fifo_add_count; - host_command_simulate(1, 1, 0); - TEST_ASSERT(fifo_add_count > old_count); - msleep(40); - - return EC_SUCCESS; -} - -#ifdef EMU_BUILD -static int wait_variable_set(int *var) -{ - int retry = KEYDOWN_RETRY; - *var = 0; - task_wake(TASK_ID_KEYSCAN); - while (retry--) { - msleep(KEYDOWN_DELAY_MS); - if (*var == 1) - return EC_SUCCESS; - } - return EC_ERROR_UNKNOWN; -} - -static int verify_variable_not_set(int *var) -{ - *var = 0; - task_wake(TASK_ID_KEYSCAN); - msleep(NO_KEYDOWN_DELAY_MS); - return *var ? EC_ERROR_UNKNOWN : EC_SUCCESS; -} - -static int runtime_key_test(void) -{ - reset_key_state(); - - /* Alt-VolUp-H triggers system hibernation */ - mock_defined_key(LEFT_ALT, 1); - mock_default_key(VOL_UP, 1); - mock_defined_key(KEY_H, 1); - TEST_ASSERT(wait_variable_set(&hibernated) == EC_SUCCESS); - mock_defined_key(LEFT_ALT, 0); - mock_default_key(VOL_UP, 0); - mock_defined_key(KEY_H, 0); - TEST_ASSERT(expect_keychange() == EC_SUCCESS); - - /* Alt-VolUp-R triggers chipset reset */ - mock_defined_key(RIGHT_ALT, 1); - mock_default_key(VOL_UP, 1); - mock_defined_key(KEY_R, 1); - TEST_ASSERT(wait_variable_set(&reset_called) == EC_SUCCESS); - mock_defined_key(RIGHT_ALT, 0); - mock_default_key(VOL_UP, 0); - mock_defined_key(KEY_R, 0); - TEST_ASSERT(expect_keychange() == EC_SUCCESS); - - /* Must press exactly 3 keys to trigger runtime keys */ - mock_defined_key(LEFT_ALT, 1); - mock_defined_key(KEY_H, 1); - mock_defined_key(KEY_R, 1); - mock_default_key(VOL_UP, 1); - TEST_ASSERT(verify_variable_not_set(&hibernated) == EC_SUCCESS); - TEST_ASSERT(verify_variable_not_set(&reset_called) == EC_SUCCESS); - mock_default_key(VOL_UP, 0); - mock_defined_key(KEY_R, 0); - mock_defined_key(KEY_H, 0); - mock_defined_key(LEFT_ALT, 0); - TEST_ASSERT(expect_keychange() == EC_SUCCESS); - - return EC_SUCCESS; -} -#endif - -#ifdef CONFIG_LID_SWITCH -static int lid_test(void) -{ - reset_key_state(); - - msleep(40); /* Allow debounce to settle */ - - lid_open = 0; - hook_notify(HOOK_LID_CHANGE); - msleep(1); /* Allow hooks to run */ - mock_key(1, 1, 1); - TEST_ASSERT(expect_no_keychange() == EC_SUCCESS); - mock_key(1, 1, 0); - TEST_ASSERT(expect_no_keychange() == EC_SUCCESS); - - lid_open = 1; - hook_notify(HOOK_LID_CHANGE); - msleep(1); /* Allow hooks to run */ - mock_key(1, 1, 1); - TEST_ASSERT(expect_keychange() == EC_SUCCESS); - mock_key(1, 1, 0); - TEST_ASSERT(expect_keychange() == EC_SUCCESS); - - return EC_SUCCESS; -} -#endif - -static int test_check_boot_esc(void) -{ - TEST_CHECK(keyboard_scan_get_boot_keys() == BOOT_KEY_ESC); -} - -static int test_check_boot_down(void) -{ - TEST_CHECK(keyboard_scan_get_boot_keys() == BOOT_KEY_DOWN_ARROW); -} - -void test_init(void) -{ - uint32_t state; - - system_get_scratchpad(&state); - - if (state & TEST_STATE_MASK(TEST_STATE_STEP_2)) { - /* Power-F3-ESC */ - system_set_reset_flags(system_get_reset_flags() | - EC_RESET_FLAG_RESET_PIN); - mock_key(KEYBOARD_ROW_ESC, KEYBOARD_COL_ESC, 1); - } else if (state & TEST_STATE_MASK(TEST_STATE_STEP_3)) { - /* Power-F3-Down */ - system_set_reset_flags(system_get_reset_flags() | - EC_RESET_FLAG_RESET_PIN); - mock_key(6, 11, 1); - } -} - -static void run_test_step1(void) -{ - lid_open = 1; - hook_notify(HOOK_LID_CHANGE); - test_reset(); - - RUN_TEST(deghost_test); - - if (IS_ENABLED(CONFIG_KEYBOARD_STRICT_DEBOUNCE)) - RUN_TEST(strict_debounce_test); - else - RUN_TEST(debounce_test); - - if (0) /* crbug.com/976974 */ - RUN_TEST(simulate_key_test); -#ifdef EMU_BUILD - RUN_TEST(runtime_key_test); -#endif -#ifdef CONFIG_LID_SWITCH - RUN_TEST(lid_test); -#endif - - if (test_get_error_count()) - test_reboot_to_next_step(TEST_STATE_FAILED); - else - test_reboot_to_next_step(TEST_STATE_STEP_2); -} - -static void run_test_step2(void) -{ - lid_open = 1; - hook_notify(HOOK_LID_CHANGE); - test_reset(); - - RUN_TEST(test_check_boot_esc); - - if (test_get_error_count()) - test_reboot_to_next_step(TEST_STATE_FAILED); - else - test_reboot_to_next_step(TEST_STATE_STEP_3); -} - -static void run_test_step3(void) -{ - lid_open = 1; - hook_notify(HOOK_LID_CHANGE); - test_reset(); - - RUN_TEST(test_check_boot_down); - - if (test_get_error_count()) - test_reboot_to_next_step(TEST_STATE_FAILED); - else - test_reboot_to_next_step(TEST_STATE_PASSED); -} - -void test_run_step(uint32_t state) -{ - if (state & TEST_STATE_MASK(TEST_STATE_STEP_1)) - run_test_step1(); - else if (state & TEST_STATE_MASK(TEST_STATE_STEP_2)) - run_test_step2(); - else if (state & TEST_STATE_MASK(TEST_STATE_STEP_3)) - run_test_step3(); -} - -int test_task(void *data) -{ - test_run_multistep(); - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - msleep(30); /* Wait for TASK_ID_TEST to initialize */ - task_wake(TASK_ID_TEST); -} diff --git a/test/kb_scan.tasklist b/test/kb_scan.tasklist deleted file mode 100644 index ded03b1112..0000000000 --- a/test/kb_scan.tasklist +++ /dev/null @@ -1,12 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(KEYSCAN, keyboard_scan_task, NULL, 256) \ - TASK_TEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \ - TASK_TEST(TEST, test_task, NULL, TASK_STACK_SIZE) diff --git a/test/kb_scan_strict.tasklist b/test/kb_scan_strict.tasklist deleted file mode 120000 index d4d4fa1efb..0000000000 --- a/test/kb_scan_strict.tasklist +++ /dev/null @@ -1 +0,0 @@ -kb_scan.tasklist
\ No newline at end of file diff --git a/test/key_sequence.txt b/test/key_sequence.txt deleted file mode 100644 index e9289f4745..0000000000 --- a/test/key_sequence.txt +++ /dev/null @@ -1,50 +0,0 @@ -# Key test sequence -# -# Format is <beat>[ <keys>] -# -# Note that there must be a single space between <beat> and <keys>, if present. -# The time is in units of beats, where the beat can be selected according to -# taste. A typical beat value would be 10ms, meaning that the beat counter -# will move on every 10,000us. -# -# The format of keys is a list of ascii characters, or & followed by a numeric -# ascii value, or * followed by a numeric keycode value. Spaces are ignored -# (use '*32' for space). -# -# Examples: -# abc - press a, b and c -# a &20 - press a and space -# *58 &13 - press KEY_CAPSLOCK and return (ctrl-m) -# -# It is possible for the beat counter to move forward at a variable speed. -# Provided that keyboard repeat does not occur, this should produce the same -# result. - -test 2-key rollover abc -expect abc -# Press a, then b, then release a, then release b -seq 0 -seq 1 a -seq 3 ab -seq 4 abc -seq 5 b -seq 8 -seq 9 -endtest - -test another -expect a -seq 0 -seq 5 a -seq 10 -endtest - -test fast -expect ab -seq 0 -seq 10 a -seq 20 ab -seq 30 b -seq 40 -endtest - diff --git a/test/legacy_nvmem_dump.h b/test/legacy_nvmem_dump.h deleted file mode 100644 index 6816673c23..0000000000 --- a/test/legacy_nvmem_dump.h +++ /dev/null @@ -1,1043 +0,0 @@ -/* - * Copyright 2016 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. - */ - -/* - * This is a test NVMEM snapshot, it includes a couple of key,value pairs and - * a set of TPM reserved and evictable objects, as created after the first - * Chrome OS boot on a device. - * - * This binary dump is placed in a separate file not to free up the test file - * using it. - */ - 0x00, 0x65, 0x8e, 0x10, 0x80, 0xca, 0x52, 0x1e, 0x95, 0x81, 0x12, 0x4f, - 0x36, 0x78, 0x9a, 0x34, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x10, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x63, 0x72, 0x6f, 0x73, 0x2d, 0x70, - 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x00, 0xe1, 0xac, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x37, 0x01, 0x00, - 0x03, 0x00, 0x00, 0x00, 0xbd, 0xfe, 0xff, 0xff, 0x85, 0xfc, 0x05, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xb0, 0xde, 0x01, 0x00, 0xb4, 0xde, 0x01, 0x00, - 0x9b, 0x0f, 0x06, 0x00, 0xbc, 0xde, 0x01, 0x00, 0x40, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, - 0x5b, 0x15, 0xa1, 0x0a, 0x05, 0x12, 0x58, 0x84, 0xbf, 0xf6, 0xc9, 0xf3, - 0xdd, 0xb7, 0x26, 0xce, 0x56, 0x9e, 0x5f, 0x7a, 0xa8, 0xd4, 0x8a, 0x67, - 0x5c, 0x26, 0x35, 0x0e, 0xb2, 0x13, 0x2c, 0x79, 0x20, 0x00, 0x26, 0xca, - 0x7d, 0xb8, 0x1a, 0x1f, 0x0b, 0x5c, 0x0a, 0xf3, 0xb5, 0xe2, 0x6a, 0xec, - 0x1a, 0x0d, 0x90, 0x8b, 0x92, 0x3c, 0x07, 0xb0, 0x41, 0xb0, 0x27, 0x20, - 0x88, 0x33, 0xfe, 0x5c, 0xf2, 0x7b, 0x20, 0x00, 0x9e, 0xb7, 0xa2, 0x4c, - 0xad, 0x6c, 0xc0, 0x92, 0x92, 0xef, 0xbc, 0x56, 0x65, 0x47, 0xf9, 0x09, - 0xd1, 0xc4, 0xbc, 0x36, 0xe8, 0x3a, 0xc2, 0x8a, 0x11, 0x3a, 0xca, 0xe1, - 0x66, 0xd7, 0x85, 0x57, 0x20, 0x00, 0x0c, 0x6d, 0xc7, 0x61, 0x92, 0xfc, - 0x1b, 0x24, 0x02, 0xc1, 0x92, 0x0e, 0xf4, 0xa1, 0x75, 0xbe, 0xb1, 0x3d, - 0x29, 0xfe, 0x1e, 0xe2, 0x65, 0xf5, 0x25, 0xae, 0xaf, 0xfe, 0x73, 0x32, - 0x35, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, - 0x52, 0x01, 0x7b, 0x53, 0xc5, 0x95, 0xa0, 0x3a, 0x07, 0xd5, 0x62, 0x7f, - 0xd3, 0x9c, 0x85, 0xaa, 0xfc, 0x56, 0xa0, 0xfa, 0x3a, 0xe8, 0x17, 0x38, - 0xc3, 0x59, 0x65, 0xbe, 0x75, 0x1b, 0xdc, 0xdc, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x84, 0xe7, 0x7e, 0x46, 0xfe, 0xbd, - 0x10, 0xdd, 0x5b, 0x09, 0xb2, 0xe2, 0xb1, 0x3f, 0xbf, 0x9a, 0xf3, 0xd7, - 0xfb, 0xf7, 0x28, 0xbb, 0x24, 0x10, 0xa3, 0xf3, 0x18, 0xa4, 0xa2, 0x16, - 0xd5, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x03, 0xff, 0xff, 0xff, 0x0b, 0x00, - 0x03, 0xff, 0xff, 0xff, 0x0c, 0x00, 0x03, 0xff, 0xff, 0xff, 0x0d, 0x00, - 0x03, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, - 0x00, 0x00, 0x00, 0xe8, 0x03, 0x00, 0x00, 0xe8, 0x03, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, - /* Manually added nonempty pcr. Array 0, index 0 */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x02, 0x03, 0x04, 0x05, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, - /* Manually added nonempty pcr. Array 1, index 1 */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x02, 0x03, 0x04, 0x05, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - /* Manually added ram index of size 0x20 */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x20, 0x00, 0x00, 0x00, 0x55, 0x55, - 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x69, 0x17, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, - 0xc0, 0x01, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x20, 0x04, 0x62, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xef, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xc0, 0x01, 0x30, 0x82, 0x03, 0xeb, 0x30, 0x82, 0x02, 0xd3, 0xa0, 0x03, - 0x02, 0x01, 0x02, 0x02, 0x10, 0x71, 0x7b, 0xc1, 0xfb, 0x3b, 0x21, 0xb5, - 0xfb, 0x02, 0x21, 0x1f, 0xb7, 0x0a, 0xbc, 0xe4, 0x88, 0x30, 0x0d, 0x06, - 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, - 0x30, 0x81, 0x80, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, - 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, - 0x08, 0x0c, 0x0a, 0x43, 0x61, 0x6c, 0x69, 0x66, 0x6f, 0x72, 0x6e, 0x69, - 0x61, 0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x0b, - 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x31, - 0x24, 0x30, 0x22, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c, 0x1b, 0x45, 0x6e, - 0x67, 0x69, 0x6e, 0x65, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x6e, - 0x64, 0x20, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x6d, 0x65, 0x6e, - 0x74, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x17, - 0x43, 0x52, 0x4f, 0x53, 0x20, 0x54, 0x50, 0x4d, 0x20, 0x50, 0x52, 0x44, - 0x20, 0x45, 0x4b, 0x20, 0x52, 0x4f, 0x4f, 0x54, 0x20, 0x43, 0x41, 0x30, - 0x1e, 0x17, 0x0d, 0x31, 0x38, 0x30, 0x37, 0x30, 0x36, 0x30, 0x30, 0x30, - 0x30, 0x30, 0x32, 0x5a, 0x17, 0x0d, 0x32, 0x38, 0x30, 0x37, 0x30, 0x36, - 0x30, 0x30, 0x30, 0x30, 0x30, 0x32, 0x5a, 0x30, 0x00, 0x30, 0x82, 0x01, - 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, - 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, - 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xf8, 0x26, 0xde, 0x99, 0xfa, 0x25, - 0xe1, 0xb6, 0xda, 0xb7, 0x88, 0x74, 0x77, 0x3d, 0x9a, 0x2e, 0xd0, 0xbd, - 0xda, 0x68, 0x8b, 0x1b, 0x8c, 0xe7, 0xd1, 0x0b, 0xf4, 0xfe, 0x8e, 0x94, - 0x09, 0x43, 0x11, 0x11, 0x46, 0xfc, 0x16, 0xb5, 0x15, 0x67, 0xab, 0x1b, - 0x8f, 0x25, 0xa7, 0x28, 0x04, 0xcc, 0xed, 0xf0, 0x5c, 0xbe, 0xa3, 0xfd, - 0x85, 0x85, 0x9b, 0xea, 0x6c, 0x61, 0x8b, 0x7e, 0xd2, 0x76, 0x2b, 0x37, - 0x87, 0x30, 0xd3, 0x9f, 0x0d, 0xb7, 0x0e, 0x31, 0x39, 0x3b, 0x3a, 0xa3, - 0xab, 0xb5, 0x21, 0x15, 0xb2, 0xc6, 0x7e, 0x78, 0xdc, 0x97, 0x53, 0x56, - 0x3f, 0xe9, 0xb4, 0x4e, 0xb8, 0xdd, 0x09, 0xa6, 0x37, 0xd3, 0xf7, 0x11, - 0xa2, 0x52, 0x50, 0xa6, 0x53, 0x44, 0xce, 0xb3, 0x9c, 0x02, 0xd8, 0x59, - 0x04, 0x3b, 0xba, 0x6c, 0xce, 0xf1, 0x6b, 0x33, 0x60, 0x14, 0x6b, 0xa0, - 0x3d, 0x2e, 0x66, 0x67, 0x82, 0x4f, 0x13, 0xa1, 0x82, 0xc4, 0x15, 0x08, - 0x7e, 0x59, 0xba, 0x84, 0x3e, 0xac, 0x12, 0x42, 0x98, 0x3d, 0x6e, 0xda, - 0xa9, 0xc3, 0xd7, 0x45, 0xeb, 0xc8, 0xec, 0x2a, 0x94, 0x9e, 0xc1, 0xf7, - 0x71, 0xca, 0x3d, 0xb3, 0xd2, 0x68, 0x2a, 0xc0, 0xbe, 0x9e, 0x2f, 0x26, - 0xf3, 0xf9, 0xb9, 0x7f, 0x21, 0x7f, 0x2f, 0x8b, 0x1b, 0x10, 0xb1, 0x09, - 0xc8, 0xab, 0xae, 0xda, 0xae, 0x66, 0x07, 0x4a, 0xc0, 0x75, 0x2a, 0x29, - 0x74, 0xb2, 0x99, 0xa6, 0x58, 0x84, 0xdc, 0x3e, 0x6b, 0x47, 0x37, 0xcb, - 0xb1, 0xc8, 0xcc, 0x81, 0xb3, 0x8b, 0x3a, 0x0c, 0xd4, 0x6a, 0x11, 0x3f, - 0x25, 0x17, 0x5d, 0xaf, 0x33, 0x8a, 0x32, 0x9d, 0x93, 0xef, 0xdb, 0x95, - 0x60, 0x5a, 0x15, 0xc5, 0x20, 0x7a, 0xec, 0xce, 0xa9, 0x31, 0x70, 0x24, - 0xd1, 0x4d, 0x29, 0xed, 0xeb, 0xec, 0xac, 0x53, 0x19, 0xc3, 0x02, 0x03, - 0x01, 0x00, 0x01, 0xa3, 0x81, 0xdf, 0x30, 0x81, 0xdc, 0x30, 0x0e, 0x06, - 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x00, - 0x20, 0x30, 0x51, 0x06, 0x03, 0x55, 0x1d, 0x11, 0x01, 0x01, 0xff, 0x04, - 0x47, 0x30, 0x45, 0xa4, 0x43, 0x30, 0x41, 0x31, 0x16, 0x30, 0x14, 0x06, - 0x05, 0x67, 0x81, 0x05, 0x02, 0x01, 0x0c, 0x0b, 0x69, 0x64, 0x3a, 0x34, - 0x37, 0x34, 0x46, 0x34, 0x46, 0x34, 0x37, 0x31, 0x0f, 0x30, 0x0d, 0x06, - 0x05, 0x67, 0x81, 0x05, 0x02, 0x02, 0x0c, 0x04, 0x48, 0x31, 0x42, 0x32, - 0x31, 0x16, 0x30, 0x14, 0x06, 0x05, 0x67, 0x81, 0x05, 0x02, 0x03, 0x0c, - 0x0b, 0x69, 0x64, 0x3a, 0x30, 0x30, 0x31, 0x33, 0x30, 0x30, 0x33, 0x37, - 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, - 0x30, 0x00, 0x30, 0x13, 0x06, 0x03, 0x55, 0x1d, 0x20, 0x04, 0x0c, 0x30, - 0x0a, 0x30, 0x08, 0x06, 0x06, 0x67, 0x81, 0x0c, 0x01, 0x02, 0x02, 0x30, - 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, - 0x15, 0x39, 0x34, 0xfc, 0x59, 0x19, 0xcd, 0x29, 0x82, 0xf1, 0xf4, 0x7f, - 0xad, 0x85, 0xd6, 0x44, 0x69, 0xa1, 0xa1, 0x7b, 0x30, 0x10, 0x06, 0x03, - 0x55, 0x1d, 0x25, 0x04, 0x09, 0x30, 0x07, 0x06, 0x05, 0x67, 0x81, 0x05, - 0x08, 0x01, 0x30, 0x21, 0x06, 0x03, 0x55, 0x1d, 0x09, 0x04, 0x1a, 0x30, - 0x18, 0x30, 0x16, 0x06, 0x05, 0x67, 0x81, 0x05, 0x02, 0x10, 0x31, 0x0d, - 0x30, 0x0b, 0x0c, 0x03, 0x32, 0x2e, 0x30, 0x02, 0x01, 0x00, 0x02, 0x01, - 0x10, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, - 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x00, 0x1a, 0xef, - 0x74, 0x00, 0x05, 0xa3, 0x1c, 0x8c, 0xec, 0x0b, 0x6d, 0x67, 0x1b, 0x26, - 0x34, 0x62, 0xb3, 0x0c, 0x04, 0x34, 0xf6, 0x8c, 0x60, 0xa3, 0xcc, 0x5a, - 0xa7, 0x5f, 0x30, 0xa1, 0x50, 0x13, 0xb5, 0xf2, 0x83, 0x49, 0xfb, 0x35, - 0x01, 0x74, 0xde, 0xba, 0x3d, 0xba, 0x81, 0x0c, 0x87, 0x92, 0xbb, 0x20, - 0xc8, 0xe3, 0x4e, 0x15, 0xd4, 0x6d, 0xe6, 0x6f, 0xae, 0xca, 0x29, 0xa2, - 0xba, 0x5a, 0xac, 0xb9, 0x0c, 0xef, 0x85, 0xce, 0x6c, 0x03, 0xbd, 0x57, - 0x41, 0x90, 0x13, 0x68, 0x7b, 0xe0, 0x5e, 0xc6, 0x96, 0xe6, 0xbd, 0x67, - 0x62, 0x83, 0x7b, 0xc1, 0xa6, 0xfc, 0x2e, 0xc7, 0x74, 0x54, 0xef, 0x93, - 0x28, 0x8b, 0x1f, 0x73, 0x3c, 0xa9, 0x11, 0x6e, 0xac, 0xdf, 0x9e, 0xe2, - 0xb5, 0x6d, 0x62, 0x44, 0xc3, 0xa0, 0xf6, 0x82, 0x7b, 0x23, 0x82, 0x73, - 0x91, 0x22, 0x11, 0x7b, 0xb8, 0x8a, 0x19, 0x45, 0x2b, 0x99, 0xdc, 0x7a, - 0xa1, 0x21, 0xd8, 0x37, 0x51, 0x60, 0xfb, 0x20, 0xab, 0x2d, 0x6c, 0x32, - 0x07, 0xb8, 0x15, 0xed, 0x7c, 0x62, 0xe9, 0xc9, 0x1d, 0x50, 0x6c, 0x6c, - 0x1b, 0x55, 0xcd, 0x92, 0xb6, 0xc1, 0x9a, 0x3d, 0xac, 0x01, 0xc0, 0x66, - 0xca, 0xc1, 0x91, 0x09, 0x50, 0x4d, 0x1a, 0xc0, 0x6f, 0xe3, 0x2d, 0x4b, - 0x7f, 0xee, 0xa9, 0xff, 0xeb, 0x0d, 0x5d, 0xe5, 0x64, 0xfd, 0x52, 0x6e, - 0x8a, 0x91, 0x2d, 0xd0, 0x13, 0xf5, 0xcd, 0x32, 0xfb, 0xe2, 0xe7, 0x6d, - 0xfb, 0x05, 0x6a, 0x2a, 0xec, 0xc8, 0xa6, 0xd3, 0x94, 0xee, 0x89, 0x40, - 0x24, 0x39, 0x84, 0x6a, 0xc1, 0xd4, 0x16, 0xdf, 0x0f, 0x79, 0x3b, 0x57, - 0x17, 0x4d, 0x2d, 0x58, 0x65, 0x19, 0xce, 0x0c, 0xf4, 0x86, 0x19, 0xa6, - 0xfe, 0xd7, 0xac, 0x7c, 0x15, 0x7d, 0x06, 0x08, 0xd2, 0xb6, 0xb9, 0x5e, - 0x00, 0x29, 0x1b, 0x00, 0x00, 0x01, 0x00, 0xc0, 0x01, 0x01, 0x00, 0xc0, - 0x01, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x20, 0x04, 0x62, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x24, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, - 0x01, 0x30, 0x82, 0x03, 0x20, 0x30, 0x82, 0x02, 0x08, 0xa0, 0x03, 0x02, - 0x01, 0x02, 0x02, 0x10, 0x64, 0x2e, 0x3d, 0x44, 0xaa, 0x6d, 0x90, 0x95, - 0x42, 0x28, 0x7d, 0x07, 0x5e, 0xe7, 0x68, 0x66, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, - 0x81, 0x80, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, - 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, - 0x0c, 0x0a, 0x43, 0x61, 0x6c, 0x69, 0x66, 0x6f, 0x72, 0x6e, 0x69, 0x61, - 0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x0b, 0x47, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x31, 0x24, - 0x30, 0x22, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c, 0x1b, 0x45, 0x6e, 0x67, - 0x69, 0x6e, 0x65, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x6e, 0x64, - 0x20, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x6d, 0x65, 0x6e, 0x74, - 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x17, 0x43, - 0x52, 0x4f, 0x53, 0x20, 0x54, 0x50, 0x4d, 0x20, 0x50, 0x52, 0x44, 0x20, - 0x45, 0x4b, 0x20, 0x52, 0x4f, 0x4f, 0x54, 0x20, 0x43, 0x41, 0x30, 0x1e, - 0x17, 0x0d, 0x31, 0x38, 0x30, 0x37, 0x30, 0x36, 0x30, 0x30, 0x30, 0x30, - 0x30, 0x32, 0x5a, 0x17, 0x0d, 0x32, 0x38, 0x30, 0x37, 0x30, 0x36, 0x30, - 0x30, 0x30, 0x30, 0x30, 0x32, 0x5a, 0x30, 0x00, 0x30, 0x59, 0x30, 0x13, - 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, - 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xad, - 0x72, 0x36, 0x6c, 0x76, 0x5e, 0x69, 0xa1, 0xf5, 0xeb, 0xbf, 0x5d, 0x38, - 0x1d, 0x76, 0xda, 0xb3, 0x80, 0xf6, 0xa8, 0xf3, 0x2c, 0x42, 0x7e, 0xc8, - 0xd7, 0xc9, 0x46, 0xbd, 0xc6, 0x80, 0x7f, 0xd3, 0xf4, 0xac, 0xa5, 0x60, - 0xa3, 0xf1, 0x31, 0x6c, 0xdf, 0x87, 0x95, 0x5c, 0xb6, 0xf3, 0x79, 0xff, - 0x7b, 0x46, 0x53, 0xec, 0x3f, 0x20, 0xde, 0x59, 0xa5, 0x2d, 0xcb, 0x77, - 0x55, 0x89, 0xad, 0xa3, 0x81, 0xdf, 0x30, 0x81, 0xdc, 0x30, 0x0e, 0x06, - 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x00, - 0x20, 0x30, 0x51, 0x06, 0x03, 0x55, 0x1d, 0x11, 0x01, 0x01, 0xff, 0x04, - 0x47, 0x30, 0x45, 0xa4, 0x43, 0x30, 0x41, 0x31, 0x16, 0x30, 0x14, 0x06, - 0x05, 0x67, 0x81, 0x05, 0x02, 0x01, 0x0c, 0x0b, 0x69, 0x64, 0x3a, 0x34, - 0x37, 0x34, 0x46, 0x34, 0x46, 0x34, 0x37, 0x31, 0x0f, 0x30, 0x0d, 0x06, - 0x05, 0x67, 0x81, 0x05, 0x02, 0x02, 0x0c, 0x04, 0x48, 0x31, 0x42, 0x32, - 0x31, 0x16, 0x30, 0x14, 0x06, 0x05, 0x67, 0x81, 0x05, 0x02, 0x03, 0x0c, - 0x0b, 0x69, 0x64, 0x3a, 0x30, 0x30, 0x31, 0x33, 0x30, 0x30, 0x33, 0x37, - 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, - 0x30, 0x00, 0x30, 0x13, 0x06, 0x03, 0x55, 0x1d, 0x20, 0x04, 0x0c, 0x30, - 0x0a, 0x30, 0x08, 0x06, 0x06, 0x67, 0x81, 0x0c, 0x01, 0x02, 0x02, 0x30, - 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, - 0x15, 0x39, 0x34, 0xfc, 0x59, 0x19, 0xcd, 0x29, 0x82, 0xf1, 0xf4, 0x7f, - 0xad, 0x85, 0xd6, 0x44, 0x69, 0xa1, 0xa1, 0x7b, 0x30, 0x10, 0x06, 0x03, - 0x55, 0x1d, 0x25, 0x04, 0x09, 0x30, 0x07, 0x06, 0x05, 0x67, 0x81, 0x05, - 0x08, 0x01, 0x30, 0x21, 0x06, 0x03, 0x55, 0x1d, 0x09, 0x04, 0x1a, 0x30, - 0x18, 0x30, 0x16, 0x06, 0x05, 0x67, 0x81, 0x05, 0x02, 0x10, 0x31, 0x0d, - 0x30, 0x0b, 0x0c, 0x03, 0x32, 0x2e, 0x30, 0x02, 0x01, 0x00, 0x02, 0x01, - 0x10, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, - 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x3a, 0xe0, 0x1e, - 0x15, 0xd7, 0x11, 0x97, 0xc6, 0xc3, 0x50, 0x9a, 0x0b, 0x7f, 0x0a, 0x5e, - 0x7d, 0xd2, 0xb8, 0x08, 0xc0, 0x98, 0x35, 0x73, 0x6d, 0x85, 0x19, 0x46, - 0x76, 0x27, 0xcb, 0xa3, 0x66, 0x7f, 0xc9, 0x26, 0x20, 0x52, 0xb5, 0xe9, - 0xf5, 0xa0, 0x7a, 0x1d, 0xb3, 0x78, 0x66, 0x6d, 0x13, 0xcb, 0x82, 0x5b, - 0x09, 0xdc, 0xcb, 0x01, 0x0c, 0x3e, 0x34, 0x4a, 0x92, 0x44, 0x30, 0x44, - 0xda, 0x49, 0xad, 0x45, 0x17, 0xc3, 0x5b, 0x80, 0x8c, 0xa5, 0x11, 0xc4, - 0x07, 0x1a, 0x06, 0x43, 0x9c, 0x57, 0x51, 0x42, 0x35, 0xfd, 0xec, 0x68, - 0xe3, 0xe8, 0x3f, 0x5b, 0xb0, 0x01, 0x4f, 0xcb, 0xe0, 0x2a, 0x7f, 0xe6, - 0x89, 0xcc, 0xef, 0x59, 0xbb, 0x11, 0xed, 0xcb, 0xe6, 0xc9, 0x55, 0x94, - 0xf0, 0x5b, 0xee, 0x33, 0xc9, 0xed, 0x1b, 0x02, 0xeb, 0x90, 0x33, 0x0e, - 0xc1, 0x8f, 0x1c, 0x37, 0x3f, 0x9c, 0x59, 0x96, 0xe7, 0x73, 0xb1, 0x90, - 0x7a, 0x93, 0x2f, 0x4e, 0x98, 0xff, 0xff, 0xa7, 0xfb, 0x7f, 0xb9, 0x1b, - 0x46, 0xb8, 0x64, 0x12, 0x92, 0x74, 0x54, 0xe1, 0x7f, 0x07, 0xfa, 0xc4, - 0x2e, 0x53, 0xa8, 0x6a, 0xe5, 0x23, 0x92, 0x9e, 0x39, 0x37, 0xfc, 0x5d, - 0x2f, 0x7b, 0x69, 0x84, 0xd3, 0x69, 0x4e, 0xd1, 0x98, 0xda, 0x53, 0x34, - 0x80, 0xe6, 0xeb, 0xd5, 0x9a, 0x10, 0x5d, 0xc9, 0x88, 0x2b, 0x13, 0x9c, - 0xb9, 0xad, 0x15, 0x4f, 0x3a, 0x6c, 0x0d, 0xd4, 0x50, 0x0b, 0x1d, 0xfb, - 0x36, 0x74, 0xf2, 0x3e, 0x32, 0xce, 0x69, 0x5f, 0x67, 0x63, 0x33, 0x0f, - 0x7b, 0xc9, 0x5e, 0x68, 0x39, 0xdf, 0xb9, 0xe2, 0x73, 0xd5, 0xd5, 0x40, - 0xd8, 0x62, 0x0a, 0x4e, 0x45, 0x6f, 0xc1, 0x92, 0x9c, 0x41, 0x58, 0x21, - 0xd4, 0x60, 0x0b, 0xc4, 0x7c, 0x9c, 0xe8, 0x57, 0x5c, 0xed, 0xbc, 0xc1, - 0xf4, 0x51, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc3, 0x3c, 0x43, - 0xf2, 0xe7, 0x82, 0xf3, 0x5c, 0xec, 0x61, 0x96, 0xef, 0xf5, 0xfb, 0x24, - 0x87, 0xaa, 0xf9, 0x5f, 0x3f, 0xf6, 0x5e, 0xdd, 0x0a, 0x59, 0x33, 0xbb, - 0xe1, 0xaf, 0x3b, 0xb2, 0x26, 0xfa, 0x1b, 0x00, 0x00, 0x08, 0x10, 0x00, - 0x01, 0x08, 0x10, 0x00, 0x01, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, - 0x60, 0x00, 0x00, 0x00, 0xe0, 0xd7, 0xdd, 0x01, 0x00, 0xe3, 0xad, 0x05, - 0x00, 0xe2, 0xad, 0x05, 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x53, 0x07, - 0x00, 0x00, 0x53, 0x07, 0x00, 0x30, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xd7, 0xdd, 0x01, 0x00, 0xd3, 0x3a, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xb0, 0xde, 0x01, 0x00, 0xb4, 0xde, 0x01, 0x00, 0x9b, 0x0f, 0x06, - 0x00, 0xbc, 0xde, 0x01, 0x00, 0x40, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0e, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x8c, 0xb5, 0x01, 0x00, 0xd7, 0xdd, 0x01, - 0x00, 0x1f, 0xbd, 0x05, 0x00, 0x4e, 0xbd, 0x05, 0x00, 0x00, 0x00, 0x00, - 0x41, 0x01, 0x00, 0x00, 0x00, 0x30, 0xe4, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x19, 0x53, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x4c, 0x57, 0x52, 0x47, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0xa0, 0x1c, 0x00, 0x00, 0x07, 0x10, - 0x00, 0x01, 0x07, 0x10, 0x00, 0x01, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x4c, - 0x05, 0x60, 0x20, 0x00, 0x09, 0x93, 0x3c, 0xce, 0xeb, 0xb4, 0x41, 0x11, - 0x18, 0x81, 0x1d, 0xd4, 0x47, 0x78, 0x80, 0x08, 0x88, 0x86, 0x62, 0x2d, - 0xd7, 0x79, 0x94, 0x46, 0x62, 0x26, 0x68, 0x8e, 0xee, 0xe6, 0x6a, 0xa1, - 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xb0, 0xde, 0x01, 0x00, 0xb4, 0xde, 0x01, 0x00, 0x9b, 0x0f, - 0x06, 0x00, 0xbc, 0xde, 0x01, 0x00, 0x40, 0x00, 0x0a, 0x00, 0x00, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x8c, 0xb5, 0x01, 0x00, 0xd7, 0xdd, - 0x01, 0x00, 0x1f, 0xbd, 0x05, 0x00, 0x4e, 0xbd, 0x05, 0x00, 0x00, 0x00, - 0x00, 0x41, 0x01, 0x00, 0x00, 0x00, 0x30, 0xe4, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x19, 0x53, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x4f, 0x64, 0x1d, 0x00, 0x00, 0x05, 0x00, 0x80, 0x01, - 0x05, 0x00, 0x80, 0x01, 0x0b, 0x00, 0x01, 0x00, 0x04, 0x28, 0x04, 0xb0, - 0x00, 0x00, 0x40, 0x00, 0xcd, 0xd4, 0x97, 0x24, 0x1f, 0x26, 0xd9, 0x91, - 0xad, 0xb8, 0xd2, 0xcb, 0x46, 0x14, 0x65, 0x72, 0x91, 0x8d, 0x56, 0x2e, - 0x7b, 0x3f, 0x74, 0x89, 0x80, 0xc6, 0x18, 0xbf, 0xea, 0x58, 0xe6, 0xf6, - 0x54, 0xde, 0x01, 0x00, 0xaa, 0x4c, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xb0, 0xde, 0x01, 0x00, 0xb4, 0xde, 0x01, 0x00, 0x9b, 0x0f, 0x06, 0x00, - 0xbc, 0xde, 0x01, 0x00, 0x40, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x01, - 0xfe, 0x1b, 0x00, 0x00, 0x05, 0x00, 0x80, 0x01, 0x43, 0xcf, 0x05, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x10, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, - 0xf0, 0xde, 0x01, 0x00, 0x69, 0x01, 0x00, 0x00, 0xb3, 0xd3, 0x05, 0x00, - 0xa4, 0xde, 0x01, 0x00, 0xa8, 0xde, 0x01, 0x00, 0xf4, 0xde, 0x01, 0x00, - 0xd1, 0x73, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0xde, 0x40, 0x00, - 0x78, 0x04, 0x01, 0x00, 0x32, 0x4d, 0x50, 0x54, 0x01, 0x00, 0x00, 0x00, - 0xe0, 0xa7, 0x0d, 0x1e, 0x0d, 0xe2, 0x5a, 0xb8, 0xd4, 0x5e, 0xb8, 0x2b, - 0xcc, 0x99, 0xd2, 0x6a, 0x8f, 0xf0, 0x52, 0x18, 0x72, 0x02, 0x16, 0x8e, - 0x83, 0x06, 0xba, 0x01, 0xe4, 0xcc, 0xbf, 0xcf, 0x80, 0x1f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x81, 0x38, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0b, - 0x00, 0x03, 0x04, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x80, 0x00, 0x43, - 0x00, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x9b, 0x0f, - 0x10, 0x85, 0x8c, 0x80, 0xfc, 0x15, 0x23, 0xeb, 0x29, 0x04, 0x2d, 0x2c, - 0xfc, 0xed, 0xc4, 0x1e, 0x3f, 0xf3, 0xc2, 0x3f, 0x42, 0xd0, 0x5c, 0x8d, - 0xe7, 0x3f, 0xc3, 0x17, 0x6d, 0xc5, 0x2c, 0xa8, 0x5f, 0x29, 0x80, 0x82, - 0xf2, 0x1f, 0xd1, 0x48, 0xfc, 0x50, 0x96, 0x51, 0x13, 0x5f, 0xbf, 0xa0, - 0xdf, 0xb0, 0x16, 0xe2, 0x80, 0x54, 0x11, 0x10, 0x7d, 0x05, 0xf6, 0x16, - 0x07, 0xd3, 0xbe, 0x8e, 0x16, 0x6c, 0x83, 0x56, 0xdc, 0xd9, 0x0d, 0x29, - 0x42, 0x26, 0x37, 0xa0, 0x5a, 0xa0, 0x47, 0x02, 0x80, 0xfd, 0x2c, 0x8c, - 0x23, 0x6c, 0x96, 0x44, 0x9f, 0xd6, 0x7e, 0x33, 0x70, 0xd0, 0xe7, 0x3c, - 0x93, 0xf6, 0x4c, 0xf3, 0xf9, 0x6f, 0x5d, 0x40, 0xa0, 0xb0, 0xf5, 0x69, - 0xcc, 0x60, 0x19, 0x83, 0x0b, 0xe1, 0xc6, 0xc7, 0x8b, 0xa1, 0x3a, 0x01, - 0x16, 0x68, 0xd6, 0x28, 0xf9, 0x19, 0xee, 0x2b, 0x74, 0x9a, 0xba, 0xac, - 0x5e, 0x4e, 0x8d, 0x1d, 0x86, 0xef, 0xaf, 0xa4, 0xb4, 0xbd, 0xd4, 0x97, - 0x08, 0x6f, 0x20, 0x9b, 0xb3, 0xe8, 0x5e, 0x43, 0x9e, 0xad, 0x05, 0xf8, - 0xf0, 0x18, 0x53, 0xaf, 0xda, 0xb7, 0xbc, 0xe1, 0x43, 0xda, 0x03, 0xc0, - 0xe4, 0x5a, 0xd1, 0x74, 0xc4, 0x63, 0x2c, 0x22, 0x64, 0x34, 0x61, 0x07, - 0x26, 0x3d, 0x8c, 0x91, 0x29, 0xcc, 0x22, 0x5f, 0x14, 0xe9, 0xef, 0x7e, - 0xbb, 0x80, 0xf3, 0xed, 0x35, 0xbb, 0xf9, 0xca, 0xa5, 0x53, 0xff, 0x47, - 0x9d, 0xc7, 0xf4, 0x1e, 0xfe, 0x24, 0xf1, 0xbd, 0x30, 0x3e, 0x4c, 0xd6, - 0x47, 0x2c, 0x00, 0x16, 0x78, 0x61, 0xc4, 0x72, 0xb1, 0x39, 0xe1, 0x5d, - 0x18, 0x10, 0xa4, 0x1c, 0x4e, 0x42, 0x27, 0xe4, 0xd2, 0x4b, 0xcb, 0x65, - 0x2f, 0x33, 0x69, 0x49, 0xca, 0x2a, 0x89, 0xc7, 0x5d, 0xca, 0x7e, 0xfd, - 0xf2, 0x6b, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x73, 0x9a, 0x3e, 0x61, - 0x92, 0x20, 0x63, 0x87, 0x6e, 0x99, 0xaa, 0x85, 0x7b, 0x24, 0x5e, 0xee, - 0xfe, 0x80, 0x4d, 0xaa, 0x66, 0x1e, 0x2b, 0xe6, 0x69, 0xca, 0x1f, 0xfd, - 0x41, 0xe8, 0x0e, 0xca, 0x00, 0x80, 0xc5, 0xdf, 0xa6, 0x9d, 0x5a, 0x23, - 0xde, 0xc4, 0x38, 0xfe, 0xd0, 0x80, 0x5e, 0x7d, 0xd3, 0x01, 0x07, 0xa3, - 0x93, 0x80, 0x19, 0xb8, 0xf4, 0xaa, 0xb1, 0xf4, 0x09, 0x78, 0x91, 0x52, - 0x48, 0xb1, 0x2b, 0x1b, 0xab, 0xcc, 0x60, 0x53, 0x20, 0x92, 0x85, 0xc6, - 0xf7, 0xff, 0x08, 0xee, 0x68, 0x6c, 0xfd, 0x3e, 0xd6, 0x9d, 0xda, 0x0d, - 0x03, 0x0c, 0x7c, 0xe0, 0x2b, 0x5c, 0xd4, 0x35, 0x9b, 0x3d, 0x7d, 0xd4, - 0x07, 0x7c, 0x8a, 0xc3, 0x79, 0xc0, 0x4b, 0x52, 0x20, 0x18, 0x2f, 0xfe, - 0x19, 0xe6, 0x41, 0xac, 0x31, 0xef, 0x32, 0x8e, 0x47, 0xdf, 0x0b, 0x8d, - 0x6b, 0x50, 0xbe, 0x15, 0xa2, 0x17, 0x51, 0xef, 0x5e, 0x87, 0xc3, 0x2e, - 0xd8, 0xf8, 0xb7, 0x72, 0xc9, 0x5d, 0xe8, 0x71, 0xef, 0x32, 0x02, 0x5d, - 0xc5, 0x49, 0x4e, 0xb7, 0xb8, 0xdc, 0xe3, 0x9d, 0xcb, 0x29, 0x49, 0x90, - 0xcf, 0xdf, 0x00, 0x00, 0x00, 0x22, 0x00, 0x0b, 0x96, 0xce, 0xc6, 0x42, - 0x3b, 0x6f, 0x58, 0x90, 0xd2, 0x2a, 0xbc, 0xc4, 0x59, 0xa1, 0xfb, 0x63, - 0xc4, 0xef, 0x59, 0x2a, 0x2d, 0x92, 0x76, 0xfa, 0xdb, 0xac, 0xf6, 0x7b, - 0x77, 0xb7, 0x56, 0x93, 0x81, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x0b, - 0x68, 0x0f, 0x54, 0x0a, 0x3f, 0x27, 0xdc, 0x66, 0x76, 0x1a, 0x35, 0x71, - 0xe2, 0x5c, 0x08, 0xcf, 0xac, 0x39, 0xea, 0xcc, 0x01, 0x54, 0x4e, 0x48, - 0xaa, 0xe1, 0x5c, 0xa5, 0xb7, 0xe1, 0x5b, 0x50, 0x7c, 0x20, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x81, 0x38, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x0b, - 0x00, 0x03, 0x04, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x80, 0x00, 0x43, - 0x00, 0x10, 0x00, 0x03, 0x00, 0x10, 0x00, 0x20, 0x6c, 0x05, 0x79, 0x5e, - 0x36, 0x4a, 0x04, 0x2c, 0x10, 0x8e, 0x50, 0xcc, 0x60, 0x7e, 0x18, 0xa1, - 0xe5, 0x4a, 0x96, 0x56, 0xf1, 0x5f, 0x34, 0x95, 0x36, 0xea, 0x00, 0x64, - 0xb9, 0xf4, 0x49, 0x91, 0x00, 0x20, 0x7f, 0x8c, 0xad, 0xea, 0x97, 0xba, - 0x99, 0x28, 0x93, 0xb4, 0xcc, 0xa7, 0x36, 0xfa, 0x61, 0xd8, 0x78, 0xb6, - 0x06, 0xcd, 0xe3, 0x27, 0x99, 0x7b, 0xaa, 0x3e, 0xa9, 0x4e, 0xf2, 0x93, - 0x18, 0x06, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x16, 0xba, 0x08, 0xd2, - 0xd8, 0x63, 0x38, 0xba, 0xb9, 0x0b, 0xce, 0x5b, 0x72, 0x9a, 0x88, 0x08, - 0x25, 0xb9, 0xbd, 0xab, 0x16, 0x77, 0x43, 0xbb, 0xcd, 0x3d, 0x4d, 0x48, - 0xbc, 0x77, 0xf8, 0xd3, 0x00, 0x20, 0x0f, 0xd6, 0x89, 0x31, 0xdc, 0xfa, - 0x70, 0x00, 0x6a, 0x4b, 0x59, 0x60, 0x28, 0x01, 0x54, 0x39, 0x4e, 0xa1, - 0x97, 0x28, 0xe0, 0x84, 0x92, 0x0e, 0x35, 0xdc, 0xb3, 0x9a, 0x11, 0x08, - 0x7c, 0x93, 0x00, 0x00, 0x00, 0x22, 0x00, 0x0b, 0x5d, 0xab, 0xa0, 0x5d, - 0x70, 0x5f, 0x6e, 0x78, 0xeb, 0x82, 0x8c, 0xb4, 0x77, 0x45, 0x95, 0x50, - 0x6b, 0x7c, 0x97, 0x5d, 0x2d, 0x31, 0x76, 0x0e, 0x81, 0x9e, 0x4b, 0xa3, - 0x80, 0xf5, 0xff, 0x86, 0x81, 0x00, 0x00, 0x01, 0x00, 0x22, 0x00, 0x0b, - 0x85, 0xf4, 0xbe, 0x91, 0xe1, 0x2b, 0x4c, 0x2d, 0xaa, 0x64, 0xb1, 0x90, - 0x5f, 0xec, 0x74, 0xea, 0xec, 0x2c, 0x3d, 0x0d, 0xbb, 0x26, 0xc0, 0x49, - 0x3d, 0xae, 0xa0, 0xe4, 0x72, 0xfa, 0xba, 0x15, 0x74, 0x22, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x81, 0x18, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0b, - 0x00, 0x02, 0x04, 0x72, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x08, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xed, 0x72, 0x50, 0x56, 0x10, 0xb7, - 0xab, 0x52, 0x50, 0x32, 0x4f, 0x82, 0x87, 0x94, 0x83, 0x84, 0x55, 0xeb, - 0xda, 0x78, 0x46, 0x34, 0x48, 0xc4, 0xc6, 0x28, 0x47, 0xf4, 0x4c, 0xfd, - 0x1f, 0x04, 0xcd, 0xb9, 0x72, 0x6a, 0x49, 0x6c, 0x1c, 0x9b, 0x07, 0x5b, - 0xe8, 0xef, 0xaf, 0x0b, 0xeb, 0xb1, 0xcb, 0x24, 0x0e, 0x63, 0x2f, 0x35, - 0x3c, 0x79, 0x0c, 0xde, 0xf5, 0xdb, 0x06, 0xe9, 0x68, 0xf4, 0xf0, 0x8e, - 0xf1, 0xbf, 0x98, 0x9a, 0xd9, 0x2b, 0x45, 0x85, 0x83, 0xda, 0xd9, 0xf3, - 0x6f, 0x1a, 0x24, 0xe8, 0x5d, 0xad, 0xda, 0xa7, 0xfc, 0x03, 0x67, 0xb0, - 0xdf, 0x07, 0xbd, 0xe1, 0x1e, 0x7d, 0xa1, 0xea, 0x59, 0xfb, 0xb9, 0x48, - 0x2d, 0x45, 0x0c, 0x1b, 0x52, 0x0e, 0xb3, 0xe6, 0xac, 0x4a, 0x91, 0x1c, - 0xb1, 0x2f, 0xee, 0xae, 0xf4, 0x0a, 0x79, 0x81, 0x92, 0xab, 0xaa, 0xff, - 0x44, 0x0f, 0x8d, 0xe7, 0x30, 0xfd, 0xee, 0x62, 0x0f, 0x92, 0x4d, 0x08, - 0xe7, 0xd0, 0xdb, 0x16, 0xf2, 0x27, 0x73, 0x59, 0x18, 0xc5, 0xd9, 0x0d, - 0xac, 0xaf, 0xc0, 0xd0, 0xdc, 0xfd, 0x1d, 0xeb, 0x74, 0x33, 0x59, 0xd6, - 0x30, 0xe1, 0x29, 0x81, 0xa5, 0xeb, 0x67, 0xc6, 0x32, 0x98, 0x37, 0x12, - 0xe8, 0x12, 0x3c, 0x5b, 0xd1, 0xc7, 0x9e, 0x9d, 0x5b, 0xe3, 0x7d, 0x5c, - 0xf6, 0x9e, 0x4d, 0xdf, 0x65, 0xe1, 0x95, 0x14, 0xf6, 0xda, 0x94, 0x91, - 0x76, 0x91, 0x6b, 0x39, 0x37, 0xf0, 0x72, 0xf9, 0x7f, 0xc1, 0x09, 0x9d, - 0x33, 0xf5, 0x26, 0x84, 0xe2, 0xa2, 0x94, 0xc3, 0xad, 0x4a, 0xc2, 0x86, - 0xa0, 0x1a, 0xf2, 0x0e, 0xa1, 0x98, 0xb1, 0x9f, 0x50, 0x54, 0xd5, 0xc8, - 0x58, 0x11, 0xc3, 0x76, 0x63, 0xc0, 0x49, 0x7b, 0xa5, 0x80, 0x79, 0x75, - 0xc0, 0x0c, 0xe9, 0x8a, 0xb0, 0xbe, 0x09, 0x54, 0xfa, 0x19, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xfa, 0x82, 0xd6, 0x21, 0xf1, 0x41, - 0x7e, 0xca, 0x35, 0x00, 0x73, 0x63, 0x3f, 0x8d, 0x38, 0xbd, 0x4d, 0xd0, - 0x27, 0x0d, 0xe2, 0x66, 0xa5, 0x3c, 0x47, 0x14, 0xe7, 0x36, 0x38, 0x87, - 0xe2, 0x5d, 0x6d, 0x2a, 0x19, 0x10, 0xee, 0xfe, 0xf1, 0x6d, 0x6d, 0xb5, - 0x2c, 0x2f, 0xe3, 0x8f, 0x9b, 0x5f, 0x73, 0x8b, 0xdd, 0x1b, 0x0d, 0xe8, - 0x81, 0x53, 0x79, 0x9b, 0xca, 0x86, 0x03, 0xf9, 0x2d, 0x6e, 0x85, 0x26, - 0x14, 0xa7, 0x71, 0xd5, 0xf8, 0xd8, 0x30, 0x27, 0x26, 0x08, 0x30, 0x17, - 0xf8, 0xc2, 0x17, 0x6a, 0xb3, 0x7e, 0x98, 0x69, 0x19, 0x94, 0x51, 0x34, - 0x94, 0x3c, 0xcf, 0x45, 0x9a, 0x9d, 0x9d, 0xea, 0xcf, 0x04, 0x74, 0x74, - 0x79, 0x09, 0x3f, 0xa0, 0xaa, 0x25, 0xd2, 0xda, 0x1f, 0x1a, 0xc6, 0x87, - 0xcf, 0x17, 0x1c, 0xfc, 0x1d, 0x59, 0x4e, 0x6d, 0x2f, 0x32, 0x28, 0x39, - 0xb0, 0xcd, 0x00, 0x00, 0x00, 0x22, 0x00, 0x0b, 0x92, 0x80, 0x9c, 0x28, - 0xa0, 0xc7, 0x75, 0x91, 0x80, 0xc9, 0x86, 0x63, 0xe1, 0xa7, 0x19, 0x33, - 0x21, 0xd8, 0x47, 0x8c, 0xac, 0xd4, 0x51, 0x7d, 0x78, 0x31, 0x84, 0x74, - 0x49, 0x63, 0x40, 0xba, 0x81, 0x00, 0x00, 0x02, 0x00, 0x22, 0x00, 0x0b, - 0xe9, 0x80, 0x8e, 0x73, 0x7d, 0xaa, 0xc3, 0xf8, 0x84, 0xaf, 0x7d, 0x18, - 0x10, 0x7c, 0xed, 0xf3, 0x14, 0x72, 0x61, 0x97, 0xb6, 0xd7, 0xbb, 0x3a, - 0x47, 0xb0, 0x91, 0xb0, 0xba, 0x7c, 0xbc, 0x04, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x01, 0x20, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x12, 0x00, 0x76, 0x61, 0x72, 0x31, 0x74, 0x68, 0x69, 0x73, 0x5f, - 0x69, 0x73, 0x5f, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x5f, - 0x31, 0x04, 0x12, 0x00, 0x76, 0x61, 0x72, 0x32, 0x74, 0x68, 0x69, 0x73, - 0x5f, 0x69, 0x73, 0x5f, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, - 0x5f, 0x32, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, diff --git a/test/lid_sw.c b/test/lid_sw.c deleted file mode 100644 index 8163f74716..0000000000 --- a/test/lid_sw.c +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright 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. - * - * Test lid switch. - */ - -#include "common.h" -#include "console.h" -#include "gpio.h" -#include "hooks.h" -#include "host_command.h" -#include "lid_switch.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -static int lid_hook_count; - -static void lid_change_hook(void) -{ - lid_hook_count++; -} -DECLARE_HOOK(HOOK_LID_CHANGE, lid_change_hook, HOOK_PRIO_DEFAULT); - -int lid_memmap_state(void) -{ - uint8_t *memmap = host_get_memmap(EC_MEMMAP_SWITCHES); - return *memmap & EC_SWITCH_LID_OPEN; -} - -static int test_hook(void) -{ - /* Close lid for testing */ - gpio_set_level(GPIO_LID_OPEN, 0); - msleep(100); - lid_hook_count = 0; - host_clear_events(0xffffffff); - - gpio_set_level(GPIO_LID_OPEN, 1); - msleep(50); - TEST_ASSERT(lid_hook_count == 1); - TEST_ASSERT(lid_is_open()); - TEST_ASSERT(lid_memmap_state()); - TEST_ASSERT(host_get_events() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN)); - - gpio_set_level(GPIO_LID_OPEN, 0); - msleep(50); - TEST_ASSERT(lid_hook_count == 2); - TEST_ASSERT(!lid_is_open()); - TEST_ASSERT(!lid_memmap_state()); - TEST_ASSERT(host_get_events() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_CLOSED)); - - return EC_SUCCESS; -} - -static int test_debounce(void) -{ - /* Close lid for testing */ - gpio_set_level(GPIO_LID_OPEN, 0); - msleep(100); - lid_hook_count = 0; - host_clear_events(0xffffffff); - - gpio_set_level(GPIO_LID_OPEN, 1); - msleep(20); - TEST_ASSERT(lid_hook_count == 0); - TEST_ASSERT(!lid_is_open()); - TEST_ASSERT(!lid_memmap_state()); - TEST_ASSERT(!(host_get_events() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN))); - - gpio_set_level(GPIO_LID_OPEN, 0); - msleep(50); - TEST_ASSERT(lid_hook_count == 0); - TEST_ASSERT(!lid_is_open()); - TEST_ASSERT(!lid_memmap_state()); - TEST_ASSERT(!(host_get_events() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN))); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_hook); - RUN_TEST(test_debounce); - - test_print_result(); -} diff --git a/test/lid_sw.tasklist b/test/lid_sw.tasklist deleted file mode 100644 index da0ab6211a..0000000000 --- a/test/lid_sw.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/lightbar.c b/test/lightbar.c deleted file mode 100644 index 363d73a36b..0000000000 --- a/test/lightbar.c +++ /dev/null @@ -1,335 +0,0 @@ -/* Copyright 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 "console.h" -#include "ec_commands.h" -#include "lightbar.h" -#include "host_command.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -static int get_seq(void) -{ - int rv; - struct ec_params_lightbar params; - struct ec_response_lightbar resp; - - /* Get the state */ - memset(&resp, 0, sizeof(resp)); - params.cmd = LIGHTBAR_CMD_GET_SEQ; - rv = test_send_host_command(EC_CMD_LIGHTBAR_CMD, 0, - ¶ms, sizeof(params), - &resp, sizeof(resp)); - if (rv != EC_RES_SUCCESS) { - ccprintf("%s:%s(): rv = %d\n", __FILE__, __func__, rv); - return -1; - } - - return resp.get_seq.num; -} - -static int set_seq(int s) -{ - int rv; - struct ec_params_lightbar params; - struct ec_response_lightbar resp; - - /* Get the state */ - memset(&resp, 0, sizeof(resp)); - params.cmd = LIGHTBAR_CMD_SEQ; - params.seq.num = s; - rv = test_send_host_command(EC_CMD_LIGHTBAR_CMD, 0, - ¶ms, sizeof(params), - &resp, sizeof(resp)); - if (rv != EC_RES_SUCCESS) { - ccprintf("%s:%s(): rv = %d\n", __FILE__, __func__, rv); - return -1; - } - - return EC_RES_SUCCESS; -} - -test_static int test_double_oneshots(void) -{ - /* Start in S0 */ - TEST_ASSERT(set_seq(LIGHTBAR_S0) == EC_RES_SUCCESS); - usleep(SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_S0); - /* Invoke the oneshot */ - TEST_ASSERT(set_seq(LIGHTBAR_TAP) == EC_RES_SUCCESS); - usleep(SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_TAP); - /* Switch to a different oneshot while that one's running */ - TEST_ASSERT(set_seq(LIGHTBAR_KONAMI) == EC_RES_SUCCESS); - usleep(SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_KONAMI); - /* Afterwards, it should go back to the original normal state */ - usleep(30 * SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_S0); - - /* Same test, but with a bunch more oneshots. */ - TEST_ASSERT(set_seq(LIGHTBAR_S0) == EC_RES_SUCCESS); - usleep(SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_S0); - TEST_ASSERT(set_seq(LIGHTBAR_TAP) == EC_RES_SUCCESS); - usleep(SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_TAP); - TEST_ASSERT(set_seq(LIGHTBAR_KONAMI) == EC_RES_SUCCESS); - usleep(SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_KONAMI); - TEST_ASSERT(set_seq(LIGHTBAR_TAP) == EC_RES_SUCCESS); - usleep(SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_TAP); - TEST_ASSERT(set_seq(LIGHTBAR_KONAMI) == EC_RES_SUCCESS); - usleep(SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_KONAMI); - TEST_ASSERT(set_seq(LIGHTBAR_TAP) == EC_RES_SUCCESS); - usleep(SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_TAP); - /* It should still go back to the original normal state */ - usleep(30 * SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_S0); - - /* But if the interruption is a normal state, that should stick. */ - TEST_ASSERT(set_seq(LIGHTBAR_S0) == EC_RES_SUCCESS); - usleep(SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_S0); - TEST_ASSERT(set_seq(LIGHTBAR_TAP) == EC_RES_SUCCESS); - usleep(SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_TAP); - TEST_ASSERT(set_seq(LIGHTBAR_KONAMI) == EC_RES_SUCCESS); - usleep(SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_KONAMI); - /* Here's a normal sequence */ - TEST_ASSERT(set_seq(LIGHTBAR_S3) == EC_RES_SUCCESS); - usleep(SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_S3); - /* And another one-shot */ - TEST_ASSERT(set_seq(LIGHTBAR_TAP) == EC_RES_SUCCESS); - usleep(SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_TAP); - TEST_ASSERT(set_seq(LIGHTBAR_KONAMI) == EC_RES_SUCCESS); - usleep(SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_KONAMI); - TEST_ASSERT(set_seq(LIGHTBAR_TAP) == EC_RES_SUCCESS); - usleep(SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_TAP); - /* It should go back to the new normal sequence */ - usleep(30 * SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_S3); - - return EC_SUCCESS; -} - -test_static int test_oneshots_norm_msg(void) -{ - /* Revert to the next state when interrupted with a normal message. */ - enum lightbar_sequence seqs[] = { - LIGHTBAR_KONAMI, - LIGHTBAR_TAP, - }; - int i; - - for (i = 0; i < ARRAY_SIZE(seqs); i++) { - /* Start in S0 */ - TEST_ASSERT(set_seq(LIGHTBAR_S0) == EC_RES_SUCCESS); - usleep(SECOND); - /* Invoke the oneshot */ - TEST_ASSERT(set_seq(seqs[i]) == EC_RES_SUCCESS); - usleep(SECOND); - /* Interrupt with S0S3 */ - TEST_ASSERT(set_seq(LIGHTBAR_S0S3) == EC_RES_SUCCESS); - usleep(SECOND); - /* It should be back right away */ - TEST_ASSERT(get_seq() == LIGHTBAR_S0S3); - /* And transition on to the correct value */ - usleep(30 * SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_S3); - } - - return EC_SUCCESS; -} - -test_static int test_stop_timeout(void) -{ - int i; - - for (i = 0; i < LIGHTBAR_NUM_SEQUENCES; i++) { - /* Start in S0 */ - TEST_ASSERT(set_seq(LIGHTBAR_S0) == EC_RES_SUCCESS); - usleep(SECOND); - /* Tell it to stop */ - TEST_ASSERT(set_seq(LIGHTBAR_STOP) == EC_RES_SUCCESS); - usleep(SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_STOP); - /* Try to interrupt it */ - TEST_ASSERT(set_seq(i) == EC_RES_SUCCESS); - usleep(SECOND); - /* What happened? */ - if (i == LIGHTBAR_RUN || - i == LIGHTBAR_S0S3 || i == LIGHTBAR_S3 || - i == LIGHTBAR_S3S5 || i == LIGHTBAR_S5) - /* RUN or shutdown sequences should stop it */ - TEST_ASSERT(get_seq() == LIGHTBAR_S0); - else - /* All other sequences should be ignored */ - TEST_ASSERT(get_seq() == LIGHTBAR_STOP); - - /* Let it RUN again for the next iteration */ - TEST_ASSERT(set_seq(LIGHTBAR_RUN) == EC_RES_SUCCESS); - usleep(SECOND); - } - - TEST_ASSERT(set_seq(LIGHTBAR_S0) == EC_RES_SUCCESS); - return EC_SUCCESS; -} - -test_static int test_oneshots_timeout(void) -{ - /* These should revert to the previous state after running */ - enum lightbar_sequence seqs[] = { - LIGHTBAR_RUN, - LIGHTBAR_KONAMI, - LIGHTBAR_TAP, - }; - int i; - - for (i = 0; i < ARRAY_SIZE(seqs); i++) { - TEST_ASSERT(set_seq(LIGHTBAR_S0) == EC_RES_SUCCESS); - usleep(SECOND); - TEST_ASSERT(set_seq(seqs[i]) == EC_RES_SUCCESS); - /* Assume the oneshot sequence takes at least a second (except - * for LIGHTBAR_RUN, which returns immediately) */ - if (seqs[i] != LIGHTBAR_RUN) { - usleep(SECOND); - TEST_ASSERT(get_seq() == seqs[i]); - } - usleep(30 * SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_S0); - } - - return EC_SUCCESS; -} - -test_static int test_transition_states(void) -{ - /* S5S3 */ - TEST_ASSERT(set_seq(LIGHTBAR_S5S3) == EC_RES_SUCCESS); - usleep(10 * SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_S3); - - /* S3S0 */ - TEST_ASSERT(set_seq(LIGHTBAR_S3S0) == EC_RES_SUCCESS); - usleep(10 * SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_S0); - - /* S0S3 */ - TEST_ASSERT(set_seq(LIGHTBAR_S0S3) == EC_RES_SUCCESS); - usleep(10 * SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_S3); - - /* S3S5 */ - TEST_ASSERT(set_seq(LIGHTBAR_S3S5) == EC_RES_SUCCESS); - usleep(10 * SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_S5); - - return EC_SUCCESS; -} - -test_static int test_stable_states(void) -{ - int i; - - /* Wait for the lightbar task to initialize */ - msleep(500); - - /* It should come up in S5 */ - TEST_ASSERT(get_seq() == LIGHTBAR_S5); - - /* It should stay there */ - for (i = 0; i < 30; i++) { - usleep(SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_S5); - } - - /* S3 is sticky, too */ - TEST_ASSERT(set_seq(LIGHTBAR_S3) == EC_RES_SUCCESS); - for (i = 0; i < 30; i++) { - usleep(SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_S3); - } - - /* And S0 */ - TEST_ASSERT(set_seq(LIGHTBAR_S0) == EC_RES_SUCCESS); - for (i = 0; i < 30; i++) { - usleep(SECOND); - TEST_ASSERT(get_seq() == LIGHTBAR_S0); - } - - return EC_SUCCESS; -} - -const struct lb_brightness_def lb_brightness_levels[] = { - { - /* regular brightness */ - .lux_up = 60, - .lux_down = 40, - }, - { - /* 25 - 50% brightness */ - .lux_up = 40, - .lux_down = 20, - }, - { - /* 0 .. 25% brightness */ - .lux_up = 0, - .lux_down = 0, - }, -}; -const unsigned int lb_brightness_levels_count = - ARRAY_SIZE(lb_brightness_levels); - -int lux_level_to_google_color(const int lux); -extern int google_color_id; - -int lid_is_open(void) -{ - return 1; -} - -test_static int test_als_lightbar(void) -{ - int lux_data[] = { 500, 100, 35, 15, 30, 35, 55, 70, 55, 100 }; - int exp_gcid[] = { 0, 0, 1, 2, 2, 2, 1, 0, 0, 0 }; - int exp_chg[] = { 0, 0, 1, 1, 0, 0, 1, 1, 0, 0 }; - int i; - - BUILD_ASSERT(ARRAY_SIZE(lux_data) == ARRAY_SIZE(exp_gcid)); - BUILD_ASSERT(ARRAY_SIZE(lux_data) == ARRAY_SIZE(exp_chg)); - - google_color_id = 0; - for (i = 0; i < ARRAY_SIZE(lux_data); i++) { - TEST_ASSERT(exp_chg[i] == - lux_level_to_google_color(lux_data[i])); - TEST_ASSERT(exp_gcid[i] == google_color_id); - } - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - /* Ensure tasks are started before running tests */ - usleep(SECOND); - - RUN_TEST(test_stable_states); - RUN_TEST(test_transition_states); - RUN_TEST(test_oneshots_timeout); - RUN_TEST(test_stop_timeout); - RUN_TEST(test_oneshots_norm_msg); - RUN_TEST(test_double_oneshots); - RUN_TEST(test_als_lightbar); - test_print_result(); -} diff --git a/test/lightbar.tasklist b/test/lightbar.tasklist deleted file mode 100644 index b5e714765d..0000000000 --- a/test/lightbar.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(LIGHTBAR, lightbar_task, NULL, LARGER_TASK_STACK_SIZE) diff --git a/test/mag_cal.c b/test/mag_cal.c deleted file mode 100644 index 8ee3b41480..0000000000 --- a/test/mag_cal.c +++ /dev/null @@ -1,91 +0,0 @@ -/* Copyright 2020 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 "common.h" -#include "mag_cal.h" -#include "test_util.h" -#include <stdio.h> - -/** - * Various samples that might be seen in the wild. Normal range for magnetic - * fields is around 80 uT. This translates to roughly +/-525 units for the - * lis2mdl sensor. - * - * Random numbers were generated using the range of [518,532] (+- 2.14 uT) for - * the high values and [-5,5] (+- 1.53 uT) for the low values. - */ -static intv3_t samples[] = { - { -522, 5, -5 }, - { -528, -3, 1 }, - { -531, -2, 0 }, - { -525, -1, 3 }, - - { 527, 3, -2 }, - { 523, -5, 1 }, - { 520, -3, 2 }, - { 522, 0, -4 }, - - { -3, -519, -2 }, - { 1, -521, 5 }, - { 2, -526, 4 }, - { 0, -532, -5 }, - - { -5, 528, 4 }, - { -2, 531, -4 }, - { 1, 522, 2 }, - { 5, 532, 3 }, - - { -5, 0, -524 }, - { -1, -2, -527 }, - { -3, 4, -532 }, - { 5, 3, -531 }, - - { 4, -2, 524 }, - { 1, 3, 520 }, - { 5, -5, 528 }, - { 0, 2, 521 }, -}; - -static int test_mag_cal_computes_bias(void) -{ - struct mag_cal_t cal; - int i; - - init_mag_cal(&cal); - cal.batch_size = ARRAY_SIZE(samples); - - /* Test that we don't calibrate until we added the final sample. */ - for (i = 0; i < cal.batch_size - 1; ++i) - TEST_EQ(0, mag_cal_update(&cal, samples[i]), "%d"); - /* Add the final sample and check calibration. */ - TEST_EQ(1, mag_cal_update(&cal, samples[cal.batch_size - 1]), "%d"); - TEST_EQ(525, FP_TO_INT(cal.radius), "%d"); - TEST_EQ(1, cal.bias[0], "%d"); - TEST_EQ(-1, cal.bias[1], "%d"); - TEST_EQ(2, cal.bias[2], "%d"); - - /* - * State should have reset, run the same code again to verify that - * we get the same calibration. - */ - for (i = 0; i < cal.batch_size - 1; ++i) - TEST_EQ(0, mag_cal_update(&cal, samples[i]), "%d"); - TEST_EQ(1, mag_cal_update(&cal, samples[cal.batch_size - 1]), "%d"); - TEST_EQ(525, FP_TO_INT(cal.radius), "%d"); - TEST_EQ(1, cal.bias[0], "%d"); - TEST_EQ(-1, cal.bias[1], "%d"); - TEST_EQ(2, cal.bias[2], "%d"); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_mag_cal_computes_bias); - - test_print_result(); -} diff --git a/test/mag_cal.tasklist b/test/mag_cal.tasklist deleted file mode 100644 index ff715f69cd..0000000000 --- a/test/mag_cal.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2020 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ - diff --git a/test/math_util.c b/test/math_util.c deleted file mode 100644 index 6482888e55..0000000000 --- a/test/math_util.c +++ /dev/null @@ -1,135 +0,0 @@ -/* Copyright 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. - * - * Test motion sense code. - */ - -#include <math.h> -#include <stdio.h> -#include "common.h" -#include "math_util.h" -#include "motion_sense.h" -#include "test_util.h" -#include "util.h" - -/*****************************************************************************/ -/* - * Need to define motion sensor globals just to compile. - * We include motion task to force the inclusion of math_util.c - */ -struct motion_sensor_t motion_sensors[] = {}; -const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); - -/*****************************************************************************/ -/* Test utilities */ - -/* Macro to compare two floats and check if they are equal within diff. */ -#define IS_FLOAT_EQUAL(a, b, diff) ((a) >= ((b) - diff) && (a) <= ((b) + diff)) - -#define ACOS_TOLERANCE_DEG 0.5f -#define RAD_TO_DEG (180.0f / 3.1415926f) - -static int test_acos(void) -{ - float a, b; - float test; - - /* Test a handful of values. */ - for (test = -1.0; test <= 1.0; test += 0.01) { - a = FP_TO_FLOAT(arc_cos(FLOAT_TO_FP(test))); - b = acos(test) * RAD_TO_DEG; - TEST_ASSERT(IS_FLOAT_EQUAL(a, b, ACOS_TOLERANCE_DEG)); - } - - return EC_SUCCESS; -} - - -const mat33_fp_t test_matrices[] = { - {{ 0, FLOAT_TO_FP(-1), 0}, - {FLOAT_TO_FP(-1), 0, 0}, - { 0, 0, FLOAT_TO_FP(1)} }, - {{ FLOAT_TO_FP(1), 0, FLOAT_TO_FP(5)}, - { FLOAT_TO_FP(2), FLOAT_TO_FP(1), FLOAT_TO_FP(6)}, - { FLOAT_TO_FP(3), FLOAT_TO_FP(4), 0} } -}; - - -static int test_rotate(void) -{ - int i, j, k; - intv3_t v = {1, 2, 3}; - intv3_t w; - - for (i = 0; i < ARRAY_SIZE(test_matrices); i++) { - for (j = 0; j < 100; j += 10) { - for (k = X; k <= Z; k++) { - v[k] += j; - v[k] %= 7; - } - - rotate(v, test_matrices[i], w); - rotate_inv(w, test_matrices[i], w); - for (k = X; k <= Z; k++) - TEST_ASSERT(v[k] == w[k]); - } - } - return EC_SUCCESS; -} - -test_static int test_round_divide(void) -{ - /* Check function version */ - TEST_EQ(round_divide(10, 1), 10, "%d"); - TEST_EQ(round_divide(10, 2), 5, "%d"); - TEST_EQ(round_divide(10, 3), 3, "%d"); - TEST_EQ(round_divide(10, 4), 3, "%d"); - TEST_EQ(round_divide(10, 5), 2, "%d"); - TEST_EQ(round_divide(10, 6), 2, "%d"); - TEST_EQ(round_divide(10, 7), 1, "%d"); - TEST_EQ(round_divide(10, 9), 1, "%d"); - TEST_EQ(round_divide(10, 10), 1, "%d"); - TEST_EQ(round_divide(10, 11), 1, "%d"); - TEST_EQ(round_divide(10, 20), 1, "%d"); - TEST_EQ(round_divide(10, 21), 0, "%d"); - - /* Check negative conditions */ - TEST_EQ(round_divide(-10, 6), -2, "%d"); - TEST_EQ(round_divide(10, -6), -2, "%d"); - TEST_EQ(round_divide(-10, -6), 2, "%d"); - - return EC_SUCCESS; -} - -test_static int test_temp_conversion(void) -{ - TEST_EQ(C_TO_K(100), 373, "%d"); - TEST_EQ(K_TO_C(100), -173, "%d"); - - TEST_EQ((int)CELSIUS_TO_DECI_KELVIN(100), 3732, "%d"); - TEST_EQ(DECI_KELVIN_TO_CELSIUS(100), -263, "%d"); - - TEST_EQ(MILLI_KELVIN_TO_MILLI_CELSIUS(100), -273050, "%d"); - TEST_EQ(MILLI_CELSIUS_TO_MILLI_KELVIN(100), 273250, "%d"); - - TEST_EQ(MILLI_KELVIN_TO_KELVIN(5000), 5, "%d"); - TEST_EQ(KELVIN_TO_MILLI_KELVIN(100), 100000, "%d"); - - TEST_EQ(CELSIUS_TO_MILLI_KELVIN(100), 373150, "%d"); - TEST_EQ(MILLI_KELVIN_TO_CELSIUS(100), -273, "%d"); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_acos); - RUN_TEST(test_rotate); - RUN_TEST(test_round_divide); - RUN_TEST(test_temp_conversion); - - test_print_result(); -} diff --git a/test/math_util.tasklist b/test/math_util.tasklist deleted file mode 100644 index f5c894ccaf..0000000000 --- a/test/math_util.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/motion_angle.c b/test/motion_angle.c deleted file mode 100644 index 30f663de14..0000000000 --- a/test/motion_angle.c +++ /dev/null @@ -1,101 +0,0 @@ -/* Copyright 2019 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. - * - * Test motion sense code: Check lid angle calculation and tablet mode - * transition. - */ - -#include <math.h> -#include <stdio.h> - -#include "accelgyro.h" -#include "common.h" -#include "gpio.h" -#include "hooks.h" -#include "motion_common.h" -#include "motion_lid.h" -#include "motion_sense.h" -#include "tablet_mode.h" -#include "test_util.h" -#include "util.h" - -/*****************************************************************************/ -/* Test utilities */ - -/* Array units is in m/s^2 - old matrix format. */ -int filler(const struct motion_sensor_t *s, const float v) -{ - return (v * MOTION_SCALING_FACTOR) / s->current_range; -} - -static int test_lid_angle_less180(void) -{ - int index = 0, lid_angle; - struct motion_sensor_t *lid = &motion_sensors[ - CONFIG_LID_ANGLE_SENSOR_LID]; - struct motion_sensor_t *base = &motion_sensors[ - CONFIG_LID_ANGLE_SENSOR_BASE]; - - /* We don't have TASK_CHIP so simulate init ourselves */ - hook_notify(HOOK_CHIPSET_SHUTDOWN); - TEST_ASSERT(sensor_active == SENSOR_ACTIVE_S5); - TEST_ASSERT(lid->drv->get_data_rate(lid) == 0); - - /* Go to S0 state */ - hook_notify(HOOK_CHIPSET_SUSPEND); - hook_notify(HOOK_CHIPSET_RESUME); - msleep(1000); - TEST_ASSERT(sensor_active == SENSOR_ACTIVE_S0); - TEST_ASSERT(lid->drv->get_data_rate(lid) == TEST_LID_FREQUENCY); - - /* Open lid, testing close to 180 degree. */ - gpio_set_level(GPIO_LID_OPEN, 1); - msleep(1000); - - cprints(CC_ACCEL, "start loop"); - /* Check we will never enter tablet mode. */ - while (index < kAccelerometerLaptopModeTestDataLength) { - feed_accel_data(kAccelerometerLaptopModeTestData, - &index, filler); - wait_for_valid_sample(); - lid_angle = motion_lid_get_angle(); - cprints(CC_ACCEL, "%d : LID(%d, %d, %d)/BASE(%d, %d, %d): %d", - index / TEST_LID_SAMPLE_SIZE, - lid->xyz[X], lid->xyz[Y], lid->xyz[Z], - base->xyz[X], base->xyz[Y], base->xyz[Z], - lid_angle); - /* We need few sample to debounce and enter laptop mode. */ - TEST_ASSERT(index < TEST_LID_SAMPLE_SIZE * - (TABLET_MODE_DEBOUNCE_COUNT + 2) || - !tablet_get_mode()); - } - - /* Check we will never exit tablet mode. */ - index = 0; - while (index < kAccelerometerFullyOpenTestDataLength) { - feed_accel_data(kAccelerometerFullyOpenTestData, - &index, filler); - wait_for_valid_sample(); - lid_angle = motion_lid_get_angle(); - cprints(CC_ACCEL, "%d : LID(%d, %d, %d)/BASE(%d, %d, %d): %d", - index / TEST_LID_SAMPLE_SIZE, - lid->xyz[X], lid->xyz[Y], lid->xyz[Z], - base->xyz[X], base->xyz[Y], base->xyz[Z], - lid_angle); - TEST_ASSERT(index < TEST_LID_SAMPLE_SIZE * - (TABLET_MODE_DEBOUNCE_COUNT + 2) || - tablet_get_mode()); - } - return EC_SUCCESS; -} - - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_lid_angle_less180); - - test_print_result(); -} diff --git a/test/motion_angle.tasklist b/test/motion_angle.tasklist deleted file mode 100644 index 0b774ebb4a..0000000000 --- a/test/motion_angle.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(MOTIONSENSE, motion_sense_task, NULL, TASK_STACK_SIZE) diff --git a/test/motion_angle_data_literals.c b/test/motion_angle_data_literals.c deleted file mode 100644 index 6c0fcb35c2..0000000000 --- a/test/motion_angle_data_literals.c +++ /dev/null @@ -1,1003 +0,0 @@ -/* Copyright 2018 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 "util.h" - -/* - * Recopied from - * chromium/src/ash/wm/tablet_mode/accelerometer_test_data_literals.cc - * - * The arrays contain actual accelerator readings. - * [ CONFIG_ACCEL_STD_REF_FRAME_OLD must be defined to used this array. ] - */ -const float kAccelerometerLaptopModeTestData[] = { - -0.166016f, -0.00488281f, 0.924805f, -0.770508f, -0.0488281f, - -0.510742f, -0.199219f, -0.0078125f, 0.953125f, -0.782227f, - -0.0244141f, -0.652344f, -0.177734f, -0.0136719f, 0.936523f, - -0.772461f, -0.0527344f, -0.59375f, -0.176758f, -0.00878906f, - 0.9375f, -0.777344f, -0.0419922f, -0.637695f, -0.165039f, - -0.00878906f, 0.942383f, -0.782227f, -0.046875f, -0.613281f, - -0.180664f, -0.00976562f, 0.943359f, -0.777344f, -0.0419922f, - -0.601562f, -0.189453f, -0.00488281f, 0.943359f, -0.776367f, - -0.0263672f, -0.613281f, -0.166992f, -0.00488281f, 0.935547f, - -0.78125f, -0.0380859f, -0.609375f, -0.176758f, -0.00878906f, - 0.947266f, -0.790039f, -0.0576172f, -0.585938f, -0.173828f, - -0.0126953f, 0.93457f, -0.780273f, -0.0654297f, -0.666016f, - -0.169922f, -0.00195312f, 0.928711f, -0.775391f, -0.0351562f, - -0.561523f, -0.193359f, 0.0f, 0.941406f, -0.795898f, - -0.0478516f, -0.640625f, -0.162109f, -0.00585938f, 0.917969f, - -0.768555f, -0.0146484f, -0.685547f, -0.166992f, -0.0136719f, - 0.921875f, -0.755859f, -0.0166016f, -0.425781f, -0.175781f, - -0.0810547f, 1.00098f, -0.802734f, -0.117188f, -0.585938f, - -0.210938f, 0.0214844f, 0.881836f, -0.750977f, -0.0302734f, - -0.677734f, -0.285156f, 0.00976562f, 0.967773f, -0.763672f, - -0.0283203f, -0.850586f, -0.222656f, -0.0136719f, 0.943359f, - -0.763672f, -0.0507812f, -0.640625f, -0.236328f, 0.0859375f, - 0.892578f, -0.742188f, 0.0302734f, -0.484375f, -0.269531f, - 0.0263672f, 0.913086f, -0.714844f, -0.00585938f, -0.745117f, - -0.275391f, 0.0927734f, 0.977539f, -0.776367f, -0.078125f, - -0.750977f, -0.155273f, -0.0341797f, 1.2334f, -1.06445f, - -0.0478516f, -0.823242f, -0.196289f, 0.046875f, 1.19141f, - -1.00391f, -0.140625f, -0.541016f, 0.0917969f, 0.21582f, - 0.717773f, -0.764648f, -0.0341797f, -0.607422f, -0.0351562f, - 0.0888672f, 0.207031f, -0.214844f, -0.18457f, -0.0664062f, - -0.0898438f, 0.0556641f, 0.418945f, -0.232422f, 0.43457f, - 0.0361328f, 0.143555f, 0.376953f, 1.23633f, -1.09082f, - 0.529297f, 0.0507812f, 0.205078f, 0.438477f, 1.66602f, - -1.59668f, 0.325195f, -1.20996f, -0.0791016f, 0.404297f, - 1.50977f, -1.40918f, 0.31543f, -1.30273f, -0.0654297f, - 0.141602f, 0.699219f, -0.589844f, 0.0732422f, -0.27832f, - 0.00488281f, 0.00683594f, 0.0566406f, -0.0410156f, -0.0292969f, - -0.0234375f, -0.0488281f, -0.00195312f, -0.0292969f, 0.0849609f, - -0.139648f, 0.0585938f, 0.677734f, 0.667969f, 1.36523f, - -1.11816f, 0.412109f, 0.844727f, 0.142578f, 0.790039f, - 1.73145f, -1.68066f, 0.464844f, -1.29492f, -0.0800781f, - 0.803711f, 0.879883f, -0.765625f, -0.0400391f, -0.616211f, - -0.170898f, 0.879883f, 0.510742f, 0.158203f, 0.381836f, - -0.270508f, -0.0693359f, 0.651367f, 0.431641f, 0.104492f, - 0.991211f, -0.0634766f, -0.0478516f, 0.750977f, 0.283203f, - -0.0332031f, 1.52051f, -0.00195312f, -0.201172f, 1.08984f, - 0.173828f, 0.0849609f, 1.44141f, -0.214844f, -0.0107422f, - 1.29785f, 0.520508f, 0.00488281f, 1.73047f, -0.523438f, - 0.136719f, 1.42188f, 0.987305f, 0.0527344f, 1.74707f, - -0.525391f, 0.34668f, 0.469727f, 0.428711f, 0.114258f, - -0.788086f, 0.177734f, 0.400391f, -0.106445f, 0.328125f, - -0.566406f, -0.948242f, 0.670898f, 0.467773f, -0.21875f, - 0.55957f, -0.767578f, -0.232422f, 0.195312f, 0.625f, - -0.271484f, 0.865234f, -0.765625f, 0.299805f, 0.0703125f, - 0.378906f, -0.526367f, 0.548828f, -0.231445f, -0.569336f, - 0.455078f, 0.303711f, -0.866211f, -0.485352f, 0.566406f, - -1.60547f, 0.481445f, 0.183594f, -0.782227f, -0.260742f, - 0.243164f, -1.41504f, 0.373047f, 0.172852f, -0.935547f, - -0.412109f, 0.133789f, -1.69727f, 0.178711f, 0.407227f, - -0.952148f, -0.227539f, 0.0751953f, -1.67188f, 0.339844f, - 0.498047f, -0.795898f, 0.209961f, 0.177734f, -1.3916f, - 0.458984f, 0.295898f, 0.0390625f, 0.697266f, 0.258789f, - -0.0703125f, -0.131836f, 0.56543f, 0.250977f, 0.913086f, - -0.353516f, 0.90332f, 0.191406f, 0.708008f, 0.352539f, - 0.853516f, -0.839844f, 0.955078f, 0.636719f, 0.657227f, - 0.389648f, 0.620117f, -0.725586f, 0.43457f, 0.485352f, - 0.424805f, 0.479492f, 0.287109f, -0.505859f, -0.209961f, - 0.0927734f, 0.21582f, 0.709961f, 0.492188f, -0.413086f, - -0.0869141f, 0.0673828f, -0.119141f, 1.20508f, 0.392578f, - 0.229492f, 0.927734f, -0.297852f, 0.142578f, 1.0293f, - 0.430664f, 0.0449219f, 1.71875f, -0.0283203f, 0.0107422f, - 1.18164f, 0.0517578f, 0.0751953f, 1.80273f, -0.0693359f, - -0.19043f, 1.1748f, 0.236328f, 0.0839844f, 1.78711f, - -0.472656f, -0.270508f, 1.10254f, 0.964844f, 0.118164f, - 1.75684f, -0.901367f, -0.211914f, 1.11133f, 0.65625f, - 0.308594f, 0.142578f, 0.396484f, 0.239258f, 0.0800781f, - 0.973633f, -0.824219f, -0.25293f, 0.485352f, 0.351562f, - -0.0771484f, 1.08984f, -0.632812f, 0.240234f, -0.258789f, - 0.436523f, -0.514648f, 0.491211f, 0.0664062f, -0.244141f, - -0.148438f, -0.171875f, -0.477539f, -0.459961f, 1.1084f, - -0.822266f, -0.114258f, -0.192383f, -0.608398f, -0.771484f, - 1.11133f, -1.25488f, 1.01953f, -0.0839844f, -0.620117f, - -0.794922f, 0.660156f, -0.876953f, 0.0957031f, -0.242188f, - -0.711914f, -0.55957f, 0.736328f, -0.649414f, -0.0263672f, - -0.258789f, -0.498047f, -0.973633f, 0.957031f, -0.660156f, - 0.186523f, -0.262695f, -0.595703f, -0.787109f, 0.893555f, - -0.429688f, -0.0234375f, -0.254883f, -0.449219f, -0.783203f, - 0.90918f, 0.106445f, -0.161133f, -0.287109f, -0.0800781f, - -0.729492f, 0.933594f, -0.126953f, -0.0742188f, -0.550781f, - -0.271484f, -0.989258f, 1.00098f, -0.879883f, 0.0234375f, - -0.543945f, -0.50293f, -1.18945f, 1.24023f, -1.33398f, - 0.325195f, -0.262695f, -0.307617f, -0.912109f, 1.39062f, - -1.06055f, 0.0107422f, -0.00292969f, -0.573242f, -0.4375f, - 1.15625f, -0.651367f, -0.310547f, 0.188477f, -0.730469f, - -0.121094f, 0.611328f, -0.779297f, 0.335938f, 0.731445f, - -0.475586f, -0.00390625f, 0.100586f, -0.693359f, 0.254883f, - 0.813477f, -0.345703f, 0.420898f, -0.400391f, -0.539062f, - 0.365234f, 0.720703f, 0.0214844f, 0.673828f, -0.370117f, - 0.0585938f, 0.499023f, 0.523438f, 0.198242f, 0.759766f, - -0.544922f, 0.543945f, 0.226562f, 0.473633f, 0.34082f, - 0.595703f, -0.682617f, 0.292969f, -0.217773f, 0.0742188f, - 0.553711f, 0.762695f, -0.504883f, 0.292969f, 0.0751953f, - 0.0126953f, 0.427734f, 0.769531f, -0.265625f, 0.552734f, - -0.0175781f, -0.30957f, 0.253906f, 0.322266f, 0.117188f, - 0.263672f, -0.706055f, -0.991211f, 0.266602f, 0.501953f, - 0.00585938f, 0.0341797f, -1.24805f, -1.21777f, 0.488281f, - 0.461914f, 0.0986328f, 0.362305f, -1.1709f, -1.17188f, - 0.50293f, 0.458984f, 0.108398f, 0.460938f, -1.52148f, - -1.27051f, 0.379883f, 0.90625f, 0.0400391f, 0.524414f, - -1.77832f, -0.951172f, 0.397461f, 0.589844f, 0.520508f, - 0.439453f, -1.99902f, -0.643555f, 0.313477f, 0.766602f, - 0.450195f, 0.286133f, -1.29883f, -0.375f, 0.225586f, - 0.697266f, 0.299805f, 0.108398f, -0.976562f, 0.09375f, - 0.0361328f, 0.851562f, -0.210938f, 0.0615234f, -0.0898438f, - 0.59082f, 0.313477f, 0.756836f, -0.731445f, 0.296875f, - -0.0927734f, 0.552734f, 0.223633f, 0.558594f, -0.806641f, - 0.00195312f, 0.03125f, 0.728516f, 0.276367f, 0.744141f, - -0.994141f, 0.197266f, -0.425781f, 0.316406f, 0.046875f, - 0.601562f, -0.633789f, -0.0576172f, -0.320312f, 0.786133f, - 0.0986328f, 1.0f, -1.19922f, 0.34668f, -0.546875f, - 0.481445f, 0.00390625f, 0.876953f, -1.04297f, -0.0507812f, - -0.775391f, 0.333984f, -0.0175781f, 1.02539f, -1.07129f, - -0.12207f, -0.212891f, 0.28125f, 0.00488281f, 0.998047f, - -0.97168f, 0.178711f, -0.444336f, 0.178711f, 0.0136719f, - 0.896484f, -0.9375f, 0.0117188f, -0.291992f, 0.132812f, - 0.0234375f, 0.975586f, -0.943359f, -0.0078125f, 0.0546875f, - 0.244141f, -0.0771484f, 1.05469f, -1.02148f, 0.313477f, - -0.349609f, 0.148438f, 0.0839844f, 0.619141f, -0.75f, - -0.589844f, -0.0488281f, 0.0263672f, -0.176758f, 0.697266f, - -0.691406f, -0.625977f, -0.417969f, 0.408203f, 0.265625f, - 1.01953f, -1.09863f, 0.106445f, 0.0117188f, 0.157227f, - 0.424805f, 1.07422f, -0.816406f, 0.498047f, 0.0996094f, - 0.00585938f, 0.53418f, 0.771484f, -0.610352f, 0.744141f, - 0.0195312f, 0.0478516f, 0.552734f, 0.734375f, -0.72168f, - 0.518555f, -0.144531f, -0.0361328f, 0.513672f, 0.822266f, - -0.736328f, 0.65918f, -0.179688f, -0.104492f, 0.425781f, - 1.00098f, -0.885742f, 0.739258f, -0.681641f, -0.443359f, - 0.375977f, 0.884766f, -0.724609f, 0.110352f, -0.289062f, - -0.414062f, 0.494141f, 0.53125f, -0.422852f, 0.216797f, - -0.786133f, -0.569336f, 0.749023f, 0.75293f, -0.529297f, - 0.730469f, -0.911133f, -0.68457f, 0.611328f, 0.959961f, - -0.623047f, 1.06543f, -0.499023f, -0.392578f, 0.761719f, - 0.43457f, -0.357422f, 0.631836f, -0.746094f, -0.370117f, - 0.777344f, 0.379883f, -0.225586f, 0.677734f, -0.478516f, - -0.358398f, 0.788086f, 0.569336f, -0.34082f, 0.939453f, - -0.238281f, -0.230469f, 0.861328f, 0.448242f, -0.219727f, - 0.966797f, -0.310547f, -0.242188f, 0.863281f, 0.369141f, - -0.0859375f, 0.87207f, -0.400391f, -0.385742f, 0.841797f, - 0.401367f, -0.0634766f, 0.912109f, -0.458008f, 0.0107422f, - 0.753906f, 0.758789f, -0.675781f, 0.765625f, -0.342773f, - -0.123047f, 0.855469f, 0.599609f, -0.490234f, 0.963867f, - -0.118164f, -0.0117188f, 0.889648f, 0.637695f, -0.607422f, - 0.803711f, -0.597656f, -0.242188f, 0.855469f, 0.550781f, - -0.607422f, 0.576172f, -0.759766f, -0.220703f, 0.832031f, - 0.477539f, -0.491211f, 0.470703f, -0.575195f, -0.0869141f, - 1.01074f, 0.371094f, -0.25293f, 0.678711f, -0.316406f, - -0.197266f, 1.04785f, 0.386719f, -0.046875f, 0.967773f, - -0.761719f, -0.282227f, 0.956055f, 0.270508f, 0.230469f, - 1.39746f, -0.864258f, -0.417969f, 0.761719f, 0.457031f, - 0.0263672f, 1.38379f, -0.714844f, -0.288086f, 0.535156f, - 0.689453f, -0.507812f, 0.68457f, -0.433594f, -0.0908203f, - 0.210938f, 0.825195f, -0.649414f, 0.326172f, -0.793945f, - 0.0527344f, 0.0546875f, 0.911133f, -0.616211f, -0.0214844f, - -0.00195312f, -0.229492f, -0.0253906f, 0.775391f, -0.611328f, - -0.360352f, 0.0371094f, 0.161133f, 0.0253906f, 0.625f, - -0.624023f, -0.344727f, -0.146484f, 0.371094f, 0.255859f, - 1.41797f, -1.27832f, 0.614258f, 0.764648f, 0.869141f, - 0.426758f, 0.758789f, -1.04395f, 0.401367f, 0.263672f, - 0.563477f, 0.450195f, 0.774414f, -0.908203f, 0.384766f, - -0.262695f, 0.664062f, 0.509766f, 0.798828f, -0.757812f, - 0.770508f, 0.491211f, 0.62207f, 0.487305f, 0.496094f, - -0.530273f, 0.375977f, 1.18652f, 0.736328f, 0.386719f, - 0.470703f, -0.647461f, 0.379883f, 0.47168f, 0.834961f, - 0.289062f, 0.475586f, -0.654297f, 0.448242f, 0.395508f, - 0.930664f, 0.0830078f, 0.157227f, -0.304688f, 0.0634766f, - 1.30078f, 0.905273f, -0.102539f, 0.0576172f, -0.303711f, - -0.334961f, 0.885742f, 0.709961f, -0.143555f, 0.0390625f, - -0.18457f, -0.498047f, 1.1084f, 0.744141f, 0.0283203f, - 0.383789f, -0.371094f, -0.126953f, 1.17285f, 0.506836f, - 0.109375f, 0.680664f, -0.244141f, -0.0830078f, 0.577148f, - 0.12793f, 0.25f, 0.972656f, -0.328125f, 0.34082f, - -0.234375f, -0.327148f, 0.470703f, 0.987305f, -0.535156f, - 0.730469f, -0.957031f, -0.509766f, 0.602539f, 0.938477f, - -0.640625f, 0.836914f, -1.13672f, -0.56543f, 0.450195f, - 0.737305f, -0.449219f, 0.649414f, -1.08105f, -0.364258f, - 0.338867f, 0.667969f, -0.533203f, 0.654297f, -1.0918f, - -0.505859f, 0.422852f, 0.745117f, -0.443359f, 0.319336f, - -0.753906f, -0.563477f, 0.374023f, 0.640625f, -0.435547f, - 0.220703f, -0.868164f, -0.701172f, 0.317383f, 0.702148f, - -0.527344f, 0.138672f, -0.848633f, -0.431641f, 0.220703f, - 0.329102f, -0.25293f, -0.232422f, -0.875977f, -0.442383f, - 0.550781f, 0.783203f, -0.441406f, 0.160156f, -0.107422f, - 0.0683594f, 0.317383f, 1.12012f, -1.02344f, 0.322266f, - -0.469727f, -0.151367f, 0.43457f, 0.65625f, -0.745117f, - 0.216797f, -1.03223f, -0.200195f, 0.240234f, 1.11035f, - -0.90332f, 0.239258f, 0.0429688f, -0.228516f, 0.00390625f, - 0.836914f, -0.770508f, -0.280273f, -0.18457f, 0.0117188f, - 0.214844f, 0.767578f, -0.774414f, -0.0703125f, -0.954102f, - -0.508789f, -0.046875f, 1.00391f, -0.930664f, 0.0292969f, - 0.407227f, -0.519531f, 0.0361328f, 0.753906f, -0.777344f, - -0.0214844f, 0.741211f, -0.27832f, -0.0332031f, 1.15625f, - -0.862305f, -0.115234f, 0.821289f, -0.598633f, 0.00488281f, - 0.929688f, -1.01172f, -0.0996094f, 0.351562f, -0.524414f, - 0.118164f, 1.1709f, -0.938477f, 0.00878906f, 0.948242f, - -0.475586f, 0.443359f, 0.893555f, -0.597656f, 0.0107422f, - 0.558594f, -0.87207f, 0.0810547f, 0.487305f, -0.808594f, - 0.212891f, 0.0878906f, -0.612305f, 0.263672f, 0.400391f, - -0.709961f, 0.380859f, -0.0839844f, -0.566406f, 0.466797f, - 0.445312f, -0.769531f, 0.636719f, -0.273438f, -0.648438f, - 0.34375f, 0.56543f, -0.829102f, 0.417969f, -0.272461f, - -0.746094f, 0.202148f, 0.421875f, -0.445312f, 0.229492f, - 0.178711f, -0.408203f, 0.477539f, 0.693359f, -0.675781f, - 0.145508f, 0.37207f, -0.576172f, 0.0449219f, 0.845703f, - -0.920898f, -0.0185547f, 0.487305f, -0.460938f, 0.0253906f, - 1.04785f, -0.87207f, 0.176758f, 0.356445f, -0.217773f, - 0.0332031f, 0.945312f, -0.556641f, -0.110352f, 0.725586f, - 0.0810547f, -0.0361328f, 1.11426f, -0.396484f, 0.00488281f, - 0.743164f, 0.27832f, 0.0175781f, 0.839844f, -0.0371094f, - -0.00878906f, 0.964844f, 0.547852f, 0.0224609f, 0.518555f, - 0.386719f, -0.0585938f, 1.11816f, 0.712891f, 0.19043f, - 0.523438f, 0.429688f, -0.179688f, 1.18164f, 0.40332f, - 0.241211f, 1.19043f, -0.0234375f, 0.119141f, 0.90918f, - -0.078125f, 0.250977f, 0.973633f, -0.277344f, 0.227539f, - 0.908203f, -0.232422f, 0.269531f, 0.807617f, -0.59668f, - 0.253906f, 0.398438f, -0.506836f, 0.255859f, 0.694336f, - -0.742188f, 0.345703f, 0.412109f, -0.576172f, 0.189453f, - 0.708984f, -0.808594f, 0.230469f, 0.242188f, -0.550781f, - 0.0693359f, 0.695312f, -0.856445f, -0.0253906f, 0.177734f, - -0.6875f, -0.00976562f, 0.731445f, -0.991211f, -0.03125f, - 0.0175781f, -0.805664f, -0.192383f, 0.827148f, -0.947266f, - 0.0820312f, 0.254883f, -0.504883f, -0.259766f, 0.87207f, - -0.693359f, -0.345703f, 0.639648f, -0.162109f, -0.443359f, - 1.05176f, -0.595703f, -0.496094f, 0.485352f, -0.0380859f, - -0.490234f, 0.763672f, -0.382812f, -0.634766f, 0.369141f, - 0.136719f, -0.650391f, 0.536133f, -0.126953f, -0.901367f, - 0.275391f, 0.155273f, -0.75293f, 0.476562f, -0.183594f, - -1.00488f, 0.206055f, -0.0908203f, -1.06836f, 0.3125f, - -0.183594f, -1.30762f, 0.37793f, -0.185547f, -0.885742f, - 0.496094f, -0.250977f, -1.14941f, 0.0517578f, -0.242188f, - -0.753906f, 0.395508f, -0.133789f, -1.10156f, 0.183594f, - -0.398438f, -0.767578f, 0.951172f, -0.359375f, -0.866211f, - 0.373047f, -0.0224609f, -0.0537109f, 0.921875f, -0.263672f, - -0.251953f, 0.455078f, 0.230469f, 0.485352f, 0.84082f, - 0.0351562f, 0.0810547f, 0.554688f, 0.186523f, 0.774414f, - 0.720703f, 0.381836f, 0.71875f, 0.495117f, 0.530273f, - 0.771484f, 0.90332f, 0.34668f, 0.897461f, 0.456055f, - 0.575195f, 0.560547f, 0.133789f, 0.62793f, 0.795898f, - 0.400391f, 0.594727f, 0.577148f, -0.142578f, 0.691406f, - 0.770508f, 0.12793f, 0.679688f, 0.751953f, -0.201172f, - 0.728516f, 0.805664f, -0.0175781f, 0.46875f, 0.655273f, - -0.608398f, 0.750977f, 0.540039f, -0.0166016f, 0.30957f, - 0.755859f, -0.563477f, 0.609375f, 0.763672f, -0.310547f, - 0.0791016f, 0.668945f, -0.575195f, 0.398438f, 0.767578f, - -0.47168f, -0.12793f, 0.631836f, -0.768555f, 0.293945f, - 0.760742f, -0.743164f, -0.311523f, 0.509766f, -0.755859f, - 0.15918f, 0.614258f, -0.832031f, -0.575195f, 0.448242f, - -0.771484f, -0.0605469f, 0.341797f, -0.652344f, -0.8125f, - 0.262695f, -0.205078f, -0.541992f, 0.337891f, -0.8125f, - -1.20996f, 0.179688f, -0.311523f, -0.682617f, 0.0556641f, - -0.944336f, -1.29102f, 0.09375f, 0.503906f, -0.87793f, - -0.0742188f, -0.805664f, -1.53613f, -0.107422f, 0.50293f, - -0.807617f, -0.423828f, 0.0888672f, -0.847656f, -0.342773f, - 0.719727f, -0.87793f, -0.336914f, 0.115234f, -0.500977f, - -0.487305f, 0.395508f, -0.398438f, -0.624023f, 0.3125f, - -0.0693359f, -0.605469f, 0.429688f, -0.283203f, -0.813477f, - 0.246094f, 0.0898438f, -0.764648f, 0.356445f, -0.106445f, - -1.05371f, 0.595703f, 0.251953f, -0.729492f, 0.336914f, - -0.0595703f, -1.06445f, 0.824219f, 0.320312f, -0.50293f, - 0.459961f, -0.161133f, -0.820312f, 0.516602f, 0.410156f, - -0.401367f, 0.407227f, -0.106445f, -0.740234f, 0.546875f, - 0.663086f, -0.170898f, 0.574219f, -0.419922f, -0.271484f, - -0.0273438f, 0.239258f, -0.0361328f, 0.80957f, -0.576172f, - 0.0664062f, 0.0332031f, 0.181641f, 0.245117f, 1.06641f, - -0.826172f, 0.30957f, -0.241211f, 0.03125f, 0.422852f, - 1.14648f, -0.916992f, 0.672852f, -0.242188f, 0.0234375f, - 0.425781f, 1.16895f, -1.08887f, 0.748047f, -0.384766f, - 0.102539f, 0.457031f, 0.992188f, -0.896484f, 0.65625f, - -0.144531f, 0.0332031f, 0.295898f, 0.8125f, -0.706055f, - 0.166016f, -0.237305f, 0.0996094f, 0.130859f, 0.723633f, - -0.769531f, -0.125f, -0.339844f, -0.277344f, -0.00390625f, - 1.2959f, -0.999023f, 0.0185547f, 0.0527344f, 0.270508f, - 0.104492f, 1.05469f, -1.0918f, 0.205078f, 0.00390625f, - 0.141602f, 0.000976562f, 1.15039f, -1.14844f, 0.0664062f, - -0.0566406f, 0.0732422f, 0.0302734f, 1.08398f, -1.04004f, - 0.124023f, -0.114258f, 0.19043f, 0.0263672f, 0.985352f, - -1.00293f, 0.0634766f, -0.0585938f, 0.257812f, -0.0527344f, - 0.96875f, -0.990234f, -0.0361328f, -0.179688f, 0.266602f, - -0.219727f, 0.882812f, -0.879883f, -0.289062f, -0.00292969f, - 0.351562f, -0.313477f, 0.826172f, -0.84668f, -0.322266f, - 0.337891f, 0.478516f, -0.426758f, 0.594727f, -0.621094f, - -0.435547f, 0.676758f, 0.47168f, -0.432617f, 0.333008f, - -0.338867f, -0.767578f, 0.419922f, 0.576172f, -0.673828f, - 0.321289f, -0.53125f, -0.96582f, 0.290039f, 0.426758f, - -0.526367f, 0.230469f, -0.508789f, -1.05859f, 0.195312f, - 0.493164f, -0.479492f, 0.78418f, -0.992188f, -0.453125f, - -0.185547f, 0.375977f, -0.291992f, 0.77832f, -0.884766f, - -0.361328f, 0.438477f, -0.118164f, -0.222656f, 0.923828f, - -0.796875f, 0.0234375f, -0.375f, 0.0332031f, -0.216797f, - 0.908203f, -0.984375f, -0.295898f, -0.384766f, 0.0234375f, - -0.305664f, 1.12695f, -1.04004f, -0.344727f, -0.136719f, - 0.119141f, -0.385742f, 1.06738f, -1.01855f, -0.245117f, - -0.106445f, -0.114258f, -0.365234f, 0.962891f, -0.923828f, - -0.430664f, -0.637695f, -0.347656f, -0.436523f, 0.702148f, - -0.547852f, -0.618164f, -0.447266f, -0.241211f, -0.462891f, - 0.729492f, -0.609375f, -0.578125f, -0.486328f, -0.0556641f, - -0.536133f, 0.50293f, -0.480469f, -0.526367f, -0.210938f, - -0.0585938f, -0.637695f, 0.723633f, -0.319336f, -0.348633f, - -0.00292969f, -0.305664f, -0.629883f, 0.431641f, 0.266602f, - -0.612305f, -0.260742f, 0.0166016f, -0.65332f, -0.272461f, - 0.800781f, -1.09863f, -0.166992f, -0.0859375f, -0.520508f, - -0.473633f, 0.586914f, -0.696289f, -0.682617f, -0.149414f, - 0.198242f, -0.805664f, 1.1377f, 0.444336f, -0.458984f, - -0.577148f, 0.522461f, -0.683594f, 1.25586f, 0.827148f, - -0.249023f, -0.851562f, 0.84668f, -0.448242f, 1.26953f, - 0.855469f, -0.155273f, -0.765625f, 1.0f, -0.337891f, - 0.973633f, 0.660156f, -0.0859375f, -0.476562f, 1.11035f, - -0.00976562f, 0.547852f, 0.958984f, -0.34082f, -0.504883f, - 0.853516f, 0.0664062f, 0.378906f, 0.758789f, -0.749023f, - -0.509766f, 0.739258f, 0.499023f, -0.144531f, 0.84668f, - -0.931641f, -0.329102f, 0.740234f, 0.791992f, -0.168945f, - 0.594727f, -0.435547f, -0.268555f, 0.336914f, 0.817383f, - -0.430664f, -0.0253906f, -0.735352f, -0.0683594f, 0.152344f, - 0.725586f, -0.68457f, -0.294922f, -1.25391f, -0.125f, - 0.0917969f, 0.907227f, -0.633789f, -0.28125f, -0.222656f, - 0.0f, 0.188477f, 1.06445f, -0.929688f, 0.144531f, - -0.139648f, -0.00390625f, -0.21582f, 1.21387f, -0.952148f, - -0.0253906f, -0.389648f, 0.148438f, -0.283203f, 1.14844f, - -0.890625f, -0.204102f, -0.222656f, -0.0332031f, -0.451172f, - 0.625f, -0.486328f, -0.716797f, -0.103516f, 0.265625f, - -0.667969f, 0.231445f, -0.385742f, -0.977539f, 0.111328f, - 0.222656f, -0.766602f, 0.300781f, -0.390625f, -1.07129f, - 0.230469f, 0.318359f, -0.787109f, 0.427734f, -0.512695f, - -0.886719f, 0.240234f, 0.260742f, -0.647461f, 0.566406f, - -0.686523f, -0.723633f, -0.198242f, 0.0722656f, -0.3125f, - 0.771484f, -0.725586f, -0.478516f, -0.176758f, -0.113281f, - -0.262695f, 0.78125f, -0.644531f, -0.210938f, -0.0126953f, - -0.317383f, 0.0673828f, 0.944336f, -0.764648f, 0.1875f, - -0.636719f, -0.401367f, 0.118164f, 0.982422f, -0.826172f, - 0.105469f, -1.0625f, -0.298828f, 0.0537109f, 0.949219f, - -0.788086f, 0.176758f, -0.611328f, -0.0322266f, 0.0439453f, - 0.885742f, -0.730469f, 0.301758f, -0.463867f, -0.144531f, - -0.180664f, 1.08398f, -0.97168f, -0.470703f, 0.128906f, - 0.0146484f, -0.112305f, 0.889648f, -0.946289f, -0.165039f, - -1.34277f, -0.258789f, -0.211914f, 0.962891f, -0.844727f, - -0.588867f, 0.144531f, -0.228516f, -0.207031f, 0.974609f, - -0.848633f, -0.0273438f, -0.570312f, -0.228516f, 0.00195312f, - 1.03125f, -0.977539f, -0.0605469f, -0.733398f, -0.0908203f, - 0.0996094f, 0.856445f, -0.854492f, -0.000976562f, -0.458008f, - -0.135742f, 0.222656f, 1.34082f, -1.13574f, 0.639648f, - 0.015625f, -0.234375f, 0.136719f, 0.835938f, -0.822266f, - -0.114258f, -0.673828f, -0.186523f, 0.169922f, 0.925781f, - -0.839844f, 0.175781f, -0.394531f, 0.224609f, -0.0458984f, - 0.94043f, -0.964844f, -0.0556641f, -0.15332f, 0.163086f, - -0.0175781f, 0.944336f, -0.951172f, -0.0478516f, -0.302734f, - 0.117188f, -0.00683594f, 0.973633f, -0.970703f, -0.0810547f, - -0.301758f, 0.09375f, -0.000976562f, 1.01953f, -0.978516f, - 0.0292969f, -0.293945f, 0.0683594f, -0.00683594f, 1.0127f, - -0.966797f, -0.0175781f, -0.314453f, 0.181641f, 0.0126953f, - 0.982422f, -0.990234f, 0.03125f, -0.194336f, 0.155273f, - -0.00292969f, 0.962891f, -0.932617f, -0.00390625f, -0.0976562f, - 0.144531f, -0.0205078f, 0.913086f, -0.914062f, -0.0908203f, - -0.296875f, 0.166992f, -0.015625f, 0.930664f, -0.950195f, - -0.0888672f, -0.28418f, 0.196289f, -0.0107422f, 0.953125f, - -0.960938f, -0.0273438f, -0.195312f, 0.125f, 0.0126953f, - 0.986328f, -0.951172f, 0.0634766f, -0.231445f, 0.162109f, - -0.0136719f, 0.981445f, -0.974609f, -0.0449219f, -0.0761719f, - 0.186523f, -0.015625f, 0.950195f, -0.962891f, -0.0576172f, - -0.162109f, 0.154297f, -0.0292969f, 0.970703f, -0.973633f, - -0.0136719f, -0.394531f, 0.102539f, -0.00878906f, 0.970703f, - -0.915039f, 0.0546875f, -0.313477f, 0.110352f, -0.0234375f, - 0.947266f, -0.922852f, -0.139648f, -0.181641f, 0.12207f, - 0.0625f, 0.780273f, -0.899414f, -0.84375f, -0.0888672f, - -0.318359f, 1.00781f, 0.888672f, 0.27832f, 0.0195312f, - -1.08594f, 0.137695f, 0.56543f, 1.12891f, -0.235352f, - 1.65039f, -0.0820312f, 0.100586f, 0.987305f, 0.261719f, - -0.0615234f, 1.32227f, 0.669922f, 0.0f, 1.04102f, - 0.231445f, -0.174805f, 1.11426f, -0.261719f, -0.0527344f, - 0.958008f, 0.332031f, -0.28418f, 1.26953f, -0.612305f, - 0.208984f, 0.964844f, 1.15625f, -0.486328f, 2.0f, - -0.760742f, 0.0458984f, 1.44629f, 1.21289f, 0.924805f, - 1.1875f, -0.259766f, 0.114258f, 0.210938f, 0.486328f, - -0.422852f, -0.984375f, 1.08789f, 0.453125f, -0.229492f, - 0.457031f, -0.682617f, -0.500977f, 0.210938f, 0.391602f, - -0.303711f, 0.725586f, -0.80957f, -0.391602f, 0.0976562f, - 0.958984f, 0.0185547f, 1.69922f, -1.36035f, 1.98242f, - -0.392578f, -0.461914f, -0.37793f, -0.0712891f, 0.928711f, - -1.60254f, 0.133789f, -0.0419922f, -1.12109f, -0.201172f, - 0.0732422f, -1.99902f, 0.629883f, -0.174805f, -0.894531f, - 0.0742188f, -0.147461f, -1.23633f, -0.259766f, 0.0410156f, - -1.00879f, -0.0166016f, -0.0205078f, -1.99902f, 0.267578f, - -0.0664062f, -0.164062f, 0.511719f, 0.825195f, -1.21191f, - -0.515625f, 0.46875f, 0.0898438f, 1.09766f, -0.144531f, - 1.59375f, 0.166016f, 0.428711f, 0.294922f, 0.8125f, - -0.770508f, 0.535156f, 0.280273f, 0.231445f, 0.504883f, - 0.864258f, -0.884766f, 0.524414f, -0.183594f, 0.0820312f, - 0.713867f, 0.405273f, -0.520508f, -0.326172f, 0.0126953f, - -0.310547f, 1.38086f, 0.831055f, 0.380859f, 1.3125f, - -1.60645f, 0.151367f, 1.01953f, 0.580078f, -0.0283203f, - 2.0f, 1.03516f, -0.0634766f, 1.03418f, 0.332031f, - -0.0859375f, 1.32129f, -0.234375f, 0.0917969f, 1.49219f, - 0.30957f, -0.118164f, 1.76953f, -0.717773f, 0.174805f, - 1.59863f, 0.0947266f, 1.1875f, 0.429688f, 0.442383f, - 0.00976562f, 0.435547f, 0.345703f, -0.114258f, 0.238281f, - -0.689453f, 0.30957f, 0.0732422f, 0.606445f, -0.650391f, - -0.0947266f, -0.03125f, 0.183594f, -0.144531f, 0.746094f, - -0.793945f, -0.574219f, -0.0742188f, 0.196289f, -0.199219f, - 1.13867f, -1.11816f, -0.227539f, -0.462891f, 0.0517578f, - -0.0341797f, 1.18945f, -1.1084f, -0.0283203f, -0.342773f, - 0.174805f, -0.0078125f, 1.05176f, -1.03906f, 0.0253906f, - -0.375977f, -0.169922f, 0.00292969f, 0.837891f, -0.716797f, - -0.0205078f, -0.373047f, 0.293945f, 0.0175781f, 0.833984f, - -0.916016f, -0.0996094f, -0.149414f, 0.200195f, -0.00195312f, - 0.865234f, -0.916016f, -0.0117188f, -0.390625f, 0.290039f, - 0.0234375f, 0.985352f, -0.987305f, 0.0439453f, -0.214844f, - 0.0917969f, 0.0615234f, 1.02832f, -1.00684f, 0.152344f, - -0.452148f, 0.0615234f, -0.00585938f, 1.02148f, -0.976562f, - -0.0927734f, -0.286133f, 0.189453f, -0.0644531f, 1.02539f, - -1.02246f, 0.0166016f, -0.243164f, 0.109375f, -0.09375f, - 0.981445f, -0.931641f, 0.0458984f, -0.460938f, 0.0537109f, - -0.0429688f, 1.05859f, -0.850586f, 0.0771484f, -0.0507812f, - 0.108398f, -0.177734f, 0.779297f, -0.74707f, -0.378906f, - -0.413086f, -0.205078f, -0.0488281f, 0.946289f, -0.760742f, - -0.180664f, -0.228516f, -0.208008f, -0.0615234f, 1.05371f, - -0.953125f, -0.34668f, -1.16797f, -0.0322266f, -0.276367f, - 1.06641f, -0.863281f, -0.0244141f, -0.290039f, -0.0429688f, - 0.0439453f, 1.28223f, -1.06348f, 0.181641f, -0.514648f, - -0.0214844f, 0.0f, 0.861328f, -0.738281f, -0.0449219f, - 0.0722656f, 0.125f, 0.193359f, 1.15039f, -1.0957f, - 0.225586f, -0.137695f, 0.12207f, -0.0400391f, 0.732422f, - -0.818359f, -0.40918f, -0.672852f, -0.425781f, 0.839844f, - 0.856445f, 0.198242f, -0.363281f, 0.206055f, -0.214844f, - 1.20215f, 0.943359f, 0.0195312f, 2.0f, 0.874023f, - 0.0839844f, 0.827148f, 0.587891f, -0.384766f, 1.57715f, - 0.108398f, -0.116211f, 0.952148f, 0.246094f, -0.336914f, - 0.463867f, -0.740234f, 0.0185547f, 0.950195f, 0.55957f, - -0.442383f, 1.09668f, 0.0585938f, 0.132812f, 1.37695f, - 2.0f, -0.59375f, 2.0f, -0.676758f, -0.199219f, - -0.0205078f, 0.268555f, -0.5f, -1.94629f, 1.2832f, - 0.0078125f, -0.201172f, 0.674805f, -0.708984f, -0.490234f, - -0.515625f, 0.0439453f, -0.0830078f, 1.14355f, -1.01953f, - -0.0224609f, -0.282227f, 0.0214844f, -0.078125f, 1.09668f, - -0.961914f, 0.0253906f, -0.56543f, 0.30957f, 0.964844f, - 1.56836f, -0.272461f, 1.91309f, -0.53418f, -0.695312f, - -0.878906f, -0.0146484f, 0.277344f, -1.6416f, 0.0244141f, - 0.0898438f, -0.785156f, 0.229492f, -0.259766f, -1.06055f, - -0.241211f, 0.0224609f, -0.769531f, 0.748047f, -0.680664f, - -0.629883f, -0.549805f, -0.195312f, -0.796875f, -0.399414f, - 0.0859375f, -1.99902f, 0.24707f, 0.208984f, 0.563477f, - 1.91797f, 0.0585938f, 2.0f, -0.990234f, 0.327148f, - -0.0917969f, 1.16797f, -0.94043f, 0.623047f, -1.1748f, - -0.0205078f, -0.0449219f, 0.883789f, -0.905273f, -0.370117f, - -0.601562f, 0.0332031f, -0.0527344f, 0.928711f, -0.833984f, - -0.180664f, -0.267578f, 0.0351562f, -0.0175781f, 0.998047f, - -0.922852f, -0.000976562f, -0.371094f, 0.0341797f, -0.0166016f, - 0.977539f, -0.900391f, -0.00292969f, -0.37207f, 0.0449219f, - -0.0439453f, 0.989258f, -0.904297f, -0.0576172f, -0.37207f, - 0.270508f, -0.368164f, 0.0576172f, -0.607422f, -1.95508f, - -0.182617f, -0.390625f, 1.62598f, 1.52734f, 1.2793f, - 2.0f, -1.99902f, 0.226562f, 1.01465f, 0.669922f, - -0.373047f, 1.71484f, 1.99707f, -0.0654297f, 1.00391f, - 0.330078f, -0.432617f, 0.704102f, -0.96875f, 0.0800781f, - 0.964844f, 0.702148f, -0.5625f, 1.39746f, -0.203125f, - 0.255859f, 1.74512f, 1.52539f, 0.417969f, 2.0f, - -0.0976562f, -0.482422f, 0.09375f, 0.151367f, -0.328125f, - -1.88867f, -0.0595703f, 0.117188f, 0.0751953f, 0.870117f, - -0.870117f, 0.046875f, -0.280273f, 0.125f, 0.124023f, - 1.0791f, -0.964844f, 0.338867f, -0.0791016f, 0.0751953f, - 0.12207f, 0.920898f, -0.888672f, 0.0273438f, -0.250977f, - 0.00488281f, 0.165039f, 1.01074f, -0.944336f, 0.137695f, - -0.387695f, -0.142578f, 0.238281f, 1.77246f, -1.42285f, - 0.90625f, -0.856445f, 0.0556641f, -0.219727f, -0.785156f, - 1.47266f, -1.99902f, 1.27246f, -0.132812f, -0.746094f, - 0.172852f, -0.0830078f, -1.3584f, 0.638672f, 0.0175781f, - -0.786133f, 0.754883f, -0.729492f, -0.808594f, -0.291992f, - 0.170898f, -0.746094f, 0.623047f, -0.667969f, -0.743164f, - -0.241211f, 0.0693359f, -0.725586f, 0.495117f, -0.545898f, - -0.969727f, -0.131836f, 0.0234375f, -0.52832f, 0.280273f, - -0.327148f, -1.0498f, -0.210938f, -0.253906f, 0.234375f, - 0.661133f, -0.0332031f, -0.708008f, -0.458984f, 0.31543f, - 0.480469f, 1.59082f, -1.22266f, 1.41602f, -0.270508f, - 0.263672f, 0.318359f, 1.21289f, -1.12207f, 0.853516f, - -0.272461f, 0.158203f, 1.84766f, 2.0f, 0.341797f, - 2.0f, -0.788086f, -0.264648f, -0.326172f, -1.25977f, - 0.842773f, -1.99902f, -0.947266f, 0.249023f, -0.642578f, - 0.745117f, -0.744141f, -0.404297f, -0.266602f, 0.0898438f, - -0.568359f, 0.501953f, -0.494141f, -0.858398f, 0.0722656f, - -0.543945f, 1.16895f, 1.12012f, 1.47461f, -1.12988f, - -0.27832f, 0.53125f, 0.875f, 0.845703f, -0.318359f, - 1.68555f, 1.29199f, -0.00195312f, 0.861328f, 0.601562f, - -0.519531f, 1.16211f, -1.05957f, 0.0507812f, 0.904297f, - 0.625977f, -0.525391f, 1.16797f, -0.163086f, 0.125977f, - 1.99902f, 2.0f, 2.0f, 2.0f, -0.00195312f, - -1.11719f, -0.3125f, -0.320312f, 0.585938f, -1.99902f, - 0.647461f, 0.198242f, -0.538086f, 0.993164f, -0.897461f, - -0.227539f, -0.354492f, 0.0976562f, -0.416016f, 0.623047f, - -0.682617f, -0.832031f, -0.223633f, -0.160156f, 0.0751953f, - -0.791992f, 1.13379f, -1.99902f, -0.755859f, 0.669922f, - 1.02637f, 1.26758f, -0.293945f, 2.0f, 1.93457f, - -0.0126953f, 0.773438f, 0.475586f, -0.59375f, 0.329102f, - -0.588867f, 0.113281f, 0.740234f, 0.749023f, -0.716797f, - 0.941406f, -0.0878906f, 0.71875f, 1.8125f, 2.0f, - -0.289062f, 2.0f, -1.01074f, 0.0117188f, -0.183594f, - -0.969727f, 0.893555f, -1.99902f, 0.333008f, 0.188477f, - -0.643555f, 0.504883f, -0.511719f, -0.804688f, -0.957031f, - 0.0546875f, -0.305664f, -0.0449219f, -0.145508f, -1.875f, - 0.0996094f, -0.155273f, 1.59668f, 1.5293f, 1.46973f, - 2.0f, -1.9834f, 0.375f, 1.20508f, 0.736328f, - -0.399414f, 2.0f, 2.0f, 0.123047f, 0.834961f, - 1.04004f, -0.808594f, 1.31934f, -0.634766f, 0.548828f, - 0.129883f, -1.64746f, 2.0f, -1.99902f, 0.819336f, - 0.0273438f, -0.254883f, 0.722656f, -0.691406f, -0.464844f, - -1.05566f, 0.0634766f, -0.206055f, 1.02148f, -0.90332f, - 0.0595703f, -0.03125f, 0.129883f, -0.177734f, 0.697266f, - -0.713867f, -0.351562f, -0.169922f, -0.119141f, -0.172852f, - 1.01855f, -0.989258f, -0.12793f, -0.670898f, -0.146484f, - -0.261719f, 1.16602f, -1.05664f, -0.302734f, -0.25293f, - -0.0458984f, -0.198242f, 0.90625f, -0.876953f, -0.144531f, - -0.424805f, -0.151367f, -0.147461f, 0.926758f, -0.835938f, - -0.191406f, -0.326172f, -0.128906f, -0.216797f, 0.910156f, - -0.851562f, -0.291992f, -0.549805f, -0.0517578f, -0.0869141f, - 1.07715f, -0.977539f, -0.0361328f, -0.418945f, -0.148438f, - -0.133789f, 0.907227f, -0.836914f, -0.213867f, -0.768555f, - -0.0664062f, 0.182617f, 1.0498f, -0.915039f, 0.400391f, - -0.523438f, 0.015625f, 0.0f, 1.13184f, -1.09961f, - -0.244141f, -0.330078f, -0.115234f, 0.0166016f, 0.944336f, - -0.868164f, -0.430664f, -0.246094f, -0.0185547f, -0.00976562f, - 0.819336f, -0.822266f, -0.380859f, -1.1709f, 0.0605469f, - -0.0498047f, 0.777344f, -0.703125f, 0.0800781f, -0.451172f, - 0.304688f, 0.0517578f, 0.825195f, -0.771484f, 0.145508f, - 0.495117f, -0.0888672f, -0.243164f, 1.48145f, -1.22168f, - 0.0615234f, -0.192383f, -0.0537109f, 0.0195312f, 1.21582f, - -1.06836f, 0.175781f, -0.394531f, 0.237305f, -0.0126953f, - 0.800781f, -0.920898f, -0.12207f, -0.391602f, -0.0917969f, - -0.0791016f, 1.08008f, -1.03613f, -0.0654297f, -0.423828f, - 0.0478516f, -0.0253906f, 0.873047f, -0.884766f, -0.0722656f, - -0.579102f, 0.0136719f, -0.0917969f, 0.954102f, -0.922852f, - -0.172852f, -0.244141f, 0.0f, -0.141602f, 0.929688f, - -0.894531f, -0.179688f, -0.291992f, 0.0283203f, -0.0947266f, - 0.961914f, -0.926758f, -0.135742f, -0.329102f, 0.0576172f, - -0.0351562f, 0.999023f, -0.958984f, -0.0498047f, -0.248047f, - 0.0869141f, -0.078125f, 1.01074f, -0.954102f, 0.00976562f, - -0.217773f, 0.0986328f, -0.0556641f, 0.916992f, -0.914062f, - -0.136719f, -0.219727f, 0.0488281f, -0.139648f, 0.985352f, - -0.952148f, -0.152344f, -0.286133f, 0.0166016f, -0.0917969f, - 1.0459f, -0.972656f, -0.0605469f, -0.228516f, 0.0507812f, - -0.0810547f, 0.956055f, -0.9375f, -0.18457f, -0.275391f, - 0.0703125f, -0.0986328f, 0.948242f, -0.928711f, -0.162109f, - -0.333008f}; -const size_t kAccelerometerLaptopModeTestDataLength = - ARRAY_SIZE(kAccelerometerLaptopModeTestData); - -const float kAccelerometerFullyOpenTestData[] = { - 0.892578f, -0.0810547f, 0.0146484f, 0.929688f, -0.0644531f, - -0.0234375f, 0.996094f, -0.0136719f, 0.0185547f, 1.02344f, - -0.0615234f, -0.0449219f, 0.978516f, 0.125977f, 0.0400391f, - 0.996094f, 0.0332031f, -0.0117188f, 0.963867f, 0.107422f, - 0.0214844f, 0.980469f, 0.0185547f, -0.00683594f, 0.952148f, - 0.0361328f, 0.0253906f, 0.976562f, -0.00390625f, -0.0126953f, - 0.97168f, 0.0205078f, 0.0517578f, 1.01074f, 0.015625f, - -0.0234375f, 0.953125f, -0.000976562f, 0.0390625f, 0.977539f, - -0.0224609f, -0.00976562f, 0.954102f, 0.0244141f, 0.0439453f, - 0.986328f, 0.00292969f, -0.000976562f, 0.967773f, 0.0537109f, - 0.046875f, 0.99707f, 0.0175781f, -0.000976562f, 0.951172f, - 0.0390625f, 0.0341797f, 0.974609f, -0.00878906f, -0.000976562f, - 0.948242f, 0.0185547f, 0.0478516f, 0.976562f, -0.000976562f, - -0.00683594f, 0.958984f, 0.0263672f, 0.078125f, 0.982422f, - -0.0205078f, 0.0283203f, 0.930664f, 0.00878906f, 0.0664062f, - 0.970703f, 0.00390625f, -0.0078125f, 0.945312f, 0.0380859f, - -0.00585938f, 0.972656f, 0.0419922f, -0.0478516f, 1.01953f, - 0.240234f, -0.182617f, 1.00977f, 0.18457f, -0.126953f, - 1.05566f, 0.0751953f, -0.0888672f, 1.09766f, 0.0732422f, - -0.0898438f, 1.21484f, 0.119141f, -0.000976562f, 1.23633f, - 0.194336f, -0.447266f, 1.31445f, 0.213867f, -0.118164f, - 1.30762f, 0.0908203f, -0.260742f, 0.860352f, 0.141602f, - -0.166016f, 0.868164f, 0.0429688f, -0.258789f, 0.727539f, - 0.0419922f, -0.21875f, 0.740234f, 0.0126953f, -0.162109f, - 0.652344f, -0.00292969f, -0.185547f, 0.666992f, 0.0800781f, - -0.272461f, 0.852539f, -0.0478516f, -0.228516f, 0.819336f, - -0.0996094f, -0.180664f, 0.959961f, -0.0537109f, -0.240234f, - 0.935547f, -0.0917969f, -0.269531f, 0.988281f, -0.0507812f, - -0.197266f, 0.981445f, -0.0712891f, -0.323242f, 0.964844f, - -0.0683594f, -0.203125f, 0.941406f, -0.0898438f, -0.236328f, - 0.942383f, -0.0429688f, -0.206055f, 0.921875f, -0.0527344f, - -0.239258f, 0.976562f, -0.0742188f, -0.261719f, 0.958008f, - -0.09375f, -0.311523f, 0.949219f, -0.0839844f, -0.242188f, - 0.949219f, -0.0742188f, -0.323242f, 0.973633f, -0.0263672f, - -0.238281f, 0.958984f, -0.0488281f, -0.293945f, 0.931641f, - -0.0214844f, -0.225586f, 0.931641f, 0.0195312f, -0.225586f, - 0.810547f, -0.0947266f, -0.15332f, 0.947266f, 0.241211f, - -0.100586f, 0.326172f, 0.286133f, -0.12207f, 0.855469f, - 0.677734f, -0.228516f, 0.229492f, 1.08398f, 0.0224609f, - 0.822266f, 0.759766f, -0.0722656f, 0.294922f, 1.42676f, - 0.147461f, 0.239258f, 0.755859f, 0.142578f, -0.120117f, - 1.00977f, -0.0722656f, -0.154297f, 0.832031f, -0.0576172f, - -0.15332f, 1.10156f, -0.0273438f, -0.119141f, 1.05078f, - 0.0166016f, -0.0927734f, 1.09961f, -0.0703125f, -0.0751953f, - 1.04688f, -0.00195312f, -0.078125f, 0.897461f, -0.0625f, - -0.078125f, 0.854492f, -0.0947266f, -0.123047f, 0.811523f, - -0.0488281f, -0.113281f, 0.796875f, 0.0f, -0.0488281f, - 0.961914f, -0.177734f, -0.0898438f, 0.859375f, -0.172852f, - 0.0126953f, 1.1084f, -0.158203f, 0.0292969f, 1.0791f, - -0.152344f, 0.154297f, 1.29492f, -0.126953f, 0.134766f, - 1.23145f, -0.0878906f, -0.200195f, 0.667969f, -0.216797f, - -0.0888672f, 0.935547f, -0.143555f, 0.000976562f, 1.13281f, - -0.0498047f, 0.00195312f, 1.05469f, -0.231445f, 0.0927734f, - 0.956055f, -0.292969f, 0.0625f, 0.927734f, -0.112305f, - 0.0585938f, 0.975586f, -0.163086f, 0.0957031f, 1.03418f, - -0.229492f, 0.000976562f, 0.985352f, -0.09375f, -0.00585938f, - 0.945312f, -0.140625f, -0.0302734f, 0.998047f, -0.208008f, - -0.0507812f, 0.916016f, -0.112305f, 0.123047f, 0.981445f, - -0.205078f, 0.129883f, 1.02832f, -0.211914f, 0.105469f, - 1.01367f, -0.142578f, 0.111328f, 1.00098f, -0.110352f, - 0.0986328f, 0.999023f, -0.15918f, 0.0839844f, 0.922852f, - -0.223633f, 0.261719f, 1.06641f, -0.138672f, 0.240234f, - 0.916016f, -0.296875f, 0.00488281f, 1.04199f, -0.128906f, - 0.0341797f, 1.0791f, -0.265625f, 0.015625f, 0.963867f, - -0.161133f, 0.015625f, 0.958008f, -0.0722656f, -0.125f, - 1.03125f, -0.19043f, -0.0722656f, 1.16602f, -0.126953f, - -0.143555f, 1.12793f, -0.197266f, -0.120117f, 1.26465f, - -0.232422f, -0.226562f, 1.125f, -0.0712891f, -0.0927734f, - 1.26465f, -0.145508f, -0.551758f, 0.90918f, -0.163086f, - -0.228516f, 1.2041f, -0.0371094f, -0.493164f, 0.827148f, - 0.0371094f, -0.162109f, 0.568359f, -0.195312f, -0.641602f, - 0.438477f, -0.212891f, -0.513672f, 0.208008f, -0.0488281f, - -0.776367f, 0.0488281f, -0.115234f, -0.84375f, -0.314453f, - 0.106445f, -0.966797f, -0.0078125f, 0.00976562f, -1.01953f, - -0.220703f, -0.0322266f, -0.994141f, 0.0117188f, -0.248047f, - -0.975586f, 0.121094f, -0.0205078f, -0.947266f, 0.00292969f, - -0.160156f, -0.9375f, 0.0175781f, -0.0986328f, -0.916992f, - -0.0195312f, -0.208008f, -0.9375f, -0.0654297f, -0.134766f, - -0.948242f, -0.0185547f, -0.231445f, -0.977539f, -0.0537109f, - -0.198242f, -1.0166f, 0.0439453f, -0.433594f, -0.994141f, - -0.0595703f, -0.389648f, -1.07129f, 0.0859375f, -0.109375f, - -1.01953f, 0.0966797f, -0.12207f, -1.01074f, 0.125977f, - -0.192383f, -1.0f, 0.0820312f, -0.166016f, -1.04688f, - 0.0751953f, -0.265625f, -1.00879f, 0.139648f, -0.135742f, - -1.00977f, 0.0644531f, -0.235352f, -0.989258f, 0.100586f, - -0.144531f, -0.858398f, 0.0273438f, -0.22168f, -0.878906f, - -0.0634766f, -0.1875f, -0.905273f, -0.0195312f, -0.232422f, - -0.926758f, -0.0732422f, -0.319336f, -1.05078f, -0.00878906f, - -0.5625f, -1.05176f, 0.111328f, -0.456055f, -0.942383f, - -0.0146484f, -0.171875f, -0.946289f, -0.0224609f, -0.174805f, - -0.901367f, -0.0283203f, -0.332031f, -0.948242f, -0.0732422f, - -0.262695f, -0.867188f, 0.0351562f, -0.271484f, -0.913086f, - -0.0878906f, -0.259766f, -1.2793f, -0.226562f, -0.382812f, - -1.2334f, 0.0400391f, -0.260742f, -1.22949f, -0.216797f, - -0.432617f, -1.21191f, -0.131836f, -0.368164f, -1.10938f, - -0.323242f, -0.505859f, -1.01953f, -0.197266f, -0.405273f, - -1.25488f, -0.347656f, -0.448242f, -0.803711f, 0.0595703f, - -0.253906f, -0.489258f, -0.00390625f, 0.101562f, 0.15332f, - -0.423828f, -0.0195312f, 0.527344f, -0.350586f, -0.24707f, - 0.363281f, -1.33789f, -0.214844f, 0.322266f, -0.768555f, - -0.279297f, 0.266602f, -0.918945f, -0.320312f, 0.0634766f, - -0.97168f, -0.102539f, 0.114258f, -0.891602f, -0.158203f, - 0.0283203f, -0.998047f, -0.198242f, 0.0634766f, -0.931641f, - -0.239258f, 0.147461f, -0.963867f, -0.219727f, 0.142578f, - -1.02051f, -0.279297f, 0.105469f, -0.955078f, -0.238281f, - 0.104492f, -1.02637f, -0.291992f, -0.0302734f, -1.02637f, - -0.225586f, 0.000976562f, -0.907227f, -0.12793f, 0.03125f, - -0.979492f, -0.100586f, 0.0625f, -0.921875f, -0.155273f, - 0.146484f, -0.929688f, -0.158203f, 0.155273f, -0.981445f, - -0.171875f, 0.212891f, -0.927734f, -0.166992f, 0.198242f, - -1.05371f, -0.197266f, 0.189453f, -0.954102f, -0.113281f, - 0.189453f, -1.00293f, -0.180664f, 0.111328f, -0.967773f, - -0.109375f, 0.125977f, -0.966797f, -0.146484f, 0.0712891f, - -0.982422f, -0.0908203f, 0.112305f, -0.928711f, -0.149414f, - 0.0146484f, -1.00781f, -0.0996094f, 0.102539f, -0.810547f, - -0.157227f, -0.0117188f, -0.820312f, -0.0371094f, 0.28418f, - -0.446289f, -0.166016f, 0.208008f, -0.03125f, -0.0761719f, - 0.755859f, -0.280273f, -0.316406f, 1.42188f, 0.198242f, - -0.49707f, 1.37207f, -0.556641f, -0.382812f, 1.36523f, - 0.110352f, -0.342773f, 1.25391f, -0.225586f, -0.570312f, - 0.958984f, 0.0722656f, -0.237305f, 0.984375f, 0.0957031f, - -0.416992f, 0.853516f, 0.0400391f, -0.416016f, 0.873047f, - 0.0644531f, -0.370117f, 1.04004f, 0.0273438f, -0.408203f, - 0.920898f, -0.0986328f, -0.514648f, 0.956055f, 0.0527344f, - -0.428711f, 0.960938f, 0.109375f, -0.522461f, 0.801758f, - -0.277344f, -0.634766f, 0.882812f, 0.0527344f, -0.34668f, - 0.981445f, -0.09375f, -0.298828f, 0.952148f, -0.213867f, - -0.25293f, 0.90918f, -0.132812f, -0.493164f, 0.885742f, - -0.177734f, -0.525391f, 0.915039f, -0.0605469f, -0.439453f, - 0.87207f, -0.0986328f, -0.506836f, 0.905273f, -0.0732422f, - -0.462891f, 0.870117f, -0.0966797f, -0.511719f, 0.897461f, - -0.0234375f, -0.464844f, 0.868164f, -0.0283203f, -0.474609f, - 0.919922f, 0.0205078f, -0.34375f, 0.889648f, -0.00390625f, - -0.445312f, 0.804688f, -0.0263672f, -0.417969f, 0.806641f, - 0.0410156f, -0.399414f, 0.914062f, -0.0722656f, -0.386719f, - 0.890625f, -0.0615234f, -0.40625f, 0.928711f, 0.0253906f, - -0.118164f, 0.943359f, -0.000976562f, -0.398438f, 0.811523f, - -0.0605469f, -0.234375f, 0.879883f, 0.198242f, -0.509766f, - 0.958008f, 0.0361328f, -0.328125f, 0.938477f, -0.00976562f, - -0.429688f, 0.916016f, -0.0185547f, -0.266602f, 0.898438f, - -0.0380859f, -0.450195f, 0.870117f, 0.162109f, -0.210938f, - 0.899414f, 0.117188f, -0.517578f, 0.756836f, -0.0820312f, - -0.361328f, 0.868164f, -0.0576172f, -1.29883f, 0.515625f, - -0.00195312f, -1.13281f, 0.628906f, 0.00390625f, -0.103516f, - 0.485352f, -0.046875f, -0.922852f, 0.412109f, -0.108398f, - -0.898438f, 0.446289f, -0.111328f, -0.925781f, 0.375977f, - -0.125977f, -0.825195f, 0.446289f, -0.0966797f, -0.958008f, - 0.389648f, -0.0810547f, -1.00781f, 0.532227f, -0.104492f, - -1.0791f, 0.459961f, -0.138672f, -0.941406f, 0.509766f, - -0.107422f, -1.14062f, 0.447266f, -0.195312f, -0.867188f, - 0.474609f, -0.233398f, -0.751953f, 0.612305f, -0.126953f, - -0.661133f, 0.702148f, -0.199219f, -0.260742f, 0.856445f, - -0.0292969f, -0.743164f, 0.921875f, -0.0371094f, -0.293945f, - 0.902344f, -0.103516f, -0.416016f, 0.955078f, -0.00488281f, - -0.232422f, 0.951172f, -0.0498047f, -0.331055f, 0.871094f, - 0.00390625f, -0.186523f, 0.905273f, 0.0566406f, -0.249023f, - 0.677734f, 0.0253906f, 0.145508f, 0.826172f, 0.251953f, - -0.428711f, 0.764648f, 0.488281f, -0.265625f, 0.886719f, - 0.256836f, -0.408203f, 0.744141f, 0.689453f, -0.611328f, - 0.755859f, 0.431641f, -0.525391f, 0.588867f, 0.637695f, - -0.750977f, 0.578125f, 0.568359f, -0.540039f, 0.512695f, - 0.530273f, -0.722656f, 0.498047f, 0.526367f, -0.788086f, - 0.647461f, 0.522461f, -0.862305f, 0.567383f, 0.422852f, - -0.765625f, 0.648438f, 0.405273f, -0.938477f, 0.583008f, - 0.272461f, -1.15137f, 0.481445f, 0.00585938f, -0.788086f, - 0.454102f, -0.0615234f, -0.885742f, 0.306641f, -0.333984f, - -0.678711f, 0.322266f, -0.288086f, -0.615234f, 0.220703f, - -0.476562f, -0.748047f, 0.223633f, -0.396484f, -0.729492f, - 0.235352f, -0.510742f, -0.806641f, 0.227539f, -0.476562f, - -0.665039f, 0.275391f, -0.47168f, -0.938477f, 0.345703f, - -0.369141f, -0.709961f, 0.482422f, -0.393555f, -0.380859f, - 0.759766f, -0.143555f, -0.529297f, 0.956055f, -0.0185547f, - -0.12207f, 1.15527f, 0.0380859f, -0.529297f, 1.04102f, - 0.203125f, -0.0283203f, 1.11719f, 0.0888672f, -0.258789f, - 1.02734f, 0.297852f, -0.0244141f, 1.03223f, 0.211914f, - -0.0859375f, 0.798828f, 0.216797f, 0.19043f, 0.891602f, - 0.256836f, -0.102539f, 0.662109f, 0.263672f, 0.208984f, - 0.810547f, 0.380859f, -0.235352f, 0.707031f, 0.507812f, - -0.0800781f, 0.902344f, 0.470703f, -0.301758f, 0.577148f, - 0.674805f, -0.500977f, 0.748047f, 0.472656f, -0.493164f, - 0.478516f, 0.611328f, -1.04395f, 0.491211f, 0.651367f, - -0.581055f, 0.25293f, 0.325195f, -0.950195f, 0.224609f, - 0.404297f, -1.04883f, 0.116211f, -0.00292969f, -0.980469f, - 0.0566406f, 0.0195312f, -0.821289f, 0.0166016f, -0.141602f, - -0.959961f, -0.0322266f, -0.158203f, -0.837891f, 0.119141f, - -0.224609f, -1.00781f, 0.09375f, -0.151367f, -1.00684f, - 0.248047f, -0.238281f, -0.973633f, 0.271484f, -0.324219f, - -0.942383f, 0.443359f, -0.298828f, -0.845703f, 0.581055f, - -0.291992f, -0.700195f, 0.65918f, -0.319336f, -0.262695f, - 0.818359f, -0.286133f, -0.579102f, 0.827148f, -0.272461f, - -0.0908203f, 0.935547f, -0.233398f, -0.374023f, 0.920898f, - -0.137695f, 0.000976562f, 0.964844f, -0.12793f, -0.285156f, - 0.880859f, -0.0244141f, -0.0830078f, 0.930664f, 0.00976562f, - -0.15332f, 0.731445f, 0.172852f, 0.0380859f, 0.876953f, - 0.264648f, -0.194336f, 0.601562f, 0.613281f, -0.132812f, - 0.803711f, 0.53418f, -0.268555f, 0.933594f, 0.899414f, - -0.332031f, 0.923828f, 0.521484f, -0.425781f, 0.972656f, - 0.959961f, -0.506836f, 0.797852f, 0.506836f, -0.125977f, - 0.740234f, 0.756836f, -0.262695f, 0.783203f, 0.691406f, - -0.422852f, 0.474609f, 0.459961f, 0.00390625f, 0.683594f, - 0.941406f, -0.0625f, 0.0810547f, 1.06934f, 0.0625f, - 0.546875f, 0.967773f, 0.0351562f, 0.202148f, 1.32422f, - -0.148438f, 0.269531f, 0.818359f, -0.3125f, 0.0742188f, - 1.23633f, -0.188477f, -0.0263672f, 0.713867f, -0.139648f, - -0.230469f, 0.8125f, -0.134766f, -0.246094f, 0.734375f, - -0.09375f, -0.22168f, 1.17188f, -0.158203f, -0.209961f, - 1.09766f, -0.141602f, 0.00976562f, 0.991211f, -0.238281f, - 0.0341797f, 0.979492f, -0.207031f, -0.0166016f, 1.00293f, - -0.228516f, 0.0527344f, 1.28711f, -0.167969f, 0.164062f, - 0.925781f, -0.255859f, 0.170898f, 0.956055f, -0.256836f, - 0.191406f, 0.936523f, -0.145508f, 0.205078f, 0.904297f, - -0.257812f, 0.117188f, 0.870117f, -0.188477f, 0.166992f, - 1.02441f, -0.288086f, 0.163086f, 0.938477f, -0.262695f, - 0.138672f, 0.947266f, -0.219727f, 0.0947266f, 0.992188f, - -0.0732422f, 0.116211f, 1.00293f, -0.203125f, 0.0205078f, - 0.933594f, -0.235352f, -0.0126953f, 0.844727f, -0.0693359f, - 0.119141f, 1.00195f, -0.110352f, 0.135742f, 1.00391f, - -0.101562f, 0.0546875f, 1.06543f, -0.18457f, 0.0507812f, - 0.933594f, -0.112305f, 0.00976562f, 0.973633f, -0.193359f, - -0.0185547f, 0.885742f, -0.279297f, -0.0107422f, 1.02344f, - -0.078125f, -0.0107422f, 1.0127f, 0.140625f, -0.142578f, - 0.994141f, -0.132812f, -0.145508f, 0.90918f, -0.000976562f, - -0.22168f, 1.0498f, -0.148438f, -0.185547f, 1.2207f, - -0.172852f, -0.196289f, 1.0957f, -0.183594f, -0.0390625f, - 1.34863f, -0.21875f, -0.745117f, 0.952148f, 0.0126953f, - -0.196289f, 1.29492f, -0.150391f, -0.768555f, 0.853516f, - -0.163086f, -0.25f, 0.358398f, -0.0507812f, -0.80957f, - 0.139648f, 0.125f, -0.790039f, -0.257812f, 0.175781f, - -0.795898f, -0.135742f, 0.00585938f, -0.841797f, -0.279297f, - 0.0419922f, -0.708984f, 0.0175781f, -0.0957031f, -0.75f, - -0.204102f, 0.0419922f, -0.78125f, 0.0322266f, -0.125f, - -0.787109f, -0.0380859f, -0.0683594f, -1.06641f, 0.0947266f, - -0.238281f, -1.02148f, 0.117188f, -0.176758f, -1.77539f, - 0.0117188f, -0.31543f, -1.80566f, -0.0625f, -0.273438f, - -0.764648f, 0.143555f, -0.21875f, -0.746094f, 0.162109f, - -0.0351562f, -0.858398f, 0.186523f, -0.250977f, -0.918945f, - 0.0458984f, 0.135742f, -0.988281f, 0.241211f, -0.192383f, - -0.963867f, 0.277344f, -0.129883f, -0.994141f, 0.22168f, - -0.169922f, -0.96582f, 0.290039f, -0.217773f, -0.990234f, - 0.185547f, -0.152344f, -0.978516f, 0.169922f, -0.0361328f, - -0.912109f, 0.119141f, -0.352539f, -0.838867f, 0.183594f, - -0.0380859f, -0.753906f, 0.274414f, -0.575195f, -0.770508f, - 0.192383f, -0.482422f, -0.904297f, -0.0234375f, -0.498047f, - -0.817383f, 0.0527344f, -0.277344f, -0.428711f, 0.114258f, - -0.634766f, -0.427734f, -0.0429688f, -0.405273f, -0.318359f, - 0.118164f, -0.870117f, -0.193359f, 0.171875f, -0.938477f, - -0.1875f, 0.208008f, -1.04688f, -0.246094f, 0.0849609f, - -1.72461f, -0.353516f, 0.234375f, -1.05859f, -0.304688f, - 0.151367f, -1.38672f, -0.663086f, 0.242188f, -0.939453f, - -0.481445f, 0.189453f, -0.87793f, -0.831055f, 0.358398f, - -0.555664f, -0.621094f, 0.444336f, -0.287109f, -0.802734f, - 0.367188f, -0.25293f, -0.753906f, 0.413086f, 0.0126953f, - -1.0127f, 0.335938f, -0.250977f, -0.942383f, 0.563477f, - 0.000976562f, -1.33691f, 0.138672f, -0.365234f, -0.996094f, - 0.542969f, -0.0400391f, -1.44434f, 0.239258f, -0.655273f, - -0.625977f, 0.313477f, -0.444336f, -0.589844f, -0.106445f, - -0.217773f, 0.00585938f, -0.760742f, -0.219727f, 0.0654297f, - -0.626953f, -0.0439453f, 0.0732422f, -1.22168f, 0.0126953f, - 0.210938f, -0.754883f, -0.0839844f, 0.161133f, -0.980469f, - -0.124023f, 0.141602f, -0.828125f, -0.199219f, 0.152344f, - -0.80957f, -0.230469f, 0.231445f, -0.865234f, -0.259766f, - 0.232422f, -0.892578f, -0.305664f, 0.323242f, -0.87793f, - -0.294922f, 0.274414f, -1.0791f, -0.435547f, 0.222656f, - -0.863281f, -0.375f, 0.219727f, -1.0166f, -0.525391f, - 0.0341797f, -0.834961f, -0.454102f, 0.0371094f, -0.984375f, - -0.486328f, -0.135742f, -0.700195f, -0.339844f, -0.0078125f, - -1.20508f, -0.665039f, -0.791016f, 0.00390625f, -0.277344f, - 0.0136719f, -0.492188f, -0.779297f, -1.49316f, 0.0957031f, - -0.179688f, -0.587891f, 0.665039f, 0.398438f, -0.980469f, - 0.428711f, 0.254883f, -0.828125f, 0.724609f, 0.663086f, - -0.90625f, 0.555664f, 0.0791016f, -0.837891f, 0.591797f, - 0.257812f, -0.806641f, 0.609375f, 0.0458984f, -0.779297f, - 0.529297f, 0.00292969f, -0.829102f, 0.640625f, 0.0371094f, - -0.797852f, 0.583008f, 0.208984f, -0.864258f, 0.583984f, - -0.0615234f, -0.758789f, 0.72168f, 0.0947266f, -0.921875f, - 0.605469f, -0.264648f, -0.75293f, 0.701172f, 0.107422f, - -0.735352f, 0.44043f, -0.527344f, -0.398438f, 0.46875f, - -0.421875f, -0.424805f, 0.0810547f, -0.754883f, -0.241211f, - -0.107422f, -1.13574f, -0.410156f, -0.0400391f, -0.942383f, - -0.454102f, -0.12207f, -1.24902f, -0.509766f, -0.393555f, - -0.959961f, -0.511719f, -0.381836f, -1.04883f, -0.924805f, - -0.756836f, -1.17969f, -0.521484f, -0.105469f, -1.16504f, - -0.767578f, -0.477539f, -0.401367f, -0.0341797f, -0.341797f, - 0.0507812f, 0.389648f, -0.507812f, 0.186523f, 0.438477f, - -1.33594f, 0.625977f, 0.518555f, -0.671875f, 0.182617f, - 0.432617f, -1.18359f, 0.132812f, 0.414062f, -0.782227f, - 0.0615234f, 0.401367f, -1.30176f, -0.0683594f, -0.100586f, - -0.586914f, 0.0302734f, 0.191406f, -0.983398f, -0.0273438f, - -0.735352f, -0.224609f, -0.342773f, -0.241211f, -0.566406f, - 0.015625f, -1.1084f, -0.00976562f, -0.652344f, -0.75293f, - 0.239258f, -0.449219f, -1.08789f, 0.107422f, -0.572266f, - -0.887695f, 0.407227f, -0.423828f, -0.919922f, 0.173828f, - -0.705078f, -0.825195f, 0.411133f, -0.484375f, -0.799805f, - 0.237305f, -0.776367f, -0.745117f, 0.459961f, -0.819336f, - -0.749023f, 0.208008f, -0.788086f, -0.716797f, 0.226562f, - -0.795898f, -0.72168f, 0.123047f, -0.790039f, -0.705078f, - 0.101562f, -0.720703f, -0.745117f, -0.0517578f, -0.771484f, - -0.701172f, -0.0175781f, -0.758789f, -0.765625f, -0.0917969f, - -0.745117f, -0.751953f, -0.149414f, -0.6875f, -0.660156f, - -0.0166016f, -0.782227f, -0.592773f, -0.0205078f, -0.726562f, - -0.376953f, 0.119141f, -0.599609f, -0.371094f, 0.0107422f, - -0.736328f, -0.325195f, 0.0771484f, -0.768555f, -0.388672f, - -0.0273438f, -0.750977f, -0.477539f, 0.107422f, -0.919922f, - -0.514648f, 0.125f, -0.961914f, -0.37793f, 0.0136719f, - -0.981445f, -0.447266f, -0.0107422f, -0.823242f, -0.303711f, - 0.0986328f, -1.00684f, -0.366211f, 0.0986328f, -1.14551f, - -0.239258f, 0.140625f, -0.894531f, -0.297852f, 0.0849609f, - -0.949219f, -0.341797f, 0.131836f, -0.966797f, -0.380859f, - 0.0947266f, -0.75293f, -0.391602f, 0.0839844f, -0.908203f, - -0.40625f, 0.161133f, -0.860352f, -0.452148f, 0.1875f, - -0.950195f, -0.496094f, 0.200195f, -0.828125f, -0.581055f, - 0.0771484f, -0.93457f, -0.607422f, 0.0996094f, -0.863281f, - -0.59375f, 0.0927734f, -0.802734f, -0.604492f, 0.0947266f, - -0.807617f, -0.722656f, 0.101562f, -0.844727f, -0.711914f, - 0.149414f, -1.03125f, -0.77832f, 0.125977f, -0.78418f, - -0.740234f, 0.121094f, -0.891602f, -0.808594f, 0.164062f, - -0.650391f, -0.80957f, 0.0888672f, -0.416992f, -0.866211f, - 0.155273f, -0.382812f, -0.880859f, 0.0849609f, -0.264648f, - -0.775391f, 0.229492f, -0.389648f, -0.814453f, 0.0664062f, - -0.226562f, -0.625f, 0.414062f, -0.274414f, -0.681641f, - 0.0292969f, -0.0478516f, -0.711914f, 0.794922f, -0.388672f, - -0.584961f, 0.368164f, -0.257812f, -0.545898f, 1.09277f, - -0.277344f, -0.125977f, 0.822266f, -0.365234f, -0.467773f, - 0.714844f, -0.413086f, -0.136719f, 1.57227f, -0.0947266f, - -0.223633f, 0.817383f, -0.0556641f, -0.0322266f, 1.18945f, - -0.191406f, -0.498047f, 0.991211f, -0.231445f, -0.246094f, - 0.8125f, -0.239258f, -0.755859f, 0.853516f, -0.228516f, - -0.821289f, 0.503906f, -0.121094f, -0.795898f, 0.523438f, - -0.220703f, -0.773438f, 0.517578f, -0.274414f, -0.757812f, - 0.539062f, -0.222656f, -0.770508f, 0.396484f, -0.115234f, - -1.2334f, 0.485352f, -0.217773f, -0.94043f, 1.01758f, - -0.202148f, -0.605469f, 0.0546875f, 0.0957031f, -0.639648f, - -0.661133f, 0.245117f, -0.750977f, 0.0615234f, -0.726562f, - -0.879883f, -0.432617f, -1.05859f, -1.29688f, 0.00488281f, - 0.193359f, -0.939453f, 0.209961f, -0.209961f, -0.793945f, - 0.251953f, 0.722656f, -0.447266f, 0.0615234f, 0.855469f, - -0.454102f, -0.0126953f, 0.0527344f, -0.342773f, 0.154297f, - 1.3877f, -0.65918f, 0.133789f, 0.0576172f, -0.233398f, - -0.12207f, 0.46582f, -1.09961f, 0.438477f, -0.641602f, - -0.861328f, 0.197266f, -1.99902f, -0.932617f, 0.234375f, - 0.389648f, -0.792969f, -0.0908203f, 1.66797f, -1.0459f, - 0.0107422f, -0.543945f, -0.80957f, 0.206055f, -0.27832f, - -0.915039f, 0.104492f, -0.301758f, -0.891602f, 0.0556641f, - -0.681641f, -0.901367f, 0.0498047f, -0.461914f, -0.927734f, - -0.0390625f, -0.229492f, -1.04004f, 0.0869141f, -0.435547f, - -1.02148f, 0.0947266f, -0.527344f, -0.979492f, 0.0751953f, - 0.266602f, -0.786133f, -0.0224609f, -0.0947266f, -0.702148f, - -0.00683594f, -0.316406f, -0.698242f, -0.317383f, 1.92578f, - -1.0498f, 0.0273438f, -1.14258f, -0.226562f, 0.233398f, - -0.995117f, -0.9375f, 0.0146484f, -0.223633f, -0.49707f, - -0.0078125f, -1.95703f, -0.847656f, 0.157227f, 0.129883f, - -0.459961f, -0.114258f, 2.0f, -1.13574f, -0.0839844f, - -0.0878906f, -0.783203f, 0.131836f, -0.803711f, -0.90332f, - 0.208984f, -0.365234f, -0.97168f, -0.0322266f, 0.186523f, - -0.924805f, 0.00292969f, -0.272461f, -0.890625f, 0.015625f, - -0.333008f, -0.932617f, 0.180664f, -0.459961f, -0.90918f, - 0.240234f, -0.625977f, -1.1582f, 0.0996094f, -0.170898f, - -1.08887f, -0.00976562f, -0.849609f, -0.430664f, 0.139648f, - -0.308594f, -0.572266f, -0.722656f, 1.83496f, -1.00977f, - 0.387695f, 0.487305f, -0.268555f, 0.0712891f, -0.0136719f, - -1.5332f, 0.290039f, -0.0351562f, -0.861328f, 1.98535f, - -1.16602f, -0.602539f, 0.441406f, 0.175781f, -0.605469f, - -0.831055f, 0.686523f, -0.984375f, 0.494141f, -0.489258f, - -0.895508f, 0.371094f, -0.665039f, -1.14258f, -0.214844f, - -0.140625f, -1.06348f, -0.0996094f, 0.255859f, -0.874023f, - 0.193359f, -0.0947266f, -0.959961f, -0.0966797f, 0.00195312f, - -0.996094f, -0.0117188f, -0.174805f, -0.962891f, 0.106445f, - -0.162109f, -1.04297f, -0.0283203f, -0.306641f, -1.06738f, - -0.0224609f, -0.129883f, -1.03223f, 0.129883f, 0.195312f, - -1.08789f, -0.130859f, 0.649414f, -0.572266f, -0.0136719f, - -0.793945f, -0.382812f, 0.0f, -1.08301f, -0.78125f, - -0.0224609f, -0.339844f, -0.629883f, -0.0947266f, -1.83789f, - -1.01562f, 0.046875f, 0.223633f, -0.808594f, 0.0957031f, - 1.09766f, -0.756836f, -0.0488281f, 0.157227f, -0.59082f, - -0.103516f, 0.929688f, -0.816406f, -0.0322266f, -0.426758f, - -0.868164f, -0.209961f, -1.99902f, -0.986328f, -0.00878906f, - -0.365234f, -0.980469f, 0.0439453f, 0.59375f, -0.994141f, - 0.0253906f, 0.0371094f, -0.970703f, -0.0273438f, -0.120117f, - -0.935547f, 0.00195312f, -0.235352f, -0.952148f, -0.0263672f, - -0.194336f, -0.917969f, -0.0195312f, -0.261719f, -0.928711f, - -0.0234375f, -0.219727f, -0.945312f, 0.0107422f, -0.228516f, - -0.938477f, 0.00683594f, -0.178711f, -0.791016f, 0.03125f, - -0.255859f, -0.789062f, 0.0f, -0.141602f, -0.789062f, - 0.232422f, -0.285156f, -0.788086f, 0.228516f, -0.28125f, - -1.0f, 0.258789f, -0.277344f, -0.999023f, 0.28125f, - -0.25293f, -1.06152f, 0.046875f, -0.421875f, -1.07715f, - 0.0390625f, -0.224609f, -0.923828f, -0.0205078f, -0.335938f, - -0.984375f, -0.0966797f, -0.34668f, -0.990234f, -0.191406f, - -0.301758f, -1.03613f, -0.241211f, -0.37207f, -0.975586f, - -0.267578f, -0.460938f, -1.00977f, -0.320312f, -0.382812f, - -0.913086f, -0.257812f, -0.457031f, -0.925781f, -0.256836f, - -0.34668f, -0.889648f, -0.237305f, -0.393555f, -0.897461f, - -0.239258f, -0.429688f, -0.844727f, -0.21875f, -0.428711f, - -0.87207f, -0.203125f, -0.368164f, -0.84668f, -0.101562f, - -0.423828f, -0.875977f, -0.165039f, -0.363281f, -0.884766f, - -0.0625f, -0.473633f, -0.90332f, -0.078125f, -0.138672f, - -0.918945f, -0.198242f, -0.25f, -0.928711f, -0.138672f, - -0.267578f, -1.08203f, 0.00488281f, -0.575195f, -1.125f, - -0.0332031f, -0.4375f, -0.924805f, 0.078125f, -0.305664f, - -0.93457f, -0.0166016f, -0.475586f, -0.94043f, -0.00488281f, - -0.533203f, -0.956055f, 0.00292969f, -0.391602f, -1.00293f, - 0.0361328f, -0.711914f, -1.0166f, 0.0332031f, -0.448242f, - -0.806641f, -0.21582f, -0.556641f, -0.759766f, -0.0214844f, - -0.626953f, -0.700195f, -0.263672f, -0.308594f, -0.608398f, - -0.236328f, -0.253906f, -0.616211f, -0.378906f, 0.224609f, - -0.498047f, -0.399414f, 0.206055f, -0.516602f, -0.228516f, - 0.743164f, -0.174805f, -0.125f, 0.760742f, -0.0214844f, - -0.135742f, 0.966797f, 0.240234f, 0.0332031f, 1.01855f, - 0.105469f, 0.15332f, 0.950195f, 0.240234f, 0.0732422f, - 1.16895f, 0.245117f, 0.206055f, 0.952148f, 0.273438f, - -0.0390625f, 1.2793f, 0.404297f, 0.303711f, 0.720703f, - 0.369141f, 0.0966797f, 0.918945f, 0.329102f, 0.0390625f, - 0.991211f, 0.397461f, -0.124023f, 0.866211f, 0.210938f, - 0.130859f, 1.08789f, 0.317383f, 0.0537109f, 0.858398f, - 0.245117f, 0.0732422f, 0.741211f, 0.419922f, 0.0302734f, - 0.681641f, 0.485352f, -0.0214844f, 0.641602f, 0.520508f, - -0.129883f, 0.839844f, 0.490234f, 0.00390625f, 0.676758f, - 0.581055f, -0.0146484f, 0.692383f, 0.432617f, -0.0371094f, - 0.807617f, 0.664062f, 0.255859f, 0.216797f, 1.22559f, - 0.0195312f, 1.22168f, 1.2793f, -0.405273f, 1.72559f, - 0.708984f, -0.209961f, 0.579102f, 0.821289f, 0.0380859f, - 0.605469f, 0.80957f, 0.147461f, 0.419922f, 0.869141f, - 0.0390625f, 0.5625f, 0.786133f, 0.0654297f, 0.594727f, - 0.879883f, 0.0166016f, 0.480469f, 0.835938f, 0.00195312f, - 0.414062f, 0.899414f, -0.03125f, 0.344727f, 0.889648f, - 0.0185547f, 0.236328f, 0.932617f, -0.00585938f, 0.255859f, - 0.910156f, 0.0898438f, 0.262695f, 0.945312f, 0.0126953f, - 0.279297f, 0.860352f, 0.0507812f, 0.322266f, 0.913086f, - 0.00195312f, 0.296875f, 0.875977f, 0.0078125f, 0.373047f, - 0.922852f, -0.0244141f, 0.267578f, 0.884766f, 0.0117188f, - 0.347656f, 0.926758f, -0.0371094f, 0.266602f, 0.894531f, - -0.00683594f, 0.345703f, 0.926758f, -0.0478516f, 0.269531f, - 0.887695f, 0.0146484f, 0.360352f, 0.927734f, -0.03125f, - 0.272461f}; -const size_t kAccelerometerFullyOpenTestDataLength = - ARRAY_SIZE(kAccelerometerFullyOpenTestData); - diff --git a/test/motion_angle_data_literals_tablet.c b/test/motion_angle_data_literals_tablet.c deleted file mode 100644 index 456779f457..0000000000 --- a/test/motion_angle_data_literals_tablet.c +++ /dev/null @@ -1,1040 +0,0 @@ -/* Copyright 2018 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 "util.h" - -/* - * Recopied from - * chromium/src/ash/wm/tablet_mode/accelerometer_test_data_literals.cc - * - * The arrays contain actual accelerator readings. - */ -const float kAccelerometerVerticalHingeTestData[] = { - -0.0766145f, 6.02381f, 7.85298f, -0.268151f, -8.84897f, - -1.3216f, -0.402226f, 5.11401f, 8.77236f, -1.10133f, - -10.1706f, 1.24498f, -1.18752f, 6.40688f, 8.0924f, - -2.60489f, -8.99262f, 2.58574f, 0.632069f, 9.05008f, - 3.61046f, 1.50356f, -9.67257f, 1.93451f, 0.411803f, - 8.81066f, 0.268151f, -0.00957681f, -8.7532f, 2.15478f, - -0.0191536f, 9.49062f, -0.68953f, 0.0383072f, -8.94474f, - 2.99754f, -0.871489f, 9.80665f, 1.53229f, -0.92895f, - -9.88326f, 0.957681f, 0.507571f, 9.19373f, 1.71425f, - 0.287304f, -9.03093f, 0.651223f, 0.363919f, 9.71088f, - 1.18752f, 1.10133f, -10.0556f, 2.98796f, 0.23942f, - 9.39485f, 1.0343f, 0.842759f, -9.73961f, -1.12049f, - 0.172383f, 9.50977f, 1.18752f, 0.0383072f, -9.9503f, - 0.957681f, -0.373495f, 9.96946f, 1.01514f, 0.794875f, - -10.1897f, -1.38864f, -9.50977f, -1.04387f, 0.325611f, - -9.76834f, 1.05345f, -0.679953f, -9.76834f, -0.641646f, - 0.488417f, -9.2895f, 0.316035f, 0.258574f, -9.29908f, - -0.890643f, 0.469264f, -9.33739f, 0.823605f, -0.45011f, - -9.69173f, -1.02472f, 0.536301f, -9.52892f, 0.90022f, - -0.411803f, -9.34696f, -0.890643f, 0.430956f, -9.48104f, - 0.823605f, -0.603339f, -9.7875f, -0.565032f, 0.574608f, - -9.96946f, 0.536301f, -0.699107f, -9.57681f, -0.823605f, - 0.641646f, -9.43316f, 0.593762f, -0.775721f, -9.35654f, - -1.04387f, 0.440533f, -9.77792f, 1.01514f, -0.881066f, - -9.32781f, -1.10133f, 0.306458f, -9.414f, 0.995988f, - 0.0287304f, -9.26077f, -1.01514f, 0.268151f, -9.29908f, - 0.881066f, 0.00957681f, -9.42358f, -0.679953f, 0.201113f, - -9.49062f, 0.488417f, -0.00957681f, -9.47146f, -0.363919f, - 0.191536f, -9.32781f, 0.124498f, 0.124498f, -9.5385f, - -0.0766145f, 0.268151f, -9.32781f, -0.172383f, 0.0574608f, - -9.69173f, 0.21069f, 0.354342f, -9.50019f, -0.306458f, - 0.0383072f, -9.54808f, 0.507571f, 0.363919f, -9.20331f, - -0.775721f, 0.0574608f, -9.59596f, 0.651223f, 0.679953f, - -9.56723f, -0.794875f, -0.0287304f, -9.49062f, 0.794875f, - 0.612916f, -9.06924f, -1.10133f, -0.201113f, -9.20331f, - 1.90578f, 1.46525f, -9.29908f, -2.17394f, 0.603339f, - -0.995988f, 0.0766145f, 9.58638f, -0.344765f, -0.92895f, - -9.1267f, -2.03986f, -0.497994f, 10.477f, -2.49955f, - -0.0957681f, -10.4866f, -1.5706f, -0.23942f, 9.13627f, - -1.92494f, -0.325611f, -9.05008f, -1.5706f, -0.0383072f, - 10.1323f, -1.87705f, -0.632069f, -9.52892f, -1.20668f, - 0.105345f, 9.14585f, -1.13964f, -0.718261f, -9.02135f, - -1.58975f, 0.296881f, 9.50019f, -1.74298f, -1.00556f, - -9.27993f, -1.09176f, 0.23942f, 9.87369f, -1.04387f, - -0.995988f, -9.35654f, -2.08774f, -0.526724f, 9.89284f, - -1.40779f, -0.459687f, -9.50977f, -2.70066f, -1.47483f, - 8.95431f, -1.92494f, 0.526724f, -8.95431f, -1.05345f, - -0.938527f, 9.14585f, -3.02627f, 1.04387f, -8.78193f, - 1.00556f, -3.56257f, 9.0022f, 1.96325f, 2.36547f, - -9.83538f, 1.02472f, -2.59531f, 9.49062f, 1.0726f, - 1.77171f, -9.06924f, 0.0861913f, -2.17394f, 9.21289f, - -0.823605f, 1.52271f, -10.1323f, 0.316035f, -3.09331f, - 10.0844f, 0.555455f, 2.00155f, -9.75877f, 1.51314f, - -2.24097f, 9.61511f, 0.670376f, 1.35033f, -9.77792f, - 0.986411f, -3.36146f, 9.59596f, 1.77171f, 2.29843f, - -9.48104f, 1.4461f, -2.8922f, 8.88728f, 1.84832f, - 2.38462f, -9.19373f, 1.75256f, -2.6432f, 9.89284f, - 1.38864f, 2.19309f, -9.20331f, 9.98861f, -0.718261f, - -0.746991f, 10.6111f, 0.632069f, 0.948104f, 8.99262f, - -0.258574f, 0.517148f, 9.10754f, 0.21069f, -1.21625f, - 9.90242f, -0.162806f, 0.0287304f, 10.5249f, -0.0861913f, - 0.229843f, 9.83538f, 0.0f, 0.181959f, 10.4291f, - -0.172383f, -0.47884f, 9.43316f, 0.201113f, -0.268151f, - 9.76834f, -0.134075f, -0.354342f, 10.0556f, 1.0726f, - 0.277727f, 9.93115f, -1.05345f, 0.363919f, 9.79707f, - 0.651223f, 0.699107f, 10.0173f, -0.775721f, 0.0670376f, - 9.49062f, 0.296881f, 0.919373f, 10.1801f, -0.68953f, - -0.651223f, 9.70131f, 1.00556f, 0.248997f, 9.42358f, - -0.995988f, 1.45567f, 9.13627f, -1.35033f, 2.36547f, - 9.40442f, 0.976834f, -4.34787f, 8.79151f, -0.90022f, - 1.56102f, 8.92558f, 0.6608f, -2.3942f, 9.59596f, - -0.363919f, 1.40779f, 9.05966f, 0.181959f, -2.1452f, - 9.48104f, -0.612916f, 2.36547f, 9.03093f, 0.21069f, - -2.18351f, 9.74919f, -1.5706f, 2.07817f, 8.85855f, - 1.04387f, -2.30801f, 8.81066f, -1.66636f, 3.4285f, - 8.52336f, 0.440533f, -4.52983f, 9.27993f, -2.19309f, - 2.2697f, 8.83939f, 0.90022f, -2.48039f, 9.1267f, - -2.77727f, 1.4461f, 8.78193f, 0.814029f, -4.24253f, - 8.90643f, -3.39977f, 0.651223f, 8.86812f, 1.08218f, - -2.34632f, 9.42358f, -3.26569f, 0.402226f, 8.94474f, - 0.526724f, -2.65278f, 9.38527f, -3.21781f, 0.0f, - 9.20331f, 0.143652f, -2.71024f, 9.44273f, -2.8922f, - -0.497994f, 9.35654f, 0.105345f, -2.78685f, 9.09797f, - -3.4285f, -1.00556f, 8.81066f, 0.785298f, -3.84988f, - 9.31823f, -3.09331f, -1.4461f, 8.68616f, 0.555455f, - -3.27527f, 9.414f, -2.5187f, -1.79086f, 8.59997f, - 0.766145f, -3.47638f, 9.0022f, -2.67193f, -2.43251f, - 8.77236f, 1.39821f, -2.85389f, 8.25521f, -3.29442f, - -2.46124f, 8.15944f, 1.09176f, -3.51469f, 8.72447f, - -2.69108f, -2.48997f, 8.91601f, 0.881066f, -3.66792f, - 8.92558f, -2.33674f, -2.31759f, 8.84897f, 1.06303f, - -3.055f, 8.92558f, -2.49955f, -2.29843f, 8.81066f, - 0.919373f, -2.56658f, 9.31823f, -2.78685f, -1.81959f, - 9.06924f, 0.411803f, -2.86347f, 9.38527f, -2.78685f, - -1.70467f, 9.25119f, 0.335188f, -4.67348f, 9.165f, - -3.9648f, -0.622492f, 8.65743f, 0.248997f, -3.055f, - 9.414f, -3.67749f, 0.0287304f, 8.82982f, 0.852336f, - -2.50912f, 8.82024f, -3.47638f, 0.201113f, 8.98304f, - 1.06303f, -3.33273f, 8.89685f, -3.64876f, 0.718261f, - 8.91601f, 1.52271f, -2.70066f, 8.95431f, -3.56257f, - 1.35991f, 9.05008f, 1.67594f, -3.16992f, 9.08839f, - -3.16035f, 2.03028f, 9.07881f, 1.64721f, -3.04542f, - 8.91601f, -3.11246f, 2.52828f, 8.88728f, 2.07817f, - -1.99198f, 9.1267f, -2.806f, 0.162806f, 9.1267f, - 2.806f, -2.07817f, 9.14585f, -2.31759f, 2.16436f, - 8.8777f, 2.19309f, -1.88663f, 9.88326f, -2.5187f, - 1.94409f, 9.1267f, 2.46124f, -2.806f, 7.64229f, - -6.0717f, 2.9305f, 8.07325f, 5.64074f, -2.63362f, - 4.29999f, -7.9679f, 0.622492f, 4.71179f, 7.74764f, - -3.41892f, 4.42448f, -8.99262f, 1.13964f, 3.98395f, - 8.47547f, -1.9824f, -0.699107f, -9.46189f, -0.794875f, - -0.593762f, 9.24162f, -2.74854f, 1.88663f, -8.8777f, - -0.153229f, 0.861913f, 8.98304f, -2.48039f, -1.52271f, - -9.32781f, -3.39977f, 0.0574608f, 8.99262f, -5.88974f, - -0.746991f, -3.93607f, -8.01579f, -1.17795f, 8.41801f, - -4.17549f, -2.30801f, -2.61447f, -9.44273f, -2.3942f, - 7.46991f, -5.01825f, -1.0343f, 1.89621f, -8.8777f, - -0.890643f, 8.65743f, -4.31914f, -2.16436f, 1.49398f, - -9.69173f, -1.37906f, 9.05008f, -2.43251f, -1.87705f, - 0.402226f, -8.95431f, -2.01113f, 8.72447f, -3.54342f, - -0.344765f, -2.95923f, -8.42759f, -0.92895f, 8.99262f, - -2.34632f, -0.392649f, -6.70376f, -6.55054f, -0.919373f, - 8.80109f, -2.35589f, -0.0766145f, -8.8777f, -5.89931f, - 0.890643f, 9.7875f, 2.24097f, -0.536301f, -8.08282f, - -4.88417f, -0.191536f, 9.21289f, 1.16837f, -0.440533f, - -7.93917f, -4.81713f, -0.890643f, 9.08839f, 1.75256f, - -1.20668f, -9.414f, -2.57616f, -0.708684f, 9.50977f, - 1.40779f, -1.14922f, -9.8258f, -1.24498f, -0.584185f, - 9.63427f, 0.727837f, -0.181959f, -9.25119f, -2.31759f, - -0.0574608f, 9.64384f, -0.612916f, 1.21625f, -9.50977f, - -1.16837f, 0.756568f, 9.45231f, -0.316035f, 1.21625f, - -10.5441f, -0.45011f, 1.5706f, 9.7875f, -1.22583f, - 9.07881f, 0.0766145f, -2.34632f, 9.26077f, 0.316035f, - 4.28083f, 8.72447f, 0.584185f, -3.27527f, 8.39886f, - 0.47884f, 3.98395f, 9.26077f, 2.35589f, -2.98796f, - 9.52892f, -1.61848f, 3.73495f, 8.91601f, 2.98796f, - -3.36146f, 9.7875f, -2.31759f, 3.60088f, 8.86812f, - 3.32315f, -3.62961f, 9.76834f, -2.46124f, 2.72939f, - 2.31759f, 10.2089f, -2.3942f, 0.995988f, -8.68616f, - 5.5737f, 1.13006f, 9.04051f, -2.09732f, 1.26414f, - -8.51378f, 4.40533f, 0.852336f, 9.91199f, -2.07817f, - 0.622492f, -9.18416f, 4.29999f, 0.229843f, 10.0269f, - -1.08218f, 0.220267f, -9.40442f, 4.40533f, 0.0766145f, - 9.54808f, -1.89621f, 0.967257f, -9.05966f, 3.92649f, - 0.335188f, 9.62469f, -0.497994f, 0.430956f, -9.71088f, - 4.02226f, 0.718261f, 9.63427f, 1.59933f, 0.383072f, - -8.88728f, 3.24654f, 0.42138f, 8.71489f, 2.55701f, - 0.68953f, -9.64384f, 1.67594f, 1.0726f, -7.0198f, - 7.20176f, 0.641646f, -9.17458f, 4.18506f, -0.402226f, - -2.46124f, 8.78193f, -0.0383072f, -8.31267f, 4.03184f, - 0.23942f, 2.27928f, 10.4675f, -0.517148f, -9.47146f, - 4.14676f, -1.37906f, 9.59596f, -4.07972f, 3.45723f, - -9.663f, 1.71425f, -0.134075f, 6.95276f, -5.80354f, - 0.268151f, -5.38217f, 7.03895f, 0.00957681f, 5.20978f, - -7.75721f, -0.047884f, -2.83473f, 8.53294f, -0.306458f, - 1.64721f, -8.64786f, 0.766145f, 0.162806f, 8.84897f, - -0.191536f, -2.58574f, -9.19373f, 0.0f, 4.05099f, - 8.52336f, -0.0383072f, -3.10289f, -9.17458f, 0.45011f, - 4.11803f, 9.19373f, 0.0957681f, -2.47082f, -9.61511f, - 0.804452f, 3.98395f, 8.52336f, 0.114922f, 4.00311f, - -8.76278f, 0.699107f, 4.53941f, 8.28394f, -0.0383072f, - 7.95833f, -6.57927f, -0.124498f, 3.52426f, 10.1035f, - -0.229843f, 6.68461f, -6.2345f, -0.153229f, 3.04542f, - 9.59596f, -0.344765f, 7.47949f, -7.29753f, 0.114922f, - 3.90734f, 9.03093f, -0.383072f, 7.57525f, -7.20176f, - -0.172383f, 3.70622f, 9.8258f, -0.335188f, 7.21134f, - -6.7325f, -0.172383f, 2.71024f, 10.2855f, -0.114922f, - 6.608f, -7.41245f, -0.201113f, 1.87705f, 9.39485f, - 1.37906f, -0.0670376f, -9.47146f, 1.1971f, 1.8579f, - 9.49062f, 0.842759f, -1.63763f, -8.95431f, 0.679953f, - 2.8922f, 9.1267f, 1.43652f, -1.58017f, -9.01178f, - 0.890643f, 3.66792f, 9.22246f, 0.746991f, -1.18752f, - -9.04051f, 2.12605f, 2.72939f, 9.52892f, 3.79242f, - 1.48441f, -9.04051f, 4.57771f, -0.785298f, 9.61511f, - 4.61602f, 1.21625f, -8.4659f, 4.94163f, -0.574608f, - 8.4659f, 4.67348f, 1.48441f, -8.23605f, 4.86502f, - -0.852336f, 9.24162f, 5.12359f, 0.92895f, -9.03093f, - 5.84185f, -0.430956f, 8.92558f, 5.38217f, 0.440533f, - -8.37971f, 6.72292f, -0.220267f, 8.02536f, 6.608f, - 1.6089f, -6.30154f, 6.33985f, 0.277727f, 6.58884f, - 9.85453f, 1.39821f, 0.153229f, 10.0844f, -1.46525f, - 0.45011f, 9.68215f, 1.90578f, -0.0766145f, 9.98861f, - -1.96325f, 0.536301f, 9.90242f, 2.20267f, 0.143652f, - 9.94073f, -2.20267f, 0.191536f, 9.46189f, 1.95367f, - 0.0957681f, 9.74919f, -2.06859f, 0.296881f, 9.30866f, - 1.64721f, 0.153229f, 9.84496f, -1.92494f, 0.574608f, - 7.38372f, 0.488417f, 6.76123f, 8.83939f, -1.37906f, - -3.11246f, 9.2895f, 0.153229f, -0.976834f, 9.86411f, - -0.0574608f, -0.957681f, 9.26077f, 0.833182f, 2.07817f, - 9.26077f, -0.938527f, -0.957681f, 10.0269f, -0.354342f, - 2.43251f, 9.84496f, 0.153229f, -0.957681f, 0.986411f, - -8.74362f, 1.34075f, 2.09732f, 9.165f, -1.84832f, - -1.25456f, -10.228f, 2.19309f, 0.42138f, 9.73004f, - -1.23541f, -1.49398f, -10.1706f, 0.172383f, -1.22583f, - 10.2089f, -0.593762f, -2.2314f, -9.663f, -0.526724f, - -1.6089f, 9.65342f, 0.593762f, -2.38462f, -9.165f, - -1.4461f, -2.46124f, 9.42358f, 0.430956f, -2.38462f, - -9.73004f, 0.0383072f, -2.31759f, 9.57681f, -0.47884f, - -2.44209f, -9.5385f, -0.746991f, -2.32716f, 9.58638f, - 0.612916f, -2.34632f, -10.1418f, -1.0726f, -1.92494f, - 9.90242f, 0.890643f, -2.84431f, 9.38527f, -2.38462f, - -1.69509f, -9.50977f, 2.73897f, -3.88818f, 7.9296f, - -2.40378f, -1.5706f, -8.4659f, 2.62405f, -8.91601f, - -2.98796f, 0.497994f, -8.97347f, 2.79643f, 0.373495f, - -10.3717f, 1.02472f, -0.105345f, -10.0461f, -1.02472f, - 0.679953f, -4.89375f, 8.17859f, 0.0766145f, -6.12916f, - -7.61356f, 0.172383f, -6.4835f, 7.5561f, -0.363919f, - -6.09085f, -7.46991f, 0.699107f, -6.19619f, 7.62314f, - -0.248997f, -5.78439f, -7.52737f, 1.55144f, -6.33985f, - 7.50822f, -0.45011f, -5.6982f, -7.48906f, 1.48441f, - -6.36858f, 7.46991f, -0.373495f, -5.72693f, -7.44118f, - 1.63763f, -6.33027f, 7.8434f, -0.316035f, -6.54096f, - -7.57525f, 1.37906f, -6.69419f, 7.52737f, -0.258574f, - -6.41646f, -7.37414f, 1.21625f, -6.62715f, 7.61356f, - -0.392649f, -6.24408f, -7.48906f, 1.23541f, -6.18662f, - 7.60398f, -0.201113f, -5.9472f, -7.45076f, 1.39821f, - -6.14831f, 7.86256f, -0.584185f, -6.26323f, -7.50822f, - 1.6089f, -5.26724f, 8.74362f, -0.153229f, -4.57771f, - -8.41801f, 0.6608f, -3.56257f, 8.82024f, 0.114922f, - -2.86347f, -8.82982f, 0.948104f, -2.53785f, 9.27035f, - 0.23942f, -2.33674f, -9.29908f, 1.02472f, -2.12605f, - 9.67257f, 0.354342f, -2.1452f, -9.45231f, 0.335188f, - -1.71425f, 9.36612f, 0.287304f, -1.41737f, -9.27035f, - -0.229843f, -2.65278f, 8.94474f, -0.306458f, -0.737414f, - -9.414f, 0.172383f, -8.72447f, 5.46836f, 0.325611f, - -10.2663f, -1.80044f, -0.143652f, -9.35654f, -0.794875f, - -0.756568f, -10.1801f, 1.0343f, 1.20668f, -9.54808f, - -0.986411f, -0.766145f, -9.165f, 0.890643f, 1.13964f, - -8.92558f, -0.555455f, -1.22583f, -9.68215f, 0.976834f, - 0.344765f, -9.14585f, 4.05099f, -1.31202f, -9.57681f, - 0.68953f, 1.51314f, -9.54808f, 0.0957681f, 1.45567f, - -9.18416f, -0.229843f, -0.6608f, -9.71088f, 0.047884f, - 1.35033f, -9.87369f, 0.0383072f, -0.909797f, -8.57124f, - 1.1971f, 3.86903f, -9.76834f, -1.13964f, -2.2697f, - -9.38527f, 0.890643f, 2.74854f, -9.38527f, -1.20668f, - -2.3942f, -8.74362f, 1.4461f, 3.45723f, -8.99262f, - -1.72383f, -2.56658f, -9.48104f, 1.13006f, 2.98796f, - -8.80109f, -1.76213f, -2.52828f, -9.69173f, 1.15879f, - 2.3942f, -8.98304f, -1.68552f, -1.71425f, -8.93516f, - 1.25456f, 3.26569f, -9.61511f, -1.38864f, -2.46124f, - -9.37569f, 1.4461f, 3.40934f, -8.83939f, -2.1069f, - -2.42293f, -9.165f, 1.61848f, 2.9305f, -9.165f, - -2.04944f, -2.50912f, -9.31823f, 0.823605f, 0.0f, - -9.48104f, -0.909797f, 0.497994f, -9.30866f, 1.0343f, - -0.775721f, -9.01178f, -1.15879f, 0.814029f, -9.25119f, - 0.948104f, -0.00957681f, -8.80109f, -1.16837f, 0.737414f, - -9.62469f, 1.39821f, -0.248997f, -9.39485f, -1.45567f, - 0.957681f, -9.57681f, 1.79086f, -0.296881f, -9.50019f, - -1.81002f, 0.842759f, -10.0652f, 1.45567f, -0.248997f, - -9.05966f, -1.61848f, 0.871489f, -9.69173f, 1.56102f, - -0.459687f, -8.91601f, -1.77171f, 0.890643f, -9.48104f, - -0.47884f, -0.497994f, -9.48104f, 0.296881f, 0.632069f, - -10.094f, 0.191536f, -0.248997f, -10.4387f, -0.0670376f, - 0.6608f, -8.08282f, 4.95121f, -1.31202f, -8.17859f, - -4.70221f, 1.80044f, -7.9296f, 5.04698f, -0.536301f, - -8.38928f, -4.80756f, 0.68953f, -8.10198f, 5.23851f, - -0.507571f, -7.97748f, -5.17148f, 1.21625f, -8.37013f, - 5.22894f, -0.497994f, -8.01579f, -5.23851f, 0.976834f, - -8.20732f, 5.20978f, -0.335188f, -7.99663f, -5.19063f, - 0.995988f, -8.26478f, 5.02782f, -0.0957681f, -8.0924f, - -5.0374f, 0.948104f, -8.36055f, 5.02782f, -0.268151f, - -8.02536f, -5.09486f, 0.995988f, -8.28394f, 5.01825f, - -0.191536f, -8.20732f, -5.06613f, 0.861913f, -8.37971f, - 5.06613f, -0.325611f, -8.20732f, -5.00867f, 0.92895f, - -8.3414f, 5.04698f, -0.124498f, -8.13071f, -5.14275f, - 0.852336f, -8.29351f, 5.07571f, -0.0766145f, -8.07325f, - -5.10444f, 0.976834f, -8.47547f, 4.77883f, -0.392649f, - -8.13071f, -4.86502f, 1.05345f, -8.60955f, 2.71981f, - 2.79643f, -9.25119f, 1.31202f, -0.306458f, -9.14585f, - 1.02472f, 1.51314f, -8.64786f, -1.33118f, -1.13964f, - -9.35654f, 1.01514f, 2.31759f, -8.72447f, -1.49398f, - -1.72383f, -9.73004f, 1.58017f, 2.7677f, -9.73004f, - -1.84832f, -1.93451f, -9.15543f, 1.33118f, 2.20267f, - -8.93516f, -1.64721f, -0.995988f, -9.45231f, 0.727837f, - 1.81959f, -9.51935f, -0.909797f, -2.78685f, -9.93115f, - 0.191536f, 0.890643f, -9.84496f, -0.23942f, -0.976834f, - -9.61511f, -0.21069f, 0.517148f, -8.80109f, -0.153229f, - -0.430956f, -9.50019f, 0.373495f, 0.948104f, -9.27035f, - -0.555455f, -0.344765f, -9.57681f, 0.172383f, 0.881066f, - -9.43316f, -0.335188f, -0.756568f, -9.50977f, -0.0191536f, - 0.497994f, -9.42358f, -0.181959f, -0.737414f, -9.92157f, - 0.306458f, 0.545878f, -10.0173f, -0.248997f, -0.134075f, - -9.79707f, 0.0287304f, 0.536301f, -9.71088f, -0.162806f, - -0.181959f, -9.60554f, -0.047884f, 0.804452f, -9.39485f, - -0.181959f, -0.593762f, -9.64384f, -0.047884f, 0.612916f, - -9.58638f, -0.201113f, -0.363919f, -9.56723f, 0.248997f, - 0.411803f, -10.1706f, -0.316035f, -0.526724f, -9.63427f, - 0.459687f, 1.09176f, -9.71088f, -0.603339f, -0.23942f, - -9.62469f, -0.0383072f, 0.68953f, -9.50019f, -0.0861913f, - -1.13006f, -9.80665f, -0.134075f, 0.335188f, -9.40442f, - -0.114922f, -0.354342f, -9.34696f, 0.153229f, 1.54187f, - -9.10754f, -0.526724f, -1.00556f, -9.7875f, 0.0287304f, - 0.775721f, -9.58638f, -0.172383f, -0.641646f, -9.60554f, - 0.258574f, 0.919373f, -9.31823f, -0.402226f, -0.603339f, - -9.5385f, -0.0766145f, 0.92895f, -9.09797f, -0.220267f, - -0.354342f, -9.61511f, -0.335188f, 0.316035f, -9.27993f, - 0.0766145f, -0.47884f, -9.40442f, 0.23942f, 0.6608f, - -9.40442f, -0.335188f, -0.603339f, -9.85453f, -0.0766145f, - 0.459687f, -9.54808f, -0.0670376f, -0.287304f, -9.63427f, - -0.344765f, 0.296881f, -9.32781f, 0.0574608f, -0.220267f, - -9.71088f, 0.181959f, 0.354342f, -9.95988f, -0.248997f, - 0.201113f, -9.8258f, -0.0383072f, 0.833182f, -9.83538f, - -0.047884f, -0.670376f, -9.44273f, 0.0670376f, 0.6608f, - -8.90643f, -0.392649f, -0.354342f, -9.54808f, 0.0957681f, - 0.90022f, -9.05008f, -0.411803f, -0.335188f, -9.52892f, - 0.201113f, 1.12049f, -9.23204f, -0.459687f, -0.842759f, - -9.61511f, -0.162806f, 0.248997f, -9.87369f, 0.124498f, - -1.12049f, -9.70131f, -0.0383072f, 0.670376f, -9.50977f, - -0.162806f, -0.890643f, -9.15543f, 0.488417f, 1.51314f, - -8.94474f, -0.852336f, -0.90022f, -9.60554f, -0.23942f, - 0.622492f, -9.35654f, 0.0f, -0.948104f, -9.64384f, - -0.191536f, 1.21625f, -9.2895f, -0.0766145f, -0.785298f, - -9.55765f, -0.306458f, 0.555455f, -9.73004f, 0.172383f, - -0.603339f, -9.663f, -0.306458f, 0.383072f, -9.63427f, - 0.172383f, -0.354342f, -9.70131f, -0.373495f, 0.68953f, - -9.69173f, 0.181959f, -1.0343f, -9.47146f, -0.526724f, - 0.823605f, -9.23204f, 0.220267f, -1.36948f, -9.36612f, - -0.0670376f, 1.05345f, -8.91601f, -0.316035f, -0.814029f, - -9.93115f, -0.268151f, 1.58017f, -10.0748f, 0.143652f, - -1.26414f, -9.87369f, 0.047884f, 2.09732f, -9.39485f, - -0.344765f, -1.48441f, -9.48104f, 0.967257f, 0.699107f, - -9.34696f, -1.15879f, -0.105345f, -9.414f, 0.852336f, - 0.756568f, -9.62469f, -1.0343f, -0.114922f, -9.80665f, - 0.814029f, 0.737414f, -9.23204f, -1.0726f, -0.23942f, - -9.47146f, 0.890643f, 0.392649f, -9.24162f, -1.08218f, - -0.229843f, -9.42358f, 0.775721f, 0.325611f, -9.21289f, - -0.986411f, -0.201113f, -9.52892f, 1.79086f, 2.04944f, - -9.32781f, -2.15478f, -1.39821f, -8.86812f, 2.07817f, - 2.2697f, -8.91601f, -2.24097f, -1.7334f, -9.34696f, - 1.68552f, 2.29843f, -8.78193f, -2.19309f, -1.58017f, - -9.62469f, 1.7334f, 2.35589f, -9.165f, -2.18351f, - -1.63763f, -9.99819f, 2.28886f, 2.27928f, -10.0365f, - -2.36547f, -1.69509f, -10.726f, -0.488417f, -0.363919f, - -9.25119f, 0.976834f, -3.03585f, -9.31823f, 1.41737f, - 2.09732f, -8.8777f, -1.76213f, 0.651223f, -9.71088f, - 1.00556f, 2.28886f, -9.36612f, -1.13006f, -1.53229f, - -9.87369f, 0.814029f, 1.46525f, -9.92157f, -0.919373f, - -0.957681f, -9.35654f, 0.0191536f, 1.09176f, -9.9503f, - -0.0574608f, -1.0726f, -9.50977f, -0.181959f, 0.603339f, - -8.90643f, -0.172383f, -0.0766145f, -9.85453f, -0.287304f, - 0.833182f, -9.76834f, 0.181959f, -0.402226f, -9.50977f, - -0.0957681f, 0.287304f, -9.7875f, 0.0191536f, -0.47884f, - -9.58638f, 0.047884f, 0.344765f, -9.44273f, -0.181959f, - -0.0861913f, -9.57681f, 0.0287304f, 0.555455f, -9.42358f, - -0.220267f, 0.0f, -9.73004f, -0.229843f, 0.21069f, - -9.51935f, 0.0670376f, -0.21069f, -10.0173f, -0.00957681f, - 0.105345f, -9.68215f, -0.0670376f, -0.124498f, -9.50977f, - 0.114922f, 0.287304f, -9.42358f, -0.229843f, 0.0957681f, - -9.57681f, -0.181959f, 0.181959f, -9.32781f, -0.047884f, - 0.105345f, -10.0078f, -0.258574f, -2.19309f, -9.70131f, - 0.248997f, 1.64721f, -9.55765f, -0.612916f, 0.105345f, - -8.76278f, 0.191536f, 0.919373f, -9.414f, -0.0383072f, - -0.641646f, -9.74919f, 0.0670376f, 0.814029f, -9.80665f, - -0.134075f, -0.804452f, -9.44273f, 0.0957681f, 1.01514f, - -9.71088f, 0.220267f, -0.584185f, -9.32781f, -0.248997f, - 0.957681f, -9.76834f, 0.0766145f, -0.440533f, -9.414f, - -0.21069f, 0.708684f, -9.73004f, 0.0574608f, -0.593762f, - -9.27035f, -0.172383f, 0.756568f, -9.663f, 0.287304f, - 0.172383f, -9.10754f, -0.507571f, 0.718261f, -9.49062f, - 0.229843f, 0.0574608f, -9.50977f, -0.402226f, 0.162806f, - -10.1418f, -0.0670376f, -0.411803f, -9.32781f, -0.0383072f, - 0.804452f, -9.57681f, 0.229843f, -0.21069f, -9.57681f, - -0.296881f, 0.469264f, -9.54808f, 2.03986f, 0.641646f, - -10.0269f, -1.00556f, -0.45011f, -8.77236f, 0.402226f, - 0.718261f, -9.37569f, -0.047884f, -0.344765f, -9.98861f, - -1.48441f, 0.047884f, -9.33739f, 1.33118f, -0.23942f, - -9.30866f, -0.68953f, 0.220267f, -10.0556f, 0.708684f, - 0.201113f, -7.12514f, 6.70376f, 0.105345f, -6.81869f, - -6.33985f, 0.92895f, -8.70532f, 5.46836f, 0.220267f, - -8.41801f, -5.36301f, 0.0574608f, -9.84496f, 3.82115f, - 0.248997f, -9.9503f, -3.5913f, -0.229843f, -10.3238f, - 3.09331f, -0.0574608f, -9.71088f, -2.66235f, 0.6608f, - -8.68616f, 1.53229f, 0.641646f, -9.17458f, -1.22583f, - 0.507571f, -10.0078f, -1.09176f, -0.622492f, -10.0078f, - 1.3216f, -0.497994f, -9.46189f, -1.17795f, 0.0766145f, - -9.23204f, 1.01514f, 0.248997f, -9.38527f, -1.94409f, - 0.296881f, -9.21289f, 1.79086f, -0.21069f, -9.10754f, - -2.12605f, 0.440533f, -9.09797f, 1.82917f, 0.172383f, - -9.02135f, -1.54187f, 0.047884f, -9.35654f, 1.54187f, - 0.047884f, -8.99262f, -1.66636f, -0.0191536f, -9.29908f, - 1.49398f, 0.344765f, -9.663f, -1.65679f, -0.593762f, - -9.29908f, 1.58975f, 0.296881f, -9.69173f, -1.1971f, - -0.153229f, -9.5385f, 1.16837f, 0.114922f, -9.80665f, - -1.22583f, 0.268151f, -9.43316f, 1.08218f, -0.114922f, - -9.74919f, -1.27372f, 0.775721f, -9.38527f, 1.11091f, - -0.440533f, -9.49062f, -1.20668f, 0.574608f, -9.37569f, - 0.995988f, -0.536301f, -9.33739f, -1.06303f, 0.871489f, - -9.5385f, 0.948104f, -0.699107f, -9.44273f, -0.976834f, - 0.871489f, -9.72046f, 0.890643f, -0.746991f, -9.87369f, - -1.33118f, 0.488417f, -9.46189f, 1.13006f, 0.248997f, - -8.92558f, -1.0343f, -0.134075f, -9.07881f, 1.04387f, - 0.737414f, -8.82982f, -0.814029f, -1.46525f, -9.20331f, - 1.06303f, 0.105345f, -9.94073f, -0.957681f, -0.153229f, - -9.35654f, 0.948104f, -0.603339f, -9.31823f, 1.34075f, - 2.03028f, -8.82024f, -1.76213f, -0.861913f, -8.42759f, - -0.440533f, 4.67348f, -8.94474f, 0.201113f, -5.08528f, - -7.51779f, -0.948104f, 5.77481f, -8.15944f, 0.833182f, - -5.63116f, -9.69173f, -0.948104f, 2.36547f, -10.1801f, - 0.679953f, -2.2314f, -9.11712f, 1.72383f, 0.574608f, - -8.83939f, -2.03986f, -0.0287304f, -9.31823f, 1.92494f, - 0.804452f, -9.79707f, -2.03028f, -0.517148f, -8.3414f, - 2.68151f, 1.9824f, -8.24563f, -2.71024f, -2.1069f, - -9.15543f, 2.41336f, 2.28886f, -7.49864f, -3.03585f, - -3.66792f, -8.59997f, 2.00155f, 2.59531f, -9.07881f, - -2.11647f, -2.52828f, -9.64384f, 1.89621f, 2.11647f, - -9.36612f, -2.16436f, -1.83875f, -9.01178f, 1.69509f, - 2.19309f, -9.17458f, -1.94409f, -1.56102f, -9.27993f, - 1.49398f, 2.28886f, -9.51935f, -1.72383f, -2.2697f, - -9.10754f, 1.52271f, 2.43251f, -8.84897f, -2.02071f, - -2.02071f, -9.08839f, 1.51314f, 2.55701f, -9.11712f, - -1.8579f, -2.21224f, -9.09797f, 1.47483f, 2.52828f, - -9.13627f, -1.8579f, -2.09732f, -9.06924f, 1.46525f, - 2.43251f, -8.92558f, -1.90578f, -2.09732f, -9.19373f, - 1.50356f, 2.3942f, -9.21289f, -1.82917f, -2.26013f, - -8.5904f, 2.16436f, 2.33674f, -8.51378f, -2.36547f, - -1.83875f, -8.25521f, 3.62961f, 2.03028f, -7.91044f, - -3.74453f, -1.12049f, -8.61913f, 3.84988f, 1.62806f, - -8.83939f, -3.97437f, -1.26414f, -8.23605f, 4.52025f, - 2.13563f, -8.83939f, -4.35745f, -1.14922f, -7.4316f, - 6.02381f, 2.34632f, -7.33583f, -5.84185f, -1.79086f, - -6.63673f, 6.67503f, 2.37505f, -6.44519f, -6.359f, - -1.62806f, -6.06212f, 7.51779f, 2.38462f, -6.25365f, - -7.23049f, -1.80044f, -5.25767f, 8.64786f, 2.09732f, - -4.32872f, -8.68616f, -2.03986f, -4.39575f, 7.97748f, - 2.00155f, -3.77326f, -8.42759f, -0.775721f, -4.64475f, - 8.32224f, 1.61848f, -4.29999f, -8.60955f, -0.622492f, - -4.7501f, 8.5042f, 1.81959f, -4.79798f, -8.4659f, - -1.08218f, -4.64475f, 8.37013f, 1.92494f, -4.53941f, - -8.5904f, -1.13964f, -4.77883f, 8.73405f, 2.11647f, - -3.33273f, -9.414f, -1.37906f, -9.73004f, -0.92895f, - 0.603339f, -9.67257f, 0.852336f, -1.11091f, -9.87369f, - -0.047884f, 0.153229f, -9.98861f, 0.0670376f, -0.440533f, - -9.61511f, 0.651223f, 0.181959f, -9.5385f, -0.785298f, - 0.612916f, -9.50019f, 0.335188f, -0.23942f, -8.88728f, - -0.536301f, 0.00957681f, -9.95988f, 0.670376f, 0.134075f, - -9.29908f, -0.881066f, 0.0861913f, -9.67257f, 0.488417f, - 0.220267f, -9.62469f, -0.545878f, 0.306458f, -9.58638f, - 0.344765f, 0.306458f, -9.165f, -0.574608f, 0.0287304f, - -9.65342f, 0.143652f, 0.287304f, -10.0844f, -0.191536f, - 0.440533f, -9.40442f, 0.679953f, 0.21069f, -9.37569f, - -0.881066f, 0.402226f, -9.79707f, 1.34075f, 0.785298f, - -10.1801f, -1.13964f, -0.220267f, -9.14585f, 2.29843f, - 0.794875f, -9.36612f, -2.24097f, -0.316035f, -8.83939f, - 3.37104f, 0.727837f, -8.70532f, -3.25611f, 0.0766145f, - -8.24563f, 4.42448f, 0.814029f, -8.14029f, -4.27126f, - -0.392649f, -7.63272f, 5.38217f, 0.957681f, -7.05811f, - -5.5737f, -0.0383072f, -7.57525f, 5.93762f, 1.29287f, - -7.02938f, -6.02381f, -0.651223f, -7.46991f, 6.18662f, - 1.76213f, -7.35499f, -6.21535f, -1.37906f, -7.35499f, - 6.38773f, 1.47483f, -7.40287f, -6.27281f, -0.967257f, - -7.02938f, 6.79953f, 1.30245f, -6.95276f, -6.68461f, - -0.890643f, -6.42604f, 7.32626f, 1.09176f, -6.4835f, - -7.19218f, -0.354342f, -6.41646f, 7.57525f, 0.938527f, - -6.11958f, -7.50822f, -0.229843f, -5.88016f, 7.71891f, - 0.794875f, -5.17148f, -7.70933f, 0.105345f, -5.74608f, - 7.85298f, 0.727837f, -5.09486f, -7.72848f, 0.114922f, - -5.9472f, 7.83383f, 0.727837f, -5.91847f, -7.65187f, - -0.0287304f, -5.97593f, 7.77637f, 0.718261f, -6.01423f, - -7.63272f, 0.191536f, -5.95677f, 7.78594f, 0.526724f, - -5.73651f, -7.6806f, 0.507571f, -5.95677f, 7.89129f, - 0.459687f, -5.66947f, -7.74764f, 0.517148f, -5.93762f, - 7.85298f, 0.430956f, -5.81312f, -7.69018f, 0.459687f, - -5.9855f, 7.78594f, 0.469264f, -5.86101f, -7.65187f, - 0.517148f, -6.03339f, 7.82425f, 0.411803f, -5.75566f, - -7.67102f, 0.526724f, -6.00466f, 7.79552f, 0.402226f, - -5.68862f, -7.67102f, 0.42138f, -6.00466f, 7.79552f, - 0.497994f, -5.60243f, -7.69975f, 0.201113f, -6.13873f, - 7.65187f, 0.42138f, -5.3247f, -7.62314f, 0.172383f, - -6.608f, 7.40287f, 0.258574f, -5.77481f, -7.46991f, - 0.593762f, -7.18261f, 6.82826f, 0.134075f, -6.75165f, - -6.71334f, 0.526724f, -7.88171f, 5.79397f, -0.181959f, - -7.19218f, -5.70778f, 1.54187f, -8.4659f, 4.54898f, - -0.842759f, -7.90087f, -4.30956f, 1.95367f, -10.5728f, - 0.632069f, -1.96325f, -9.84496f, 0.153229f, 1.82917f, - -9.27993f, -0.0861913f, -0.92895f, -9.31823f, 0.047884f, - 1.46525f, -9.93115f, 0.325611f, -1.1971f, -10.2759f, - -0.114922f, 2.3942f, -9.59596f, -0.0766145f, -0.316035f, - -9.97903f, 0.363919f, -1.13964f, -9.04051f, 2.50912f, - 1.31202f, -8.67659f, -2.58574f, -0.603339f, -9.83538f, - 1.00556f, 1.40779f, -9.09797f, -0.92895f, -0.948104f, - -9.165f, 0.699107f, 1.24498f, -8.8777f, -0.517148f, - -0.699107f, -9.57681f, 0.507571f, 0.641646f, -9.65342f, - -0.229843f, -0.565032f, -9.55765f, 0.287304f, 0.47884f, - -8.91601f, -0.201113f, -0.833182f, -9.69173f, 0.134075f, - 0.411803f, -9.47146f, 0.162806f, 0.172383f, -9.5385f, - -0.21069f, 0.143652f, -9.30866f, 0.497994f, -0.105345f, - -9.8258f, 0.507571f, 0.507571f, -9.50977f, -0.248997f, - 0.383072f, -9.60554f, 0.641646f, 0.948104f, -9.27993f, - -0.220267f, -0.0766145f, -10.0844f, 0.430956f, 0.986411f, - -9.52892f, -0.00957681f, 0.517148f, -9.02135f, 0.411803f, - 1.43652f, -9.42358f, -0.00957681f, -0.258574f, -9.27035f, - 1.54187f, 0.45011f, -9.84496f, -0.995988f, 0.316035f, - -9.8258f, -0.402226f, 0.842759f, -8.93516f, 0.967257f, - -0.785298f, -8.94474f, 2.63362f, 0.545878f, -9.25119f, - -2.78685f, 0.0383072f, -7.71891f, 5.74608f, 0.909797f, - -9.34696f, -5.07571f, -0.651223f, -8.63828f, 4.58729f, - 0.430956f, -8.69574f, -4.29041f, -1.16837f, -7.39329f, - 7.83383f, 0.612916f, -7.62314f, -7.28795f, -0.229843f, - -6.17704f, 7.59441f, 1.89621f, -5.58328f, -7.56568f, - 0.153229f, -5.53539f, 8.00621f, 0.967257f, -4.83629f, - -7.9679f, 0.411803f, -4.95121f, 8.04452f, 0.248997f, - -4.46279f, -8.20732f, 0.201113f, -4.99909f, 8.42759f, - 0.105345f, -4.89375f, -8.30309f, -0.0287304f, -4.52983f, - 8.5042f, 0.306458f, -4.72137f, -8.5042f, 0.0f, - -4.36702f, 8.72447f, 0.0f, -4.43406f, -8.68616f, - 0.181959f, -4.15633f, 8.8777f, 0.430956f, -3.98395f, - -9.02135f, 0.584185f, -4.14676f, 8.68616f, 0.0670376f, - -3.9648f, -8.85855f, 1.09176f, -4.18506f, 8.84897f, - -0.114922f, -4.35745f, -8.77236f, 0.248997f, -4.22337f, - 8.07325f, 0.325611f, -3.67749f, -8.5042f, 1.37906f, - -9.15543f, 3.87861f, 2.11647f, -9.27993f, -2.25055f, - -1.5706f, -9.31823f, 0.0670376f, 1.47483f, -10.1897f, - -0.0766145f, -0.354342f, -9.24162f, -0.162806f, 0.0670376f, - -9.81623f, 0.325611f, -1.0343f, -5.88016f, 7.79552f, - 1.65679f, -8.16902f, -5.56412f, -2.83473f, -8.38928f, - 4.31914f, 1.39821f, -8.81066f, -4.41491f, -1.08218f, - -8.82982f, 4.46279f, 0.986411f, -8.61913f, -4.73094f, - -0.727837f, -8.06367f, 3.85945f, 1.38864f, -8.16902f, - -3.98395f, -0.766145f, -8.73405f, 3.92649f, 1.63763f, - -8.71489f, -4.10845f, -1.61848f, -8.91601f, 3.36146f, - 2.04944f, -9.08839f, -3.47638f, -1.97282f, -8.82024f, - 3.40934f, 2.29843f, -8.83939f, -3.66792f, -2.24097f, - -8.88728f, 3.553f, 2.17394f, -8.84897f, -3.78284f, - -2.21224f, -8.73405f, 4.01268f, 2.21224f, -8.74362f, - -4.22337f, -2.07817f, -8.63828f, 3.90734f, 2.20267f, - -8.97347f, -3.77326f, -1.87705f, -8.39886f, 4.48195f, - 2.08774f, -9.06924f, -4.30956f, -1.71425f, -7.44118f, - 6.41646f, 1.83875f, -7.72848f, -6.76123f, -1.05345f, - -6.08127f, 7.51779f, 1.35991f, -4.92248f, -7.63272f, - 0.0766145f, -6.33027f, 7.44118f, 1.49398f, -6.03339f, - -7.42203f, -0.430956f, -6.13873f, 7.53695f, 1.42694f, - -6.27281f, -7.45076f, -0.90022f, -6.17704f, 7.54652f, - 1.37906f, -6.14831f, -7.51779f, -0.42138f, -6.06212f, - 7.56568f, 1.47483f, -6.2345f, -7.46033f, -0.316035f, - -6.02381f, 7.67102f, 1.49398f, -6.22492f, -7.50822f, - -0.497994f, -5.67905f, 7.85298f, 1.71425f, -6.03339f, - -7.57525f, -1.05345f, -5.06613f, 8.05409f, 1.83875f, - -4.82671f, -7.97748f, -0.565032f, -4.54898f, 8.23605f, - 1.99198f, -4.42448f, -8.42759f, -1.06303f, -4.24253f, - 8.7532f, 2.17394f, -4.40533f, -8.81066f, -2.05901f, - -3.44765f, 9.10754f, 1.92494f, -3.01669f, -9.39485f, - -0.68953f, -3.055f, 8.68616f, 2.11647f, -3.4285f, - -8.73405f, -1.3216f, -2.72939f, 8.88728f, 2.11647f, - -2.61447f, -9.02135f, -1.21625f, -2.55701f, 9.38527f, - 2.30801f, -2.15478f, -9.663f, -2.33674f, -2.48039f, - 9.23204f, 2.2314f, -1.53229f, -9.71088f, -1.13964f, - -3.66792f, 8.72447f, 2.24097f, -2.29843f, -8.88728f, - -2.31759f, -8.54251f, 3.89776f, 1.75256f, -9.05966f, - -2.90177f, -2.06859f, -9.29908f, 2.04944f, 1.6089f, - -9.86411f, -1.71425f, -1.16837f, -10.2855f, 1.29287f, - 0.766145f, -10.1993f, -1.1971f, -0.373495f, -9.89284f, - 1.1971f, 0.995988f, -9.14585f, -1.48441f, -0.201113f, - -9.43316f, 0.306458f, 1.45567f, -9.19373f, -0.6608f, - -0.727837f, -9.15543f, -0.0287304f, 0.047884f, -9.40442f, - 0.0287304f, 0.392649f, -9.9503f, -0.948104f, 0.0287304f, - -10.1323f, 1.06303f, -0.47884f, -10.0078f, -0.45011f, - 0.23942f, -9.52892f, 0.287304f, -0.191536f, -9.45231f, - -0.545878f, 0.42138f, -9.52892f, 0.354342f, -0.584185f, - -9.86411f, -0.258574f, 0.699107f, -9.44273f, 0.0f, - -0.42138f, -8.4659f, 3.95522f, 0.354342f, -8.57124f, - -4.1276f, 0.430956f, -8.71489f, 4.04141f, 0.306458f, - -8.95431f, -3.9648f, -0.603339f, -8.89685f, 3.58173f, - 0.354342f, -8.52336f, -3.85945f, 0.258574f, -9.35654f, - 3.54342f, -0.785298f, -9.02135f, -3.69665f, 0.92895f, - -8.76278f, 2.84431f, -1.17795f, -8.56167f, -2.806f, - 2.07817f, -8.89685f, 3.13162f, -1.49398f, -8.5042f, - -3.16035f, 2.03028f, -9.09797f, 4.00311f, -0.995988f, - -9.71088f, -3.79242f, 2.70066f, -9.04051f, 3.58173f, - -1.01514f, -8.04452f, -3.64876f, 1.81002f, -7.86256f, - 4.94163f, -0.201113f, -7.46991f, -5.02782f, 1.81959f, - -7.41245f, 6.46434f, -0.47884f, -7.44118f, -6.31112f, - 0.976834f, -6.57927f, 6.68461f, -0.114922f, -6.36858f, - -6.40688f, 2.35589f, -6.02381f, 7.31668f, -0.469264f, - -5.43005f, -7.24007f, 2.43251f, -6.87615f, 7.48906f, - -0.536301f, -7.03895f, -7.15387f, 0.90022f, -5.9855f, - 7.72848f, -0.201113f, -5.78439f, -7.47949f, 1.13964f, - -6.06212f, 7.9296f, -0.268151f, -5.25767f, -7.76679f, - 1.63763f, -5.70778f, 8.29351f, -0.162806f, -4.72137f, - -8.14029f, 1.20668f, -5.29597f, 8.42759f, 0.143652f, - -4.75967f, -8.42759f, 0.603339f, -5.11401f, 8.44674f, - 0.565032f, -4.85544f, -8.43717f, -0.00957681f, -5.43963f, - 8.23605f, 0.919373f, -5.1619f, -8.05409f, -0.325611f, - -5.60243f, 8.0924f, 0.718261f, -5.48751f, -7.86256f, - -0.047884f, -5.84185f, 7.98706f, 1.11091f, -5.58328f, - -7.91044f, 0.162806f, -5.79397f, 7.8434f, 1.16837f, - -5.47793f, -7.69975f, -0.392649f, -5.78439f, 7.77637f, - 1.36948f, -5.63116f, -7.61356f, -0.651223f, -5.95677f, - 7.73806f, 1.55144f, -5.19063f, -7.69975f, -0.833182f, - -6.22492f, 7.5561f, 1.49398f, -5.46836f, -7.53695f, - -0.833182f, -6.87615f, 6.98149f, 1.25456f, -6.53138f, - -6.82826f, -0.871489f, -7.40287f, 6.03339f, 0.6608f, - -6.67503f, -5.9855f, 0.344765f, -8.00621f, 4.66391f, - 0.574608f, -7.71891f, -4.67348f, 0.641646f, -9.48104f, - 2.24097f, 1.0343f, -9.77792f, -2.03028f, -0.995988f, - -9.76834f, 1.30245f, 1.05345f, -9.72046f, -1.25456f, - -0.593762f, -9.47146f, 0.507571f, 1.1971f, -10.4675f, - -0.459687f, -0.804452f, -9.67257f, 0.201113f, 1.15879f, - -9.60554f, -0.383072f, -1.13006f, -9.42358f, -0.0191536f, - 1.08218f, -10.0844f, -0.0574608f, -0.823605f, -7.12514f, - 6.99107f, -0.488417f, -7.20176f, -6.6463f, 1.63763f, - -7.16345f, 6.86657f, -0.430956f, -7.46991f, -6.47392f, - 0.823605f, -7.09641f, 7.1443f, -0.804452f, -6.6463f, - -7.00065f, 1.76213f, -7.50822f, 6.62715f, -0.277727f, - -5.86101f, -7.06768f, 0.986411f, -7.2688f, 7.23049f, - -0.47884f, -7.28795f, -6.97192f, 1.51314f, -7.37414f, - 6.62715f, -0.287304f, -7.24964f, -6.39731f, 0.995988f, - -7.40287f, 6.56969f, -0.392649f, -7.11557f, -6.44519f, - 1.14922f, -7.3071f, 6.8953f, -0.584185f, -6.56011f, - -6.91445f, 1.78129f, -7.51779f, 6.78038f, -0.612916f, - -5.74608f, -7.02938f, 3.48596f, -7.24007f, 6.33985f, - -0.325611f, -6.8953f, -6.03339f, 0.536301f, -8.99262f, - 5.01825f, -0.258574f, -9.73961f, -4.56814f, 0.632069f, - -9.79707f, 1.66636f, 0.287304f, -9.21289f, -1.87705f, - -0.105345f, -9.77792f, 1.10133f, 0.995988f, -8.88728f, - -1.47483f, -0.335188f, -9.44273f, 1.24498f, 0.497994f, - -9.44273f, -1.34075f, -0.268151f, -9.7875f, 1.0726f, - 0.68953f, -9.39485f, -1.27372f, -0.162806f, -8.86812f, - 2.24097f, 0.545878f, -8.61913f, -2.47082f, 0.632069f, - -9.0022f, 2.02071f, 0.718261f, -9.36612f, -2.12605f, - -0.440533f, -9.22246f, 2.29843f, 1.05345f, -9.10754f, - -2.46124f, -0.402226f, -9.55765f, 2.32716f, 0.842759f, - -9.19373f, -2.50912f, -0.497994f, -8.95431f, 2.62405f, - 1.0726f, -9.15543f, -2.73897f, -0.737414f, -9.54808f, - 2.34632f, 1.11091f, -9.05966f, -2.55701f, -0.440533f, - -10.0556f, -0.746991f, 1.15879f, -8.90643f, 1.48441f, - -1.74298f, -8.53294f, -2.1452f, 2.67193f, -9.15543f, - 2.84431f, -1.62806f, -8.94474f, 1.81959f, 0.42138f, - -9.30866f, -1.75256f, -0.746991f, -9.92157f, 2.12605f, - 0.670376f, -9.35654f, -2.24097f, -0.699107f, -9.49062f, - 2.12605f, 1.25456f, -8.91601f, -2.36547f, -0.411803f, - -8.86812f, 2.40378f, 0.948104f, -8.95431f, -2.47082f, - -0.871489f, -8.90643f, 2.65278f, 1.49398f, -8.95431f, - -2.88262f, -1.18752f, -8.95431f, 3.15077f, 1.25456f, - -9.05966f, -3.34231f, -1.10133f, -9.02135f, 2.9305f, - 1.25456f, -9.03093f, -3.26569f, -1.0726f, -9.32781f, - 2.87304f, 1.0726f, -8.97347f, -3.26569f, -0.794875f, - -9.1267f, 2.94966f, 1.10133f, -9.06924f, -3.20823f, - -0.679953f, -9.06924f, 3.01669f, 1.01514f, -8.98304f, - -3.21781f, -0.507571f, -9.165f, 3.18908f, 0.555455f, - -9.03093f, -3.49553f, -0.354342f, -9.04051f, 3.32315f, - 0.344765f, -9.05966f, -3.48596f, -0.181959f, -8.76278f, - 3.02627f, 0.708684f, -8.90643f, -3.23696f, -0.248997f, - -8.85855f, 2.79643f, 0.641646f, -8.90643f, -2.96881f, - -0.306458f, -8.92558f, 2.7677f, 0.833182f, -8.91601f, - -3.02627f, -0.430956f, -8.94474f, 2.86347f, 1.00556f, - -8.86812f, -3.16035f, -0.565032f, -8.98304f, 2.94966f, - 1.1971f, -9.07881f, -3.20823f, -0.766145f, -8.89685f, - 2.92093f, 1.12049f, -8.89685f, -3.09331f, -0.842759f, - -8.83939f, 2.97839f, 0.967257f, -8.85855f, -3.1795f, - -0.919373f, -8.93516f, 3.15077f, 1.42694f, -8.90643f, - -3.43807f, -0.948104f, -8.99262f, 3.20823f, 1.33118f, - -8.92558f, -3.43807f, -1.0726f, -8.86812f, 3.01669f, - 1.52271f, -8.77236f, -3.33273f, -1.08218f, -8.81066f, - 3.23696f, 1.50356f, -8.82024f, -3.4668f, -1.13964f, - -8.86812f, 3.41892f, 1.40779f, -8.90643f, -3.62961f, - -1.06303f, -8.82982f, 3.38061f, 1.55144f, -8.79151f, - -3.62003f, -1.08218f, -8.82024f, 3.12204f, 1.67594f, - -8.82024f, -3.41892f, -1.15879f, -8.73405f, 3.25611f, - 1.75256f, -8.72447f, -3.4285f, -1.28329f, -8.79151f, - 3.32315f, 1.96325f, -8.78193f, -3.5913f, -1.55144f, - -8.71489f, 3.27527f, 2.02071f, -8.73405f, -3.48596f, - -1.67594f, -8.82024f, 3.16035f, 2.02071f, -8.7532f, - -3.41892f, -1.62806f, -8.73405f, 3.40934f, 1.90578f, - -8.74362f, -3.62003f, -1.38864f, -8.74362f, 3.41892f, - 1.93451f, -8.68616f, -3.66792f, -1.45567f, -8.70532f, - 3.40934f, 1.99198f, -8.68616f, -3.62961f, -1.78129f, - -8.69574f, 3.56257f, 1.93451f, -8.72447f, -3.77326f, - -1.45567f, -8.79151f, 3.45723f, 2.13563f, -8.74362f, - -3.68707f, -1.54187f, -8.79151f, 3.25611f, 2.03986f, - -8.65743f, -3.62003f, -1.6089f, -8.80109f, 3.32315f, - 1.92494f, -8.69574f, -3.5913f, -1.88663f, -8.99262f, - 3.13162f, 1.91536f, -8.63828f, -3.50511f, -1.42694f, - -8.69574f, 3.19865f, 2.22182f, -8.86812f, -3.43807f, - -1.80044f, -8.89685f, 2.61447f, 2.05901f, -8.7532f, - -2.85389f, -1.39821f, -9.32781f, 2.38462f, 2.08774f, - -8.85855f, -2.67193f, -1.5706f, -9.72046f, 1.13006f, - 1.86748f, -9.03093f, -0.756568f, -1.0343f, -10.3334f, - 0.42138f, -1.53229f, -9.57681f, -0.220267f, 1.26414f, - -8.95431f, -0.383072f, 0.201113f, -9.73961f, 0.651223f, - -0.565032f, -10.3334f, -0.651223f, -0.0574608f, -9.68215f, - 0.536301f, 1.02472f, -9.56723f, -0.823605f, -0.296881f, - -9.58638f, 0.890643f, 0.0287304f, -9.50977f, -0.957681f, - -0.0957681f, -9.54808f, 0.890643f, 0.0861913f, -9.72046f, - -1.04387f, -0.248997f, -9.35654f, 1.00556f, 0.335188f, - -9.47146f, -0.948104f, -0.325611f, -9.45231f, 0.90022f, - 0.0383072f, -9.70131f, -0.814029f, -0.191536f, -9.51935f, - 0.756568f, 0.335188f, -9.69173f, -0.861913f, -0.0383072f, - -9.58638f, 0.775721f, 0.306458f, -9.73004f, -0.986411f, - 0.00957681f, -9.47146f, 0.833182f, 0.258574f, -9.64384f, - -0.766145f, -0.287304f, -9.5385f, 0.699107f, 0.335188f, - -9.60554f, -0.842759f, -0.153229f, -9.5385f, 0.785298f, - 0.402226f, -9.73961f, -0.890643f, -0.191536f, -9.43316f, - 0.785298f, 0.411803f, -9.663f, -0.737414f, -0.392649f, - -9.56723f, 0.775721f, 0.335188f, -9.60554f, -0.766145f, - -0.287304f, -9.49062f, 0.679953f, 0.344765f, -9.67257f, - -0.785298f, -0.201113f, -9.44273f, 0.699107f, 0.316035f, - -9.62469f, -0.737414f, -0.220267f, -9.54808f, 0.679953f, - 0.440533f, -9.96946f, -0.497994f, -0.392649f, -9.61511f, - 0.440533f, 0.363919f, -9.46189f, -0.383072f, -0.383072f, - -9.48104f, 0.306458f, 0.565032f, -9.69173f, -1.0726f, - -0.766145f, -9.05008f, 0.909797f, 0.775721f, -9.63427f, - -0.430956f, -0.737414f, -9.54808f, 0.344765f, 0.718261f, - -9.58638f, -0.383072f, -0.229843f, -9.5385f, 0.172383f, - 0.632069f, -9.62469f, -0.335188f, -0.545878f, -9.52892f, - 0.306458f, 0.622492f, -9.48104f, -0.383072f, -0.392649f, - -9.44273f, 0.23942f, 0.68953f, -9.70131f, -0.344765f, - -0.354342f, -9.59596f, 0.229843f, 0.565032f, -9.40442f, - -0.392649f, -0.497994f, -9.43316f, 0.248997f, 0.555455f, - -9.34696f, -0.373495f, -0.220267f, -9.34696f, 0.181959f, - 0.392649f, -10.4579f, 0.0670376f, 0.181959f, -9.5385f, - -0.229843f, 0.296881f, -9.29908f, -0.0287304f, -0.42138f, - -9.45231f, 0.00957681f, 0.565032f, -9.84496f, -0.0766145f, - 0.105345f, -9.64384f, -0.0574608f, 0.277727f, -9.67257f, - -0.21069f, -0.306458f, -9.29908f, 0.047884f, 0.469264f, - -9.64384f, -0.248997f, 0.114922f, -9.52892f, 0.0191536f, - 0.201113f, -9.64384f, -0.411803f, -0.0861913f, -9.67257f, - 0.248997f, 0.0670376f, -9.73004f, -0.383072f, -0.00957681f, - -9.59596f, 0.268151f, -0.047884f, -9.77792f, -0.162806f, - 0.0766145f, -9.68215f, 0.00957681f, 0.153229f, -9.68215f, - -0.0957681f, 0.143652f, -9.50977f, -0.0957681f, 0.23942f, - -9.60554f, -0.316035f, 0.0f, -9.43316f, 0.124498f, - 0.134075f, -9.52892f, -0.47884f, -0.134075f, -9.50019f, - 0.316035f, -0.00957681f, -9.88326f, -0.23942f, -0.0670376f, - -9.5385f, 0.0861913f, 0.316035f, -9.60554f, -0.0766145f, - 0.220267f, -9.62469f, -0.00957681f, -0.172383f, -9.74919f, - -0.00957681f, 0.0766145f, -9.43316f, -0.105345f, 0.0957681f, - -9.69173f, -0.0670376f, 0.00957681f, -9.51935f, -0.0383072f, - -0.0383072f, -9.71088f, 0.0191536f, 0.0766145f, -9.50977f, - -0.0957681f, 0.0766145f, -9.56723f, -0.105345f, 0.0861913f, - -9.2895f, -0.114922f, 0.153229f, -9.71088f, -0.162806f, - 0.0861913f, -9.50019f, 0.0287304f, 0.0861913f, -9.64384f, - -0.0191536f, 0.287304f, -9.50977f, -0.134075f, -0.0383072f, - -9.50019f, 0.143652f, 0.21069f, -9.44273f, -0.23942f, - -0.344765f, -9.64384f, -0.0287304f, 0.172383f, -9.48104f, - -0.0574608f, -0.0957681f, -9.69173f, -0.181959f, 0.201113f, - -9.48104f, 0.114922f, -0.0574608f, -9.75877f, -0.0670376f, - 0.0191536f, -9.55765f, 0.0383072f, 0.172383f, -9.61511f, - -0.0574608f, 0.268151f, -9.24162f, -0.0957681f, -0.0574608f, - -9.56723f, 0.047884f, 0.325611f, -9.51935f, -0.134075f, - -0.459687f, -9.47146f, 0.0f, 0.622492f, -9.49062f, - -0.0670376f, -0.488417f, -9.59596f, 0.0f, 0.823605f, - -9.48104f, -0.0383072f, -0.574608f, -9.5385f, -0.335188f, - 0.641646f, -9.54808f, 0.296881f, -0.536301f, -9.48104f, - -0.363919f, 0.641646f, -9.50977f, 0.287304f, -0.45011f, - -9.46189f, -0.047884f, 1.13964f, -9.57681f, 0.0f, - -0.632069f, -9.57681f, -0.316035f, 0.909797f, -9.63427f, - 0.258574f, -0.517148f, -9.64384f, -0.344765f, 0.545878f, - -9.59596f, 0.296881f, -0.440533f, -9.54808f, -0.0574608f, - 0.746991f, -9.59596f, -0.0383072f, -0.296881f, -9.49062f, - 0.00957681f, 0.852336f, -9.46189f, -0.124498f, -0.21069f, - -9.57681f, 0.0766145f, 0.641646f, -9.37569f, -0.181959f, - -0.42138f, -9.70131f, 0.344765f, 0.737414f, -9.24162f, - -0.469264f, -0.794875f, -9.47146f, 0.0f, 0.699107f, - -9.76834f, 0.0287304f, -0.746991f, -9.48104f, -0.153229f, - 1.33118f, -9.36612f, 0.0957681f, -0.948104f, -9.74919f, - -0.201113f, 1.10133f, -9.35654f, 0.181959f, -0.909797f, - -9.54808f, 0.0957681f, 0.881066f, -9.73961f, 0.153229f, - -1.05345f, -9.49062f, -0.306458f, 1.04387f, -9.51935f, - 0.584185f, -0.766145f, -9.93115f, -0.814029f, 0.727837f, - -9.75877f, 1.0726f, -0.316035f, -9.72046f, -0.296881f, - 0.162806f, -9.47146f, 0.392649f, 0.0766145f, -9.40442f, - 0.21069f, 0.287304f, -9.37569f, -0.248997f, 0.536301f, - -9.5385f, 0.0861913f, 0.114922f, -9.40442f, -0.0287304f, - -0.0383072f, -10.0461f, 0.181959f, -0.00957681f, -9.32781f, - -0.181959f, 0.622492f, -9.46189f, 0.296881f, -0.201113f, - -9.35654f, -0.201113f, 0.201113f, -9.31823f, -0.402226f, - 0.21069f, -9.91199f, 0.517148f, 1.01514f, -9.87369f, - 0.047884f, -0.047884f, -9.56723f, 0.248997f, -0.114922f, - -9.76834f, -0.335188f, 0.0383072f, -9.02135f, 0.316035f, - 0.105345f, -9.5385f, -0.335188f, 0.0287304f, -9.59596f, - 0.344765f, 0.670376f, -9.70131f, 0.0287304f, -0.383072f, - -10.4579f, 0.402226f, 0.411803f, -10.4291f, -0.45011f, - 0.306458f, -9.44273f, 0.545878f, 0.430956f, -9.79707f, - 0.507571f, -0.679953f, -9.26077f, -0.469264f, 1.26414f, - -9.51935f, 0.775721f, -0.114922f, -9.19373f, -0.718261f, - 0.718261f, -9.68215f, 0.881066f, -0.316035f, -9.01178f, - -0.890643f, 0.938527f, -9.25119f, 1.04387f, -0.861913f, - -8.76278f, -0.881066f, -0.823605f, -9.71088f, 0.354342f, - -0.181959f, -9.32781f, -0.248997f, -0.0957681f, -10.4387f, - 0.995988f, -0.268151f, -10.2376f, -0.699107f, 0.536301f, - -9.98861f, 0.555455f, -0.0574608f, -9.49062f, -0.459687f, - 0.823605f, -9.79707f, 0.316035f, 0.268151f, -8.85855f, - -0.488417f, -0.574608f, -9.663f, 0.373495f, -0.287304f, - -9.42358f, 0.0191536f, -1.65679f, -9.42358f, 1.0726f, - 1.80044f, -9.63427f, -0.21069f, -1.66636f, -9.31823f, - 0.306458f, 2.83473f, -9.17458f, 0.814029f, -2.98796f, - -8.67659f, 0.143652f, 1.7334f, -9.31823f, 1.23541f, - -1.15879f, -9.13627f, -1.75256f, 0.785298f, -8.80109f, - 2.54743f, -0.0766145f, -9.91199f, -0.134075f, 1.21625f, - -9.72046f, 0.488417f, 0.363919f, -9.14585f, -0.277727f, - 1.0343f, -9.21289f, 0.718261f, -0.143652f, -9.48104f, - -0.296881f, -0.114922f, -9.2895f, 0.565032f, 0.565032f, - -10.2663f, 0.459687f, -0.143652f, -9.56723f, -0.105345f, - 0.459687f, -10.094f, 0.68953f, -0.306458f, -9.59596f, - -0.172383f, 0.957681f, -10.094f, 0.0861913f, -0.220267f, - -9.34696f, 0.191536f, 0.392649f, -9.79707f, -0.181959f, - -0.488417f, -9.55765f, 0.555455f, 1.0343f, -10.1227f, - 0.0191536f, -0.976834f, -9.40442f, 0.354342f, 0.871489f, - -9.69173f, 0.593762f, -0.296881f, -9.14585f, -0.517148f, - 1.31202f, -9.69173f, 0.861913f, -0.775721f, -9.07881f, - -0.68953f, 0.497994f, -9.90242f, 0.919373f, 0.00957681f, - -9.43316f, -0.68953f, 0.325611f, -9.79707f, 0.507571f, - 0.114922f, -9.40442f, -0.316035f, 0.430956f, -9.8258f, - 0.536301f, -0.0191536f, -9.32781f, -0.258574f, 0.258574f, - -9.93115f, 0.383072f, 0.143652f, -9.48104f, -0.181959f, - 0.6608f, -9.55765f, 0.0861913f, -0.0383072f, -9.37569f, - 0.0287304f, 0.430956f, -9.39485f, 0.325611f, 0.0287304f, - -9.32781f, -0.0861913f, 0.392649f, -9.50019f, 0.651223f, - 0.23942f, -9.40442f, -0.469264f, 0.545878f, -9.75877f, - 0.536301f, 0.0574608f, -9.38527f, -0.411803f, 0.47884f, - -9.87369f, 0.574608f, 0.0383072f, -9.54808f, -0.402226f, - 0.258574f, -9.65342f, 0.325611f, 0.23942f, -9.56723f, - -0.220267f, 0.6608f, -9.50977f, 0.134075f, 0.0766145f, - -9.38527f, -0.047884f, 0.536301f, -9.70131f, 0.0f, - -0.42138f, -9.35654f, 0.181959f, 0.881066f, -9.71088f, - 0.181959f, -0.402226f, -9.50019f, -0.00957681f, 0.727837f, - -9.49062f, 0.306458f, -0.0766145f, -9.27993f, -0.268151f, - 0.766145f, -9.73961f, 0.181959f, -0.517148f, -9.49062f, - -0.0287304f, 0.986411f, -9.86411f, 0.0383072f, -0.383072f, - -9.47146f, 0.0383072f, 0.986411f, -9.50977f, 0.402226f, - -0.383072f, -9.10754f, -0.363919f, 0.823605f, -10.0365f, - 0.90022f, -0.497994f, -9.59596f, -0.651223f, 0.833182f, - -9.73961f, 0.517148f, -0.0957681f, -9.31823f, -0.440533f, - 0.641646f, -9.56723f, 0.0191536f, -0.114922f, -9.33739f, - -0.047884f, 0.593762f, -9.67257f, -0.23942f, -0.459687f, - -9.51935f, 0.258574f, 0.794875f, -9.39485f, 0.0574608f, - -0.172383f, -9.29908f, -0.0574608f, 0.440533f, -10.0078f, - 0.134075f, -0.536301f, -9.45231f, -0.0670376f, 0.766145f, - -10.0748f, -0.0287304f, -0.584185f, -9.55765f, -0.0766145f, - 1.06303f, -9.73961f, 0.392649f, -0.402226f, -9.50019f, - -0.316035f, 1.35991f, -9.75877f, 0.229843f, -0.373495f, - -9.51935f, -0.248997f, 1.39821f, -10.2855f, 0.191536f, - -0.181959f, -10.1514f, -0.124498f, 1.23541f, -10.0461f, - 0.105345f, -0.440533f, -9.88326f, 0.0574608f, -0.0191536f, - -9.60554f, -0.201113f, 0.0957681f, -9.33739f, 0.047884f, - -0.248997f, -9.29908f, -0.23942f, 0.373495f, -9.04051f, - -0.0861913f, -0.00957681f, -9.24162f, -0.114922f, 1.78129f, - -9.414f, -0.124498f, -1.16837f, -9.68215f, -0.181959f, - 1.35033f, -9.60554f, 0.0191536f, -1.4461f, -9.19373f, - -0.220267f, 1.84832f, -9.23204f, -0.00957681f, -1.70467f, - -9.11712f, -0.181959f, 1.50356f, -8.74362f, -0.143652f, - -1.97282f, -8.89685f, 0.143652f, 1.88663f, -8.90643f, - -0.373495f, -1.25456f, -8.81066f, -0.124498f, 1.31202f, - -8.79151f, -0.134075f, -0.92895f, -8.99262f, -0.536301f, - 0.430956f, -9.31823f, 0.373495f, -0.181959f, -10.2855f, - -0.153229f, 0.708684f, -10.5536f, 0.229843f, -0.105345f, - -10.2855f, -0.220267f, -0.105345f, -9.95988f, 0.296881f, - -0.162806f, -9.79707f, -0.0861913f, 0.536301f, -9.39485f, - -0.124498f, -0.392649f, -10.2759f, 0.047884f, 1.09176f, - -9.61511f, -0.191536f, -0.517148f, -10.0461f, 0.229843f, - 1.5706f, -9.56723f, -0.430956f, -0.584185f, -9.5385f, - 0.287304f, 0.938527f, -9.49062f, -0.47884f, -0.287304f, - -9.56723f, -0.248997f, 0.497994f, -9.50977f, 0.0766145f, - -0.957681f, -9.79707f, -0.191536f, 0.296881f, -9.40442f, - 0.00957681f, -0.0383072f, -9.61511f, 0.0191536f, 0.268151f, - -9.31823f, -0.201113f, -0.344765f, -9.48104f, 0.45011f, - 0.555455f, -9.29908f, -0.746991f, 0.0191536f, -9.03093f, - 0.248997f, 0.612916f, -8.97347f, -0.459687f, 0.459687f, - -9.11712f, -0.277727f, -0.402226f, -9.0022f, 0.191536f, - 0.191536f, -10.6207f, -0.0766145f, 0.641646f, -10.1897f, - -0.00957681f, 0.344765f, -10.0844f, 0.0574608f, 0.201113f, - -10.1131f, -0.124498f, 0.191536f, -9.38527f, -0.153229f, - -0.0191536f, -9.43316f, -0.0574608f, -0.134075f, -9.42358f, - -0.47884f, 0.172383f, -9.27035f, 0.143652f, 0.21069f, - -10.343f, -0.0383072f, -0.373495f, -9.8258f, 0.0861913f, - 0.316035f, -10.1706f, -0.181959f, -0.143652f, -9.74919f, - 0.114922f, 0.258574f, -9.50977f, -0.430956f, 0.0670376f, - -9.29908f, 0.172383f, 0.344765f, -9.86411f, -0.68953f, - 0.0191536f, -10.0748f, 0.737414f, 0.440533f, -9.91199f, - -0.622492f, -0.430956f, -9.86411f, 0.708684f, 0.335188f, - -9.88326f, -0.392649f, 0.153229f, -9.77792f, 0.354342f, - -0.191536f, -9.60554f, 0.0670376f, 0.0670376f, -9.31823f, - -0.277727f, -0.0957681f, -9.55765f, 0.593762f, 0.153229f, - -9.23204f, -0.852336f, -0.201113f, -9.63427f, 0.42138f, - 0.507571f, -9.42358f, -0.603339f, -0.641646f, -9.64384f, - 0.42138f, 0.718261f, -9.47146f, -0.507571f, -0.995988f, - -9.83538f, 0.134075f, 0.603339f, -9.32781f, -0.172383f, - -0.861913f, -9.60554f, 0.181959f, 1.05345f, -9.72046f, - -0.0574608f, -1.21625f, -9.57681f, -0.00957681f, 1.1971f, - -9.69173f, 0.363919f, -1.31202f, -9.29908f, -0.306458f, - 1.37906f, -9.33739f, 0.766145f, -1.41737f, -9.05008f, - -0.0574608f, 1.09176f, -9.07881f, 0.727837f, -0.861913f, - -9.42358f, -0.785298f, 0.632069f, -9.48104f, 1.01514f, - 0.047884f, -9.69173f, -1.04387f, -0.124498f, -8.99262f, - 1.11091f, 0.325611f, -9.70131f, -0.363919f, -0.325611f, - -9.50019f, 0.737414f, 1.31202f, -9.76834f, -0.162806f, - -1.10133f, -9.68215f, 0.296881f, 1.04387f, -9.77792f, - 0.603339f, -0.0957681f, -9.83538f, -0.47884f, 0.909797f, - -10.4387f, 0.0766145f, -0.459687f, -9.9503f, 0.047884f, - 1.38864f, -9.60554f, -0.584185f, 0.459687f, -9.75877f, - 0.536301f, -0.124498f, -9.74919f, -0.172383f, 0.651223f, - -10.4483f, 0.229843f, -0.268151f, -9.50019f, -1.58975f, - 0.622492f, -9.64384f, 1.58975f, -0.114922f, -8.96389f, - -1.69509f, 1.16837f, -8.72447f, 1.71425f, -1.04387f, - -8.91601f, -0.90022f, 1.92494f, -8.84897f, 1.04387f, - -0.833182f, -8.86812f, -0.0574608f, 1.17795f, -8.91601f, - 0.47884f, -1.47483f, -9.22246f, 1.25456f, 1.76213f, - -8.88728f, -1.42694f, -2.36547f, -10.1227f, 2.24097f, - 2.09732f, -9.09797f, -2.35589f, -3.11246f, -9.84496f, - 2.75812f, 2.1069f, -9.26077f, -2.98796f, -2.33674f, - -9.01178f, 0.0766145f, 4.2138f, -8.45632f, 1.02472f, - -3.69665f, -8.51378f, -0.344765f, 3.95522f, -8.90643f, - 2.00155f, -3.78284f, -9.05966f, -0.497994f, 3.50511f, - -9.42358f, 1.86748f, -3.62003f, -9.68215f, -0.488417f, - 3.74453f, -9.48104f, 1.69509f, -3.18908f, -9.93115f, - -0.871489f, 3.54342f, -9.68215f, 2.03986f, -2.8922f, - -9.85453f, -0.861913f, 3.16035f, -9.81623f, 2.08774f, - -2.66235f, -9.95988f, -0.852336f, 2.74854f, -9.59596f, - 1.83875f, -2.15478f, -10.0652f, -0.622492f, 2.28886f, - -9.5385f, 1.46525f, -2.18351f, -9.67257f, -0.632069f, - 2.01113f, -9.43316f, 1.3216f, -1.67594f, -9.42358f, - -0.679953f, 1.05345f, -9.45231f, 1.5706f, -1.23541f, - -9.2895f, -0.459687f, 1.39821f, -9.5385f, 1.46525f, - -1.16837f, -9.58638f, -0.316035f, 1.47483f, -9.54808f, - 1.20668f, -1.26414f, -9.60554f, -0.411803f, 1.39821f, - -9.31823f, 1.14922f, -1.14922f, -9.76834f, -0.354342f, - 1.35991f, -9.52892f, 1.11091f, -1.35991f, -9.81623f, - 0.0574608f, 1.46525f, -9.663f, 0.833182f, -1.1971f, - -9.80665f, 0.21069f, 1.62806f, -9.70131f, 0.641646f, - -1.24498f, -9.9503f, 0.497994f, 1.53229f, -9.88326f, - 0.325611f, -1.05345f, -9.86411f, 0.565032f, 1.58017f, - -9.87369f, 0.220267f, -1.24498f, -9.94073f, 0.268151f, - 1.97282f, -9.91199f, 0.584185f, -1.35033f, -9.25119f, - 0.306458f, 1.13006f, -9.46189f, 0.383072f, -1.11091f, - -8.97347f, -0.0670376f, 1.22583f, -8.98304f, 0.459687f, - -0.488417f, -9.30866f, -0.737414f, 1.23541f, -9.13627f, - 1.00556f, -0.526724f, -10.6781f, -0.775721f, 0.373495f, - -10.5919f, 1.13964f, 0.42138f, -9.54808f, -2.07817f, - 0.68953f, -9.26077f, 1.82917f, -0.105345f, -9.03093f, - -0.976834f, 0.430956f, -9.47146f, 0.995988f, -0.181959f, - -9.86411f, -0.23942f, 0.124498f, -9.73004f, 0.153229f, - 0.871489f, -9.97903f, -0.220267f, 0.162806f, -9.59596f, - 0.153229f, 0.430956f, -9.8258f, -0.114922f, 0.0957681f, - -9.76834f, 0.00957681f, -0.0287304f, -10.1801f, -0.268151f, - 0.258574f, -10.0844f, 0.23942f, 0.0766145f, -10.1131f, - 0.794875f, 0.0f, -9.86411f, -0.593762f, 0.909797f, - -9.29908f, -2.09732f, 1.72383f, -9.17458f, 1.89621f, - -1.58975f, -8.91601f, -2.16436f, 1.94409f, -9.1267f, - 2.03986f, -1.96325f, -9.30866f, -2.42293f, 2.02071f, - -9.43316f, 2.26013f, -1.38864f, -9.8258f, -2.2697f, - 1.16837f, -9.44273f, 2.16436f, -1.09176f, -9.14585f, - -2.03986f, 1.26414f, -9.01178f, 1.82917f, -1.28329f, - -8.89685f, -2.09732f, 1.64721f, -8.95431f, 1.93451f, - -1.69509f, -8.8777f, -2.19309f, 1.28329f, -9.03093f, - 2.11647f, -1.40779f, -9.31823f, -2.2697f, 1.09176f, - -9.11712f, 2.06859f, -1.3216f, -9.2895f, -2.21224f, - 1.4461f, -9.165f, 2.00155f, -1.48441f, -8.98304f, - -2.20267f, 1.46525f, -8.83939f, 2.00155f, -1.24498f, - -9.14585f, -2.26013f, 1.43652f, -9.01178f, 2.1069f, - -1.45567f, -9.1267f, -2.29843f, 1.63763f, -9.04051f, - 2.12605f, -1.76213f, -9.18416f, -2.27928f, 1.9824f, - -9.09797f, 2.07817f, -1.79086f, -9.08839f, -2.00155f, - 1.79086f, -9.44273f, 1.87705f, -1.62806f, -9.14585f, - -2.31759f, 1.84832f, -8.86812f, 2.06859f, 1.61848f, - -9.165f, -2.24097f, 2.05901f, -9.0022f, 2.02071f, - -1.7334f, -9.04051f, -2.1452f, 2.04944f, -9.2895f, - 2.06859f, -1.70467f, -9.20331f, -2.22182f, 2.06859f, - -9.33739f, 2.09732f, -1.76213f, -9.34696f, -2.13563f, - 1.99198f, -9.1267f, 1.9824f, -1.84832f, -8.88728f, - -1.79086f, 1.55144f, -9.03093f, 1.62806f, -1.61848f, - -9.1267f, -1.58975f, 1.47483f, -9.19373f, 1.49398f, - -1.47483f, -8.92558f, -1.48441f, 1.76213f, -8.69574f, - 1.18752f, -1.76213f, -9.24162f, -1.35991f, 1.49398f, - -9.48104f, 1.23541f, -1.61848f, -9.51935f, 1.86748f, - 2.00155f, -8.71489f, -1.24498f, -2.11647f, -5.6982f, - 8.15944f, 1.27372f, -4.52983f, -7.99663f, -0.775721f, - -4.00311f, 8.31267f, 0.632069f, -3.68707f, -8.03494f, - 0.344765f, -2.16436f, 7.79552f, 3.7158f, -1.7334f, - -7.74764f, -4.22337f, -1.56102f, 8.78193f, 4.39575f, - -1.58017f, -8.76278f, -4.5011f, -1.72383f, 9.05008f, - 5.25767f, -1.93451f, -9.11712f, -3.9648f, -0.995988f, - 7.97748f, 5.34386f, -1.33118f, -7.92002f, -4.03184f, - -0.670376f, 9.17458f, 4.3766f, 0.220267f, -9.60554f, - -4.13718f, -0.746991f, 7.33583f, 5.34386f, -1.1971f, - -7.28795f, -5.14275f, 0.871489f, 7.90087f, 5.80354f, - 0.584185f, -8.33182f, -3.04542f, 0.986411f, 7.59441f, - 6.49307f, -0.0670376f, -7.85298f, -5.92804f, 2.07817f, - 8.83939f, 5.4109f, 0.325611f, -9.59596f, -3.83072f, - 0.718261f, 7.38372f, 5.99508f, 0.248997f, -8.29351f, - -5.10444f, 1.72383f, 7.83383f, 5.85143f, 2.12605f, - -9.15543f, -4.03184f, 2.05901f, 7.37414f, 5.79397f, - 2.19309f, -8.49463f, -4.95121f, 2.13563f, 7.91044f, - 4.29999f, 2.1452f, -8.76278f, -2.24097f, 1.31202f, - 8.59997f, 5.72693f, 0.746991f, -9.55765f, -3.54342f, - 1.36948f, 8.5042f, 5.09486f, 1.17795f, -9.62469f, - -4.1276f, 1.77171f, 8.69574f, 5.46836f, 1.63763f, - -9.40442f, -2.32716f, 1.91536f, 7.75721f, 5.25767f, - 2.04944f, -8.81066f, -2.40378f, 0.392649f, 7.73806f, - 5.63116f, 1.45567f, -9.24162f, -1.49398f, -0.258574f, - 6.82826f, 7.34541f, -0.42138f, -9.07881f, -1.30245f, - -0.517148f, 6.97192f, 7.6806f, -0.890643f, -9.58638f, - -4.81713f, -0.21069f, 3.13162f, 9.20331f, -0.967257f, - -10.0748f, 0.181959f, -0.948104f, -5.9855f, 7.4316f, - -1.00556f, -9.5385f, 0.497994f, 0.162806f, -8.47547f, - 4.32872f, 0.248997f, -9.165f, -2.27928f, 0.143652f, - -8.6287f, 4.47237f, 0.354342f, -9.51935f, 0.986411f, -}; - -const size_t kAccelerometerVerticalHingeTestDataLength = - ARRAY_SIZE(kAccelerometerVerticalHingeTestData); - -const float kAccelerometerVerticalHingeUnstableTestData[] = { - 8.5904f, -1.36948f, -3.74453f, 8.72447f, 1.1971f, 4.00311f, - 8.80109f, -3.08373f, 2.27928f, 8.95431f, -1.90578f, -1.10133f, - 8.93516f, -2.03986f, 0.248997f, 9.05008f, 1.53229f, -0.708684f, - -8.78193f, 1.43652f, -2.63362f, -8.66701f, 0.220267f, 2.79643f, - -8.66701f, -2.06859f, 2.42293f, -8.79151f, -2.88262f, -1.16837f, - 8.74362f, -1.9824f, 3.53384f, 9.04051f, 0.0574608f, -1.36948f, - 8.78193f, -4.1276f, 2.58574f, 8.8777f, 0.201113f, -1.80044f, - 8.70532f, -0.296881f, 1.52271f, 9.02135f, -0.871489f, -2.43251f, - -9.09797f, -1.3216f, -3.60088f, -8.97347f, 2.52828f, 2.6432f, - -8.82024f, 1.87705f, 0.354342f, -7.93917f, -4.38618f, 0.258574f, - -8.81066f, 1.91536f, -2.92093f, -8.04452f, -5.4492f, 3.28484f, - -8.86812f, 2.05901f, 0.890643f, -8.01579f, -5.65989f, -2.20267f, - -9.0022f, 2.18351f, -2.9305f, -8.80109f, -4.01268f, 3.055f, - -9.37569f, -1.04387f, 0.277727f, -6.80911f, 2.806f, -6.0717f, - -8.79151f, -8.79151f, -2.11647f, -8.6287f, -1.53229f, 3.58173f, - -8.97347f, -0.335188f, 1.26414f, 8.5042f, 1.51314f, -2.20267f, - -9.19373f, -1.37906f, 1.41737f, -7.67102f, 2.8922f, -5.09486f, - -8.81066f, 0.986411f, 2.30801f, -8.53294f, 3.26569f, -3.11246f, - -9.03093f, 1.06303f, 1.39821f, -8.8777f, -4.47237f, -0.632069f, - -8.74362f, -1.83875f, -0.0957681f, -7.92002f, 1.0343f, -3.84988f, - -8.92558f, 0.440533f, 1.26414f, -8.71489f, -0.153229f, -3.64876f, -}; - -const size_t kAccelerometerVerticalHingeUnstableTestDataLength = - ARRAY_SIZE(kAccelerometerVerticalHingeUnstableTestData); diff --git a/test/motion_angle_tablet.c b/test/motion_angle_tablet.c deleted file mode 100644 index 8eea053405..0000000000 --- a/test/motion_angle_tablet.c +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright 2018 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. - * - * Test motion sense code, when in tablet mode. - */ - -#include <math.h> -#include <stdio.h> - -#include "accelgyro.h" -#include "common.h" -#include "gpio.h" -#include "hooks.h" -#include "motion_common.h" -#include "motion_lid.h" -#include "motion_sense.h" -#include "tablet_mode.h" -#include "test_util.h" -#include "util.h" - - -/*****************************************************************************/ -/* Test utilities */ - -/* convert array value from g to m.s^2. */ -int filler(const struct motion_sensor_t *s, const float v) -{ - return FP_TO_INT( fp_div( - FLOAT_TO_FP(v) * MOTION_SCALING_FACTOR, - fp_mul(INT_TO_FP(s->current_range), MOTION_ONE_G))); -} - -static int test_lid_angle_less180(void) -{ - int index = 0, lid_angle; - struct motion_sensor_t *lid = &motion_sensors[ - CONFIG_LID_ANGLE_SENSOR_LID]; - struct motion_sensor_t *base = &motion_sensors[ - CONFIG_LID_ANGLE_SENSOR_BASE]; - - /* We don't have TASK_CHIP so simulate init ourselves */ - hook_notify(HOOK_CHIPSET_SHUTDOWN); - TEST_ASSERT(sensor_active == SENSOR_ACTIVE_S5); - TEST_ASSERT(lid->drv->get_data_rate(lid) == 0); - - /* Go to S0 state */ - hook_notify(HOOK_CHIPSET_SUSPEND); - hook_notify(HOOK_CHIPSET_RESUME); - msleep(1000); - TEST_ASSERT(sensor_active == SENSOR_ACTIVE_S0); - TEST_ASSERT(lid->drv->get_data_rate(lid) == TEST_LID_FREQUENCY); - - /* Open lid, testing close to 180 degree. */ - gpio_set_level(GPIO_LID_OPEN, 1); - msleep(1000); - - cprints(CC_ACCEL, "start loop"); - /* Force clamshell mode, to be sure we go in tablet mode ASAP. */ - tablet_set_mode(0, TABLET_TRIGGER_LID); - - /* Check we stay in tablet mode, even when hinge is vertical. */ - while (index < kAccelerometerVerticalHingeTestDataLength) { - feed_accel_data(kAccelerometerVerticalHingeTestData, - &index, filler); - wait_for_valid_sample(); - lid_angle = motion_lid_get_angle(); - cprints(CC_ACCEL, "%d : LID(%d, %d, %d)/BASE(%d, %d, %d): %d", - index / TEST_LID_SAMPLE_SIZE, - lid->xyz[X], lid->xyz[Y], lid->xyz[Z], - base->xyz[X], base->xyz[Y], base->xyz[Z], - lid_angle); - /* We need few sample to debounce and enter laptop mode. */ - TEST_ASSERT(index < 2 * TEST_LID_SAMPLE_SIZE * \ - (TABLET_MODE_DEBOUNCE_COUNT + 2) || - tablet_get_mode()); - } - /* - * Check we stay in tablet mode, even when hinge is vertical and - * shaked. - */ - tablet_set_mode(0, TABLET_TRIGGER_LID); - while (index < kAccelerometerVerticalHingeUnstableTestDataLength) { - feed_accel_data(kAccelerometerVerticalHingeUnstableTestData, - &index, filler); - wait_for_valid_sample(); - lid_angle = motion_lid_get_angle(); - cprints(CC_ACCEL, "%d : LID(%d, %d, %d)/BASE(%d, %d, %d): %d", - index / TEST_LID_SAMPLE_SIZE, - lid->xyz[X], lid->xyz[Y], lid->xyz[Z], - base->xyz[X], base->xyz[Y], base->xyz[Z], - lid_angle); - /* We need few sample to debounce and enter laptop mode. */ - TEST_ASSERT(index < TEST_LID_SAMPLE_SIZE * - (TABLET_MODE_DEBOUNCE_COUNT + 2) || - tablet_get_mode()); - } - return EC_SUCCESS; -} - - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_lid_angle_less180); - - test_print_result(); -} diff --git a/test/motion_angle_tablet.tasklist b/test/motion_angle_tablet.tasklist deleted file mode 100644 index 0b774ebb4a..0000000000 --- a/test/motion_angle_tablet.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(MOTIONSENSE, motion_sense_task, NULL, TASK_STACK_SIZE) diff --git a/test/motion_common.c b/test/motion_common.c deleted file mode 100644 index 135da43188..0000000000 --- a/test/motion_common.c +++ /dev/null @@ -1,145 +0,0 @@ -/* Copyright 2018 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. - * - * Common test code to test lid angle calculation. - */ - -#include "accelgyro.h" -#include "driver/accelgyro_bmi_common.h" -#include "host_command.h" -#include "motion_common.h" -#include "motion_sense.h" -#include "task.h" -#include "timer.h" - -/*****************************************************************************/ -/* Mock functions */ -static int accel_init(struct motion_sensor_t *s) -{ - return sensor_init_done(s); -} - -static int accel_read(const struct motion_sensor_t *s, intv3_t v) -{ - rotate(s->xyz, *s->rot_standard_ref, v); - return EC_SUCCESS; -} - -static int accel_set_range(struct motion_sensor_t *s, int range, int rnd) -{ - s->current_range = range; - return EC_SUCCESS; -} - -static int accel_get_resolution(const struct motion_sensor_t *s) -{ -#ifdef TEST_BODY_DETECTION - /* Assume we are using BMI160 */ - return BMI_RESOLUTION; -#endif - return 0; -} - -int test_data_rate[2] = { 0 }; - -static int accel_set_data_rate(const struct motion_sensor_t *s, - const int rate, - const int rnd) -{ - test_data_rate[s - motion_sensors] = rate | (rnd ? ROUND_UP_FLAG : 0); - return EC_SUCCESS; -} - -static int accel_get_data_rate(const struct motion_sensor_t *s) -{ - return test_data_rate[s - motion_sensors]; -} - -#ifdef TEST_BODY_DETECTION -static int accel_get_rms_noise(const struct motion_sensor_t *s) -{ - /* Assume we are using BMI160 */ - fp_t rate = INT_TO_FP(accel_get_data_rate(s) / 1000); - fp_t noise_100hz = INT_TO_FP(BMI160_ACCEL_RMS_NOISE_100HZ); - fp_t sqrt_rate_ratio = fp_sqrtf(fp_div(rate, - INT_TO_FP(BMI_ACCEL_100HZ))); - return FP_TO_INT(fp_mul(noise_100hz, sqrt_rate_ratio)); -} -#endif - -const struct accelgyro_drv test_motion_sense = { - .init = accel_init, - .read = accel_read, - .set_range = accel_set_range, - .get_resolution = accel_get_resolution, - .set_data_rate = accel_set_data_rate, - .get_data_rate = accel_get_data_rate, -#ifdef CONFIG_BODY_DETECTION - .get_rms_noise = accel_get_rms_noise, -#endif -}; - -struct motion_sensor_t motion_sensors[] = { - [BASE] = { - .name = "base", - .active_mask = SENSOR_ACTIVE_S0_S3_S5, - .chip = MOTIONSENSE_CHIP_LSM6DS0, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_BASE, - .drv = &test_motion_sense, - .rot_standard_ref = NULL, - .default_range = 2, /* g, enough for laptop. */ - .config = { - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S0] = { - .odr = TEST_LID_FREQUENCY, - }, - }, - }, - [LID] = { - .name = "lid", - .active_mask = SENSOR_ACTIVE_S0, - .chip = MOTIONSENSE_CHIP_KXCJ9, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_LID, - .drv = &test_motion_sense, - .rot_standard_ref = NULL, - .default_range = 2, /* g, enough for laptop. */ - .config = { - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S0] = { - .odr = TEST_LID_FREQUENCY, - }, - }, - }, -}; -const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); - -/* Read 6 samples from array to sensor vectors, convert units if necessary. */ -void feed_accel_data(const float *array, int *idx, - int (filler)(const struct motion_sensor_t*, const float)) -{ - int i, j; - - for (i = 0; i < motion_sensor_count; i++) { - struct motion_sensor_t *s = &motion_sensors[i]; - - for (j = X; j <= Z; j++) - s->xyz[j] = filler(s, array[*idx + i * 3 + j]); - } - *idx += 6; -} - -void wait_for_valid_sample(void) -{ - uint8_t sample; - uint8_t *lpc_status = host_get_memmap(EC_MEMMAP_ACC_STATUS); - - sample = *lpc_status & EC_MEMMAP_ACC_STATUS_SAMPLE_ID_MASK; - usleep(TEST_LID_EC_RATE); - while ((*lpc_status & EC_MEMMAP_ACC_STATUS_SAMPLE_ID_MASK) == sample) - usleep(TEST_LID_SLEEP_RATE); -} - - diff --git a/test/motion_common.h b/test/motion_common.h deleted file mode 100644 index 45d856d9ef..0000000000 --- a/test/motion_common.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright 2018 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. - * - * Common test code to test lid angle calculation. - */ -#ifndef __CROS_EC_MOTION_COMMON_H -#define __CROS_EC_MOTION_COMMON_H - -#include "motion_sense.h" -/* - * Period in us for the motion task period. - * The task will read the vectors at that interval - */ -#define TEST_LID_EC_RATE (1 * MSEC) -#define TEST_LID_FREQUENCY (1e9 / TEST_LID_EC_RATE) /* mHz */ - -/* - * Time in ms to wait for the task to read the vectors. - */ -#define TEST_LID_SLEEP_RATE (TEST_LID_EC_RATE / 5) - -/* We gather 6 elements [2 vectors of 3 axis] per sample. */ -#define TEST_LID_SAMPLE_SIZE (2 * 3) - -extern enum chipset_state_mask sensor_active; - -extern struct motion_sensor_t motion_sensors[]; -extern const unsigned int motion_sensor_count; - -void wait_for_valid_sample(void); -void feed_accel_data(const float *array, int *idx, - int (filler)(const struct motion_sensor_t *s, const float f)); - -/* - * External data - from - * chromium/src/ash/wm/tablet_mode/tablet_mode_controller_unittest.cc - * - * Test accelerometer data taken with the lid at less than 180 degrees while - * shaking the device around. The data is to be interpreted in groups of 6 where - * each 6 values corresponds to the base accelerometer (-y / g, -x / g, -z / g) - * followed by the lid accelerometer (-y / g , x / g, z / g). - * [ CONFIG_ACCEL_STD_REF_FRAME_OLD must be defined to used this array. ] - */ -extern const float kAccelerometerLaptopModeTestData[]; -extern const size_t kAccelerometerLaptopModeTestDataLength; - -/* - * Test accelerometer data taken with the lid open 360 degrees while - * shaking the device around. The data is to be interpreted in groups of 6 where - * each 6 values corresponds to the base accelerometer (-y / g, -x / g, -z / g) - * followed by the lid accelerometer (-y / g , x / g, z / g). - * [ CONFIG_ACCEL_STD_REF_FRAME_OLD must be defined to used this array. ] - */ -extern const float kAccelerometerFullyOpenTestData[]; -extern const size_t kAccelerometerFullyOpenTestDataLength; - -/* - * Test accelerometer data taken with the lid open 360 degrees while the device - * hinge was nearly vertical, while shaking the device around. The data is to be - * interpreted in groups of 6 where each 6 values corresponds to the X, Y, and Z - * readings from the base and lid accelerometers in this order. - */ -extern const float kAccelerometerVerticalHingeTestData[]; -extern const size_t kAccelerometerVerticalHingeTestDataLength; -extern const float kAccelerometerVerticalHingeUnstableTestData[]; -extern const size_t kAccelerometerVerticalHingeUnstableTestDataLength; -#endif /* __CROS_EC_MOTION_COMMON_H */ diff --git a/test/motion_lid.c b/test/motion_lid.c deleted file mode 100644 index 9935767a68..0000000000 --- a/test/motion_lid.c +++ /dev/null @@ -1,330 +0,0 @@ -/* Copyright 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. - * - * Test motion sense code. - */ - -#include <math.h> -#include <stdio.h> - -#include "accelgyro.h" -#include "common.h" -#include "gpio.h" -#include "hooks.h" -#include "host_command.h" -#include "motion_lid.h" -#include "motion_sense.h" -#include "task.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -extern enum chipset_state_mask sensor_active; -extern int wait_us; - -/* - * Period in us for the motion task period. - * The task will read the vectors at that interval - */ -#define TEST_LID_EC_RATE (10 * MSEC) - -/* - * Time in us to wait for the task to read the vectors. - */ -#define TEST_LID_SLEEP_RATE (TEST_LID_EC_RATE / 5) -#define ONE_G_MEASURED (1 << 14) - -/*****************************************************************************/ -/* Mock functions */ -static int accel_init(struct motion_sensor_t *s) -{ - return EC_SUCCESS; -} - -static int accel_read(const struct motion_sensor_t *s, intv3_t v) -{ - rotate(s->xyz, *s->rot_standard_ref, v); - return EC_SUCCESS; -} - -static int accel_set_range(struct motion_sensor_t *s, - const int range, - const int rnd) -{ - s->current_range = range; - return EC_SUCCESS; -} - -static int accel_get_resolution(const struct motion_sensor_t *s) -{ - return 0; -} - -int test_data_rate[2] = { 0 }; - -static int accel_set_data_rate(const struct motion_sensor_t *s, - const int rate, - const int rnd) -{ - test_data_rate[s - motion_sensors] = rate; - return EC_SUCCESS; -} - -static int accel_get_data_rate(const struct motion_sensor_t *s) -{ - return test_data_rate[s - motion_sensors]; -} - -const struct accelgyro_drv test_motion_sense = { - .init = accel_init, - .read = accel_read, - .set_range = accel_set_range, - .get_resolution = accel_get_resolution, - .set_data_rate = accel_set_data_rate, - .get_data_rate = accel_get_data_rate, -}; - -struct motion_sensor_t motion_sensors[] = { - [BASE] = { - .name = "base", - .active_mask = SENSOR_ACTIVE_S0_S3_S5, - .chip = MOTIONSENSE_CHIP_LSM6DS0, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_BASE, - .drv = &test_motion_sense, - .rot_standard_ref = NULL, - .default_range = MOTION_SCALING_FACTOR / ONE_G_MEASURED, - .config = { - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 119000 | ROUND_UP_FLAG, - .ec_rate = TEST_LID_EC_RATE - }, - /* Used for double tap */ - [SENSOR_CONFIG_EC_S3] = { - .odr = 119000 | ROUND_UP_FLAG, - .ec_rate = TEST_LID_EC_RATE * 100, - }, - }, - }, - [LID] = { - .name = "lid", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_KXCJ9, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_LID, - .drv = &test_motion_sense, - .rot_standard_ref = NULL, - .default_range = MOTION_SCALING_FACTOR / ONE_G_MEASURED, - .config = { - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 119000 | ROUND_UP_FLAG, - .ec_rate = TEST_LID_EC_RATE, - }, - /* Used for double tap */ - [SENSOR_CONFIG_EC_S3] = { - .odr = 200000 | ROUND_UP_FLAG, - .ec_rate = TEST_LID_EC_RATE * 100, - }, - }, - }, -}; -const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); - -/*****************************************************************************/ -/* Test utilities */ -static void wait_for_valid_sample(void) -{ - uint8_t sample; - uint8_t *lpc_status = host_get_memmap(EC_MEMMAP_ACC_STATUS); - - sample = *lpc_status & EC_MEMMAP_ACC_STATUS_SAMPLE_ID_MASK; - usleep(TEST_LID_EC_RATE); - while ((*lpc_status & EC_MEMMAP_ACC_STATUS_SAMPLE_ID_MASK) == sample) - usleep(TEST_LID_SLEEP_RATE); -} - -static int test_lid_angle(void) -{ - - struct motion_sensor_t *base = &motion_sensors[ - CONFIG_LID_ANGLE_SENSOR_BASE]; - struct motion_sensor_t *lid = &motion_sensors[ - CONFIG_LID_ANGLE_SENSOR_LID]; - int lid_angle; - - /* We don't have TASK_CHIP so simulate init ourselves */ - hook_notify(HOOK_CHIPSET_SHUTDOWN); - /* Wait for the sensor task to start */ - msleep(50); - TEST_ASSERT(sensor_active == SENSOR_ACTIVE_S5); - TEST_ASSERT(accel_get_data_rate(lid) == 0); - TEST_ASSERT(base->collection_rate == 0); - TEST_ASSERT(lid->collection_rate == 0); - TEST_ASSERT(wait_us == -1); - - /* Go to S0 state */ - hook_notify(HOOK_CHIPSET_SUSPEND); - hook_notify(HOOK_CHIPSET_RESUME); - msleep(50); - TEST_ASSERT(sensor_active == SENSOR_ACTIVE_S0); - TEST_ASSERT(accel_get_data_rate(lid) == 119000); - TEST_ASSERT(base->collection_rate != 0); - TEST_ASSERT(lid->collection_rate != 0); - TEST_ASSERT(wait_us > 0); - - /* - * Set the base accelerometer as if it were sitting flat on a desk - * and set the lid to closed. - */ - base->xyz[X] = 0; - base->xyz[Y] = 0; - base->xyz[Z] = ONE_G_MEASURED; - lid->xyz[X] = 0; - lid->xyz[Y] = 0; - lid->xyz[Z] = -ONE_G_MEASURED; - gpio_set_level(GPIO_LID_OPEN, 0); - - wait_for_valid_sample(); - lid_angle = motion_lid_get_angle(); - cprints(CC_ACCEL, "LID(%d, %d, %d)/BASE(%d, %d, %d): %d", - lid->xyz[X], lid->xyz[Y], lid->xyz[Z], - base->xyz[X], base->xyz[Y], base->xyz[Z], - lid_angle); - TEST_ASSERT(lid_angle == 0); - - /* Set lid open to 90 degrees. */ - lid->xyz[X] = 0; - lid->xyz[Y] = ONE_G_MEASURED; - lid->xyz[Z] = 0; - gpio_set_level(GPIO_LID_OPEN, 1); - msleep(100); - wait_for_valid_sample(); - - TEST_ASSERT(motion_lid_get_angle() == 90); - - /* Set lid open to 225. */ - lid->xyz[X] = 0; - lid->xyz[Y] = -1 * ONE_G_MEASURED * 0.707106; - lid->xyz[Z] = ONE_G_MEASURED * 0.707106; - wait_for_valid_sample(); - TEST_ASSERT(motion_lid_get_angle() == 225); - - /* Set lid open to 350 */ - lid->xyz[X] = 0; - lid->xyz[Y] = -1 * ONE_G_MEASURED * 0.1736; - lid->xyz[Z] = -1 * ONE_G_MEASURED * 0.9848; - wait_for_valid_sample(); - TEST_ASSERT(motion_lid_get_angle() == 350); - - /* - * Set lid open to 10. Since the lid switch still indicates that it's - * open, we should be getting an unreliable reading. - */ - lid->xyz[X] = 0; - lid->xyz[Y] = ONE_G_MEASURED * 0.1736; - lid->xyz[Z] = -1 * ONE_G_MEASURED * 0.9848; - wait_for_valid_sample(); - TEST_ASSERT(motion_lid_get_angle() == LID_ANGLE_UNRELIABLE); - - /* Rotate back to 180 and then 10 */ - lid->xyz[X] = 0; - lid->xyz[Y] = 0; - lid->xyz[Z] = ONE_G_MEASURED; - wait_for_valid_sample(); - TEST_ASSERT(motion_lid_get_angle() == 180); - - /* - * Again, since the lid isn't closed, the angle should be unreliable. - * See SMALL_LID_ANGLE_RANGE. - */ - lid->xyz[X] = 0; - lid->xyz[Y] = ONE_G_MEASURED * 0.1736; - lid->xyz[Z] = -1 * ONE_G_MEASURED * 0.9848; - wait_for_valid_sample(); - TEST_ASSERT(motion_lid_get_angle() == LID_ANGLE_UNRELIABLE); - - /* - * Align base with hinge and make sure it returns unreliable for angle. - * In this test it doesn't matter what the lid acceleration vector is. - */ - base->xyz[X] = ONE_G_MEASURED; - base->xyz[Y] = 0; - base->xyz[Z] = 0; - wait_for_valid_sample(); - TEST_ASSERT(motion_lid_get_angle() == LID_ANGLE_UNRELIABLE); - - /* - * Use all three axes and set lid to negative base and make sure - * angle is 180. - */ - base->xyz[X] = 5296; - base->xyz[Y] = 7856; - base->xyz[Z] = 13712; - lid->xyz[X] = 5296; - lid->xyz[Y] = 7856; - lid->xyz[Z] = 13712; - wait_for_valid_sample(); - TEST_ASSERT(motion_lid_get_angle() == 180); - - /* - * Close the lid and set the angle to 0. - */ - base->xyz[X] = 0; - base->xyz[Y] = 0; - base->xyz[Z] = ONE_G_MEASURED; - lid->xyz[X] = 0; - lid->xyz[Y] = 0; - lid->xyz[Z] = -1 * ONE_G_MEASURED; - gpio_set_level(GPIO_LID_OPEN, 0); - msleep(100); - wait_for_valid_sample(); - TEST_ASSERT(motion_lid_get_angle() == 0); - - /* - * Make the angle large, but since the lid is closed, the angle should - * be regarded as unreliable. - */ - lid->xyz[X] = 0; - lid->xyz[Y] = -1 * ONE_G_MEASURED * 0.1736; - lid->xyz[Z] = -1 * ONE_G_MEASURED * 0.9848; - wait_for_valid_sample(); - TEST_ASSERT(motion_lid_get_angle() == LID_ANGLE_UNRELIABLE); - - /* - * Open the lid to 350, and then close the lid and set the angle - * to 10. The reading of small angle shouldn't be corrected. - */ - gpio_set_level(GPIO_LID_OPEN, 1); - msleep(100); - gpio_set_level(GPIO_LID_OPEN, 0); - msleep(100); - lid->xyz[X] = 0; - lid->xyz[Y] = ONE_G_MEASURED * 0.1736; - lid->xyz[Z] = -1 * ONE_G_MEASURED * 0.9848; - wait_for_valid_sample(); - TEST_ASSERT(motion_lid_get_angle() == 10); - - hook_notify(HOOK_CHIPSET_SHUTDOWN); - msleep(1000); - TEST_ASSERT(sensor_active == SENSOR_ACTIVE_S5); - /* Base ODR is 0, collection rate is 0. */ - TEST_ASSERT(base->collection_rate == 0); - /* Lid is powered off, collection rate is 0. */ - TEST_ASSERT(lid->collection_rate == 0); - TEST_ASSERT(wait_us == -1); - - return EC_SUCCESS; -} - - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_lid_angle); - - test_print_result(); -} diff --git a/test/motion_lid.tasklist b/test/motion_lid.tasklist deleted file mode 100644 index 0b774ebb4a..0000000000 --- a/test/motion_lid.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(MOTIONSENSE, motion_sense_task, NULL, TASK_STACK_SIZE) diff --git a/test/motion_sense_fifo.c b/test/motion_sense_fifo.c deleted file mode 100644 index b20eb9a36f..0000000000 --- a/test/motion_sense_fifo.c +++ /dev/null @@ -1,382 +0,0 @@ -/* Copyright 2019 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. - * - * Test motion_sense_fifo. - */ - -#include "stdio.h" -#include "motion_sense_fifo.h" -#include "test_util.h" -#include "util.h" -#include "hwtimer.h" -#include "timer.h" -#include "accelgyro.h" -#include <sys/types.h> - -struct motion_sensor_t motion_sensors[] = { - [BASE] = {}, - [LID] = {}, -}; - -const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); - -uint32_t mkbp_last_event_time; - -static struct ec_response_motion_sensor_data data[CONFIG_ACCEL_FIFO_SIZE]; -static uint16_t data_bytes_read; - -static int test_insert_async_event(void) -{ - int read_count; - - motion_sense_fifo_insert_async_event(motion_sensors, ASYNC_EVENT_FLUSH); - motion_sense_fifo_insert_async_event(motion_sensors + 1, - ASYNC_EVENT_ODR); - - read_count = motion_sense_fifo_read( - sizeof(data), CONFIG_ACCEL_FIFO_SIZE, data, &data_bytes_read); - TEST_EQ(read_count, 2, "%d"); - TEST_EQ(data_bytes_read, - (int)(2 * sizeof(struct ec_response_motion_sensor_data)), "%d"); - - TEST_BITS_SET(data[0].flags, ASYNC_EVENT_FLUSH); - TEST_BITS_CLEARED(data[0].flags, MOTIONSENSE_SENSOR_FLAG_ODR); - TEST_EQ(data[0].sensor_num, 0, "%d"); - - TEST_BITS_SET(data[1].flags, ASYNC_EVENT_ODR); - TEST_BITS_CLEARED(data[1].flags, MOTIONSENSE_SENSOR_FLAG_FLUSH); - TEST_EQ(data[1].sensor_num, 1, "%d"); - - return EC_SUCCESS; -} - -static int test_wake_up_needed(void) -{ - data[0].flags = MOTIONSENSE_SENSOR_FLAG_WAKEUP; - - motion_sense_fifo_stage_data(data, motion_sensors, 0, 100); - TEST_EQ(motion_sense_fifo_wake_up_needed(), 0, "%d"); - - motion_sense_fifo_commit_data(); - TEST_EQ(motion_sense_fifo_wake_up_needed(), 1, "%d"); - - return EC_SUCCESS; -} - -static int test_wake_up_needed_overflow(void) -{ - int i; - - data[0].flags = MOTIONSENSE_SENSOR_FLAG_WAKEUP; - motion_sense_fifo_stage_data(data, motion_sensors, 0, 100); - - data[0].flags = 0; - /* - * Using CONFIG_ACCEL_FIFO_SIZE / 2 since 2 entries are inserted per - * 'data': - * - a timestamp - * - the data - */ - for (i = 0; i < (CONFIG_ACCEL_FIFO_SIZE / 2); i++) - motion_sense_fifo_stage_data(data, motion_sensors, 0, 101 + i); - - TEST_EQ(motion_sense_fifo_wake_up_needed(), 1, "%d"); - return EC_SUCCESS; -} - -static int test_adding_timestamp(void) -{ - int read_count; - - motion_sense_fifo_add_timestamp(100); - read_count = motion_sense_fifo_read( - sizeof(data), CONFIG_ACCEL_FIFO_SIZE, data, &data_bytes_read); - - TEST_EQ(read_count, 1, "%d"); - TEST_BITS_SET(data[0].flags, MOTIONSENSE_SENSOR_FLAG_TIMESTAMP); - TEST_EQ(data[0].timestamp, 100, "%u"); - return EC_SUCCESS; -} - -static int test_stage_data_sets_xyz(void) -{ - motion_sensors->oversampling_ratio = 1; - motion_sensors->oversampling = 0; - data->data[0] = 1; - data->data[1] = 2; - data->data[2] = 3; - motion_sense_fifo_stage_data(data, motion_sensors, 3, 100); - - TEST_EQ(motion_sensors->xyz[0], 1, "%d"); - TEST_EQ(motion_sensors->xyz[1], 2, "%d"); - TEST_EQ(motion_sensors->xyz[2], 3, "%d"); - - return EC_SUCCESS; -} - -static int test_stage_data_removed_oversample(void) -{ - int read_count; - - motion_sensors->oversampling_ratio = 2; - motion_sensors->oversampling = 0; - data->data[0] = 1; - data->data[1] = 2; - data->data[2] = 3; - motion_sense_fifo_stage_data(data, motion_sensors, 3, 100); - - data->data[0] = 4; - data->data[1] = 5; - data->data[2] = 6; - motion_sense_fifo_stage_data(data, motion_sensors, 3, 110); - motion_sense_fifo_commit_data(); - - read_count = motion_sense_fifo_read( - sizeof(data), CONFIG_ACCEL_FIFO_SIZE, data, &data_bytes_read); - TEST_EQ(read_count, 3, "%d"); - TEST_BITS_SET(data[0].flags, MOTIONSENSE_SENSOR_FLAG_TIMESTAMP); - TEST_EQ(data[0].timestamp, 100, "%u"); - TEST_BITS_CLEARED(data[1].flags, MOTIONSENSE_SENSOR_FLAG_TIMESTAMP); - TEST_EQ(data[1].data[0], 1, "%d"); - TEST_EQ(data[1].data[1], 2, "%d"); - TEST_EQ(data[1].data[2], 3, "%d"); - TEST_BITS_SET(data[2].flags, MOTIONSENSE_SENSOR_FLAG_TIMESTAMP); - TEST_EQ(data[2].timestamp, 110, "%u"); - - return EC_SUCCESS; -} - -static int test_stage_data_remove_all_oversampling(void) -{ - int read_count; - - motion_sensors->oversampling_ratio = 0; - motion_sensors->oversampling = 0; - data->data[0] = 1; - data->data[1] = 2; - data->data[2] = 3; - motion_sense_fifo_stage_data(data, motion_sensors, 3, 100); - - data->data[0] = 4; - data->data[1] = 5; - data->data[2] = 6; - motion_sense_fifo_stage_data(data, motion_sensors, 3, 110); - motion_sense_fifo_commit_data(); - - read_count = motion_sense_fifo_read( - sizeof(data), CONFIG_ACCEL_FIFO_SIZE, data, &data_bytes_read); - TEST_EQ(read_count, 2, "%d"); - TEST_BITS_SET(data[0].flags, MOTIONSENSE_SENSOR_FLAG_TIMESTAMP); - TEST_EQ(data[0].timestamp, 100, "%u"); - TEST_BITS_SET(data[1].flags, MOTIONSENSE_SENSOR_FLAG_TIMESTAMP); - TEST_EQ(data[1].timestamp, 110, "%u"); - - return EC_SUCCESS; -} - -static int test_stage_data_evicts_data_with_timestamp(void) -{ - int i, read_count; - - /* Fill the fifo */ - motion_sensors->oversampling_ratio = 1; - for (i = 0; i < CONFIG_ACCEL_FIFO_SIZE / 2; i++) - motion_sense_fifo_stage_data(data, motion_sensors, 3, i * 100); - - /* Add a single entry (should evict 2) */ - motion_sense_fifo_add_timestamp(CONFIG_ACCEL_FIFO_SIZE * 100); - read_count = motion_sense_fifo_read( - sizeof(data), CONFIG_ACCEL_FIFO_SIZE, data, &data_bytes_read); - TEST_EQ(read_count, CONFIG_ACCEL_FIFO_SIZE - 1, "%d"); - TEST_BITS_SET(data->flags, MOTIONSENSE_SENSOR_FLAG_TIMESTAMP); - TEST_EQ(data->timestamp, 100, "%u"); - TEST_BITS_SET(data[CONFIG_ACCEL_FIFO_SIZE - 2].flags, - MOTIONSENSE_SENSOR_FLAG_TIMESTAMP); - TEST_EQ(data[CONFIG_ACCEL_FIFO_SIZE - 2].timestamp, - CONFIG_ACCEL_FIFO_SIZE * 100, "%u"); - - return EC_SUCCESS; -} - -static int test_add_data_no_spreading_when_different_sensors(void) -{ - int read_count; - uint32_t now = __hw_clock_source_read(); - - motion_sensors[0].oversampling_ratio = 1; - motion_sensors[1].oversampling_ratio = 1; - - motion_sense_fifo_stage_data(data, motion_sensors, 3, now); - motion_sense_fifo_stage_data(data, motion_sensors + 1, 3, now); - motion_sense_fifo_commit_data(); - - read_count = motion_sense_fifo_read( - sizeof(data), CONFIG_ACCEL_FIFO_SIZE, data, &data_bytes_read); - TEST_EQ(read_count, 4, "%d"); - TEST_BITS_SET(data[0].flags, MOTIONSENSE_SENSOR_FLAG_TIMESTAMP); - TEST_EQ(data[0].timestamp, now, "%u"); - TEST_BITS_SET(data[2].flags, MOTIONSENSE_SENSOR_FLAG_TIMESTAMP); - TEST_EQ(data[2].timestamp, now, "%u"); - - return EC_SUCCESS; -} - -static int test_add_data_no_spreading_different_timestamps(void) -{ - int read_count; - - motion_sensors[0].oversampling_ratio = 1; - - motion_sense_fifo_stage_data(data, motion_sensors, 3, 100); - motion_sense_fifo_stage_data(data, motion_sensors, 3, 120); - motion_sense_fifo_commit_data(); - - read_count = motion_sense_fifo_read( - sizeof(data), CONFIG_ACCEL_FIFO_SIZE, data, &data_bytes_read); - TEST_EQ(read_count, 4, "%d"); - TEST_BITS_SET(data[0].flags, MOTIONSENSE_SENSOR_FLAG_TIMESTAMP); - TEST_EQ(data[0].timestamp, 100, "%u"); - TEST_BITS_SET(data[2].flags, MOTIONSENSE_SENSOR_FLAG_TIMESTAMP); - TEST_EQ(data[2].timestamp, 120, "%u"); - - return EC_SUCCESS; -} - -static int test_spread_data_in_window(void) -{ - uint32_t now; - int read_count; - - motion_sensors[0].oversampling_ratio = 1; - motion_sensors[0].collection_rate = 20; /* us */ - now = __hw_clock_source_read(); - - motion_sense_fifo_stage_data(data, motion_sensors, 3, now - 18); - motion_sense_fifo_stage_data(data, motion_sensors, 3, now - 18); - motion_sense_fifo_commit_data(); - read_count = motion_sense_fifo_read( - sizeof(data), CONFIG_ACCEL_FIFO_SIZE, data, &data_bytes_read); - TEST_EQ(read_count, 4, "%d"); - TEST_BITS_SET(data[0].flags, MOTIONSENSE_SENSOR_FLAG_TIMESTAMP); - TEST_EQ(data[0].timestamp, now - 18, "%u"); - TEST_BITS_SET(data[2].flags, MOTIONSENSE_SENSOR_FLAG_TIMESTAMP); - /* TODO(b/142892004): mock __hw_clock_source_read so we can check for - * exact TS. - */ - TEST_NEAR(data[2].timestamp, now, 2, "%u"); - - return EC_SUCCESS; -} - -static int test_spread_data_by_collection_rate(void) -{ - const uint32_t now = __hw_clock_source_read(); - int read_count; - - motion_sensors[0].oversampling_ratio = 1; - motion_sensors[0].collection_rate = 20; /* us */ - motion_sense_fifo_stage_data(data, motion_sensors, 3, now - 25); - motion_sense_fifo_stage_data(data, motion_sensors, 3, now - 25); - motion_sense_fifo_commit_data(); - read_count = motion_sense_fifo_read( - sizeof(data), CONFIG_ACCEL_FIFO_SIZE, data, &data_bytes_read); - TEST_EQ(read_count, 4, "%d"); - TEST_BITS_SET(data[0].flags, MOTIONSENSE_SENSOR_FLAG_TIMESTAMP); - TEST_EQ(data[0].timestamp, now - 25, "%u"); - TEST_BITS_SET(data[2].flags, MOTIONSENSE_SENSOR_FLAG_TIMESTAMP); - TEST_EQ(data[2].timestamp, now - 5, "%u"); - - return EC_SUCCESS; -} - -static int test_spread_double_commit_same_timestamp(void) -{ - const uint32_t now = __hw_clock_source_read(); - int read_count; - - /* - * Stage and commit the same sample. This is not expected to happen - * since batches of sensor samples should be staged together and only - * commit once. We assume that the driver did this on purpose and will - * allow the same timestamp to be sent. - */ - motion_sensors[0].oversampling_ratio = 1; - motion_sensors[0].collection_rate = 20; /* us */ - motion_sense_fifo_stage_data(data, motion_sensors, 3, now - 25); - motion_sense_fifo_commit_data(); - motion_sense_fifo_stage_data(data, motion_sensors, 3, now - 25); - motion_sense_fifo_commit_data(); - - read_count = motion_sense_fifo_read( - sizeof(data), CONFIG_ACCEL_FIFO_SIZE, data, &data_bytes_read); - TEST_EQ(read_count, 4, "%d"); - TEST_BITS_SET(data[0].flags, MOTIONSENSE_SENSOR_FLAG_TIMESTAMP); - TEST_EQ(data[0].timestamp, now - 25, "%u"); - TEST_BITS_SET(data[2].flags, MOTIONSENSE_SENSOR_FLAG_TIMESTAMP); - TEST_EQ(data[2].timestamp, now - 25, "%u"); - - return EC_SUCCESS; -} - -static int test_commit_non_data_or_timestamp_entries(void) -{ - const uint32_t now = __hw_clock_source_read(); - int read_count; - - motion_sensors[0].oversampling_ratio = 1; - motion_sensors[0].collection_rate = 20; /* us */ - - /* Insert non-data entry */ - data[0].flags = MOTIONSENSE_SENSOR_FLAG_ODR; - motion_sense_fifo_stage_data(data, motion_sensors, 3, now - 25); - - /* Insert data entry */ - data[0].flags = 0; - motion_sense_fifo_stage_data(data, motion_sensors, 3, now - 25); - - motion_sense_fifo_commit_data(); - read_count = motion_sense_fifo_read( - sizeof(data), CONFIG_ACCEL_FIFO_SIZE, data, &data_bytes_read); - TEST_EQ(read_count, 4, "%d"); - TEST_BITS_SET(data[0].flags, MOTIONSENSE_SENSOR_FLAG_TIMESTAMP); - TEST_EQ(data[0].timestamp, now - 25, "%u"); - TEST_BITS_SET(data[1].flags, MOTIONSENSE_SENSOR_FLAG_ODR); - TEST_BITS_SET(data[2].flags, MOTIONSENSE_SENSOR_FLAG_TIMESTAMP); - TEST_EQ(data[2].timestamp, now - 25, "%u"); - - return EC_SUCCESS; -} - -void before_test(void) -{ - motion_sense_fifo_commit_data(); - motion_sense_fifo_read(sizeof(data), CONFIG_ACCEL_FIFO_SIZE, &data, - &data_bytes_read); - motion_sense_fifo_reset_needed_flags(); - memset(data, 0, sizeof(data)); - motion_sense_fifo_reset(); -} - -void run_test(int argc, char **argv) -{ - test_reset(); - motion_sense_fifo_init(); - - RUN_TEST(test_insert_async_event); - RUN_TEST(test_wake_up_needed); - RUN_TEST(test_wake_up_needed_overflow); - RUN_TEST(test_adding_timestamp); - RUN_TEST(test_stage_data_sets_xyz); - RUN_TEST(test_stage_data_removed_oversample); - RUN_TEST(test_stage_data_remove_all_oversampling); - RUN_TEST(test_stage_data_evicts_data_with_timestamp); - RUN_TEST(test_add_data_no_spreading_when_different_sensors); - RUN_TEST(test_add_data_no_spreading_different_timestamps); - RUN_TEST(test_spread_data_in_window); - RUN_TEST(test_spread_data_by_collection_rate); - RUN_TEST(test_spread_double_commit_same_timestamp); - RUN_TEST(test_commit_non_data_or_timestamp_entries); - - test_print_result(); -} diff --git a/test/motion_sense_fifo.tasklist b/test/motion_sense_fifo.tasklist deleted file mode 100644 index 0e3696c3f0..0000000000 --- a/test/motion_sense_fifo.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(MOTIONSENSE, motion_sense_task, NULL, TASK_STACK_SIZE) diff --git a/test/mpu.c b/test/mpu.c deleted file mode 100644 index 25b2c58903..0000000000 --- a/test/mpu.c +++ /dev/null @@ -1,222 +0,0 @@ -/* Copyright 2020 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 <stdbool.h> -#include "mpu.h" -#include "mpu_private.h" -#include "string.h" -#include "system.h" -#include "test_util.h" - -struct mpu_info { - bool has_mpu; - int num_mpu_regions; - bool mpu_is_unified; -}; - -#if defined(CHIP_VARIANT_STM32F412) -struct mpu_info mpu_info = { - .has_mpu = true, - .num_mpu_regions = 8, - .mpu_is_unified = true -}; - -struct mpu_rw_regions expected_rw_regions = { .num_regions = 2, - .addr = { 0x08060000, - 0x08080000 }, - .size = { 0x20000, 0x80000 } }; -#elif defined(CHIP_VARIANT_STM32H7X3) -struct mpu_info mpu_info = { - .has_mpu = true, - .num_mpu_regions = 16, - .mpu_is_unified = true -}; - -struct mpu_rw_regions expected_rw_regions = { .num_regions = 1, - .addr = { 0x08100000, - 0x08200000 }, - .size = { 0x100000, 0 } }; -#else -#error "MPU info not defined for this chip. Please add it." -#endif - -test_static int test_mpu_info(void) -{ - TEST_EQ(mpu_num_regions(), mpu_info.num_mpu_regions, "%d"); - TEST_EQ(has_mpu(), mpu_info.has_mpu, "%d"); - TEST_EQ(mpu_is_unified(), mpu_info.mpu_is_unified, "%d"); - return EC_SUCCESS; -} - -test_static int reset_mpu(void) -{ - int i; - - mpu_disable(); - - for (i = 0; i < mpu_info.num_mpu_regions; ++i) { - /* - * Disable all regions. - * - * We use the smallest possible size (32 bytes), but it - * doesn't really matter since the regions are disabled. - */ - TEST_EQ(mpu_config_region(i, 0, 32, 0, 0), EC_SUCCESS, "%d"); - } - - mpu_enable(); - - return EC_SUCCESS; -} - -test_static int test_mpu_update_region_valid_region(void) -{ - volatile char data __maybe_unused; - - char * const ram_base = (char * const)CONFIG_RAM_BASE; - const uint8_t size_bit = 5; - uint16_t mpu_attr = MPU_ATTR_NO_NO; - - /* - * Initial read should work. MPU is not protecting the given address. - */ - data = ram_base[0]; - - TEST_EQ(mpu_update_region(0, (uint32_t)ram_base, size_bit, mpu_attr, 1, - 0), - EC_SUCCESS, "%d"); - - /* This panics with a data violation at CONFIG_RAM_BASE: - * - * Data access violation, mfar = <CONFIG_RAM_BASE> - */ - data = ram_base[0]; - - return EC_SUCCESS; -} - -test_static int test_mpu_update_region_invalid_region(void) -{ - /* Test invalid region */ - TEST_EQ(mpu_update_region(mpu_info.num_mpu_regions, 0x8020000, 17, - 0x1000, 1, 0), - -EC_ERROR_INVAL, "%d"); - return EC_SUCCESS; -} - -test_static int test_mpu_update_region_invalid_alignment(void) -{ - /* - * Test size that is not aligned to address. - */ - const uint32_t addr = 0x20000; - const uint32_t size = 0x40000; - const uint32_t size_bit = 18; - - TEST_EQ(size, BIT(size_bit), "%d"); - TEST_EQ(reset_mpu(), EC_SUCCESS, "%d"); - TEST_EQ(mpu_update_region(0, addr, size_bit, 0, 1, 0), -EC_ERROR_INVAL, - "%d"); - - return EC_SUCCESS; -} - -test_static int test_mpu_lock_ro_flash(void) -{ - int rv; - - rv = mpu_lock_ro_flash(); - TEST_EQ(rv, EC_SUCCESS, "%d"); - - return EC_SUCCESS; -} - -test_static int test_mpu_lock_rw_flash(void) -{ - int rv; - - rv = mpu_lock_rw_flash(); - TEST_EQ(rv, EC_SUCCESS, "%d"); - - return EC_SUCCESS; -} - -test_static int test_mpu_protect_data_ram(void) -{ - int rv; - - rv = mpu_protect_data_ram(); - TEST_EQ(rv, EC_SUCCESS, "%d"); - - return EC_SUCCESS; -} - -test_static int test_mpu_protect_code_ram(void) -{ - if (IS_ENABLED(CONFIG_EXTERNAL_STORAGE) || - !IS_ENABLED(CONFIG_FLASH_PHYSICAL)) { - int rv; - - rv = mpu_protect_code_ram(); - TEST_EQ(rv, EC_SUCCESS, "%d"); - } - - return EC_SUCCESS; -} - -test_static int test_mpu_get_rw_regions(void) -{ - struct mpu_rw_regions rw_regions = mpu_get_rw_regions(); - int rv = memcmp(&rw_regions, &expected_rw_regions, - sizeof(expected_rw_regions)); - - TEST_EQ(rv, 0, "%d"); - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - enum ec_image cur_image = system_get_image_copy(); - - ccprintf("Running MPU test\n"); - - RUN_TEST(reset_mpu); - RUN_TEST(test_mpu_info); - - /* - * TODO(b/151105339): For all locked regions, check that we cannot - * read/write/execute (depending on the configuration). - */ - - /* - * Since locking prevents code execution, we can only lock the region - * that is not running or the test will hang. - */ - if (cur_image == EC_IMAGE_RW) { - RUN_TEST(reset_mpu); - RUN_TEST(test_mpu_lock_ro_flash); - } - - if (cur_image == EC_IMAGE_RO) { - RUN_TEST(reset_mpu); - RUN_TEST(test_mpu_lock_rw_flash); - } - - RUN_TEST(reset_mpu); - RUN_TEST(test_mpu_update_region_invalid_region); - RUN_TEST(reset_mpu); - RUN_TEST(test_mpu_update_region_invalid_alignment); - RUN_TEST(reset_mpu); - RUN_TEST(test_mpu_protect_code_ram); - RUN_TEST(reset_mpu); - RUN_TEST(test_mpu_protect_data_ram); - RUN_TEST(reset_mpu); - RUN_TEST(test_mpu_get_rw_regions); - RUN_TEST(reset_mpu); - /* This test must be last because it generates a panic */ - RUN_TEST(test_mpu_update_region_valid_region); - RUN_TEST(reset_mpu); - test_print_result(); -} diff --git a/test/mpu.tasklist b/test/mpu.tasklist deleted file mode 100644 index 51734f058d..0000000000 --- a/test/mpu.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2020 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* no tasks */ diff --git a/test/mutex.c b/test/mutex.c deleted file mode 100644 index 4fbf7d5cae..0000000000 --- a/test/mutex.c +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright 2011 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. - * Copyright 2011 Google Inc. - * - * Tasks for mutexes basic tests. - */ - -#include "console.h" -#include "common.h" -#include "task.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -static struct mutex mtx; - -/* period between 50us and 3.2ms */ -#define PERIOD_US(num) (((num % 64) + 1) * 50) -/* one of the 3 MTX3x tasks */ -#define RANDOM_TASK(num) (TASK_ID_MTX3C + (num % 3)) - -int mutex_random_task(void *unused) -{ - char letter = 'A'+(TASK_ID_MTX3A - task_get_current()); - /* wait to be activated */ - - while (1) { - task_wait_event(0); - ccprintf("%c+\n", letter); - mutex_lock(&mtx); - ccprintf("%c=\n", letter); - task_wait_event(0); - ccprintf("%c-\n", letter); - mutex_unlock(&mtx); - } - - task_wait_event(0); - - return EC_SUCCESS; -} - -int mutex_second_task(void *unused) -{ - task_id_t id = task_get_current(); - - ccprintf("\n[Mutex second task %d]\n", id); - - task_wait_event(0); - ccprintf("MTX2: locking..."); - mutex_lock(&mtx); - ccprintf("done\n"); - task_wake(TASK_ID_MTX1); - ccprintf("MTX2: unlocking...\n"); - mutex_unlock(&mtx); - - task_wait_event(0); - - return EC_SUCCESS; -} - -int mutex_main_task(void *unused) -{ - task_id_t id = task_get_current(); - uint32_t rdelay = (uint32_t)0x0bad1dea; - uint32_t rtask = (uint32_t)0x1a4e1dea; - int i; - - ccprintf("\n[Mutex main task %d]\n", id); - - task_wait_event(0); - - /* --- Lock/Unlock without contention --- */ - ccprintf("No contention :"); - mutex_lock(&mtx); - mutex_unlock(&mtx); - mutex_lock(&mtx); - mutex_unlock(&mtx); - mutex_lock(&mtx); - mutex_unlock(&mtx); - ccprintf("done.\n"); - - /* --- Serialization to test simple contention --- */ - ccprintf("Simple contention :\n"); - /* lock the mutex from the other task */ - task_set_event(TASK_ID_MTX2, TASK_EVENT_WAKE); - task_wait_event(0); - /* block on the mutex */ - ccprintf("MTX1: blocking...\n"); - mutex_lock(&mtx); - ccprintf("MTX1: get lock\n"); - mutex_unlock(&mtx); - - /* --- mass lock-unlocking from several tasks --- */ - ccprintf("Massive locking/unlocking :\n"); - for (i = 0; i < 500; i++) { - /* Wake up a random task */ - task_wake(RANDOM_TASK(rtask)); - /* next pseudo random delay */ - rtask = prng(rtask); - /* Wait for a "random" period */ - task_wait_event(PERIOD_US(rdelay)); - /* next pseudo random delay */ - rdelay = prng(rdelay); - } - - test_pass(); - task_wait_event(0); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - wait_for_task_started(); - task_wake(TASK_ID_MTX1); -} diff --git a/test/mutex.tasklist b/test/mutex.tasklist deleted file mode 100644 index 8e3d08ddc2..0000000000 --- a/test/mutex.tasklist +++ /dev/null @@ -1,14 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(MTX3C, mutex_random_task, NULL, 384) \ - TASK_TEST(MTX3B, mutex_random_task, NULL, 384) \ - TASK_TEST(MTX3A, mutex_random_task, NULL, 384) \ - TASK_TEST(MTX2, mutex_second_task, NULL, 384) \ - TASK_TEST(MTX1, mutex_main_task, NULL, 384) diff --git a/test/newton_fit.c b/test/newton_fit.c deleted file mode 100644 index 9648fbfd9a..0000000000 --- a/test/newton_fit.c +++ /dev/null @@ -1,140 +0,0 @@ -/* Copyright 2020 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 "common.h" -#include "newton_fit.h" -#include "motion_sense.h" -#include "test_util.h" -#include <stdio.h> - -/* - * Need to define motion sensor globals just to compile. - * We include motion task to force the inclusion of math_util.c - */ -struct motion_sensor_t motion_sensors[] = {}; -const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); - -#define ACC(FIT, X, Y, Z, EXPECTED) \ - TEST_EQ(newton_fit_accumulate(FIT, X, Y, Z), EXPECTED, "%d") - -static int test_newton_fit_reset(void) -{ - struct newton_fit fit = NEWTON_FIT(4, 15, 0.01f, 0.25f, 1.0e-8f, 100); - - newton_fit_reset(&fit); - newton_fit_accumulate(&fit, 1.0f, 0.0f, 0.0f); - TEST_EQ(queue_count(fit.orientations), (size_t)1, "%zu"); - newton_fit_reset(&fit); - - TEST_EQ(queue_count(fit.orientations), (size_t)0, "%zu"); - - return EC_SUCCESS; -} - -static int test_newton_fit_accumulate(void) -{ - struct newton_fit fit = NEWTON_FIT(4, 15, 0.01f, 0.25f, 1.0e-8f, 100); - struct queue_iterator it; - - newton_fit_reset(&fit); - newton_fit_accumulate(&fit, 1.0f, 0.0f, 0.0f); - - TEST_EQ(queue_count(fit.orientations), (size_t)1, "%zu"); - queue_begin(fit.orientations, &it); - TEST_EQ(((struct newton_fit_orientation *)it.ptr)->nsamples, 1, "%u"); - - return EC_SUCCESS; -} - -static int test_newton_fit_accumulate_merge(void) -{ - struct newton_fit fit = NEWTON_FIT(4, 15, 0.01f, 0.25f, 1.0e-8f, 100); - struct queue_iterator it; - - newton_fit_reset(&fit); - newton_fit_accumulate(&fit, 1.0f, 0.0f, 0.0f); - newton_fit_accumulate(&fit, 1.05f, 0.0f, 0.0f); - - TEST_EQ(queue_count(fit.orientations), (size_t)1, "%zu"); - queue_begin(fit.orientations, &it); - TEST_EQ(((struct newton_fit_orientation *)it.ptr)->nsamples, 2, "%u"); - - return EC_SUCCESS; -} - -static int test_newton_fit_accumulate_prune(void) -{ - struct newton_fit fit = NEWTON_FIT(4, 15, 0.01f, 0.25f, 1.0e-8f, 100); - struct queue_iterator it; - - newton_fit_reset(&fit); - newton_fit_accumulate(&fit, 1.0f, 0.0f, 0.0f); - newton_fit_accumulate(&fit, -1.0f, 0.0f, 0.0f); - newton_fit_accumulate(&fit, 0.0f, 1.0f, 0.0f); - newton_fit_accumulate(&fit, 0.0f, -1.0f, 0.0f); - - TEST_EQ(queue_is_full(fit.orientations), 1, "%d"); - queue_begin(fit.orientations, &it); - TEST_EQ(((struct newton_fit_orientation *)it.ptr)->nsamples, 1, "%u"); - queue_next(fit.orientations, &it); - TEST_EQ(((struct newton_fit_orientation *)it.ptr)->nsamples, 1, "%u"); - queue_next(fit.orientations, &it); - TEST_EQ(((struct newton_fit_orientation *)it.ptr)->nsamples, 1, "%u"); - queue_next(fit.orientations, &it); - TEST_EQ(((struct newton_fit_orientation *)it.ptr)->nsamples, 1, "%u"); - - newton_fit_accumulate(&fit, 0.0f, 0.0f, 1.0f); - TEST_EQ(queue_is_full(fit.orientations), 0, "%d"); - - return EC_SUCCESS; -} - -static int test_newton_fit_calculate(void) -{ - struct newton_fit fit = NEWTON_FIT(4, 3, 0.01f, 0.25f, 1.0e-8f, 100); - floatv3_t bias; - float radius; - - newton_fit_reset(&fit); - - ACC(&fit, 1.01f, 0.01f, 0.01f, false); - ACC(&fit, 1.01f, 0.01f, 0.01f, false); - ACC(&fit, 1.01f, 0.01f, 0.01f, false); - - ACC(&fit, -0.99f, 0.01f, 0.01f, false); - ACC(&fit, -0.99f, 0.01f, 0.01f, false); - ACC(&fit, -0.99f, 0.01f, 0.01f, false); - - ACC(&fit, 0.01f, 1.01f, 0.01f, false); - ACC(&fit, 0.01f, 1.01f, 0.01f, false); - ACC(&fit, 0.01f, 1.01f, 0.01f, false); - - ACC(&fit, 0.01f, 0.01f, 1.01f, false); - ACC(&fit, 0.01f, 0.01f, 1.01f, false); - ACC(&fit, 0.01f, 0.01f, 1.01f, true); - - fpv3_init(bias, 0.0f, 0.0f, 0.0f); - newton_fit_compute(&fit, bias, &radius); - - TEST_NEAR(bias[0], 0.01f, 0.0001f, "%f"); - TEST_NEAR(bias[1], 0.01f, 0.0001f, "%f"); - TEST_NEAR(bias[2], 0.01f, 0.0001f, "%f"); - TEST_NEAR(radius, 1.0f, 0.0001f, "%f"); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_newton_fit_reset); - RUN_TEST(test_newton_fit_accumulate); - RUN_TEST(test_newton_fit_accumulate_merge); - RUN_TEST(test_newton_fit_accumulate_prune); - RUN_TEST(test_newton_fit_calculate); - - test_print_result(); -} diff --git a/test/newton_fit.tasklist b/test/newton_fit.tasklist deleted file mode 100644 index 5ffe662d01..0000000000 --- a/test/newton_fit.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/online_calibration.c b/test/online_calibration.c deleted file mode 100644 index 1b3abf51bc..0000000000 --- a/test/online_calibration.c +++ /dev/null @@ -1,245 +0,0 @@ -/* Copyright 2020 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 "accel_cal.h" -#include "accelgyro.h" -#include "hwtimer.h" -#include "mag_cal.h" -#include "online_calibration.h" -#include "test_util.h" -#include "timer.h" -#include <stdio.h> - -int mkbp_send_event(uint8_t event_type) -{ - return 1; -} - -struct mock_read_temp_result { - void *s; - int temp; - int ret; - int used_count; - struct mock_read_temp_result *next; -}; - -static struct mock_read_temp_result *mock_read_temp_results; - -static int mock_read_temp(const struct motion_sensor_t *s, int *temp) -{ - struct mock_read_temp_result *ptr = mock_read_temp_results; - - while (ptr) { - if (ptr->s == s) { - if (ptr->ret == EC_SUCCESS) - *temp = ptr->temp; - ptr->used_count++; - return ptr->ret; - } - ptr = ptr->next; - } - - return EC_ERROR_UNKNOWN; -} - -static struct accelgyro_drv mock_sensor_driver = { - .read_temp = mock_read_temp, -}; - -static struct accel_cal_algo base_accel_cal_algos[] = { - { - .newton_fit = NEWTON_FIT(4, 15, FLOAT_TO_FP(0.01f), - FLOAT_TO_FP(0.25f), - FLOAT_TO_FP(1.0e-8f), 100), - } -}; - -static struct accel_cal base_accel_cal_data = { - .still_det = STILL_DET(FLOAT_TO_FP(0.00025f), 800 * MSEC, 1200 * MSEC, - 5), - .algos = base_accel_cal_algos, - .num_temp_windows = ARRAY_SIZE(base_accel_cal_algos), -}; - -static struct mag_cal_t lid_mag_cal_data; - -static bool next_accel_cal_accumulate_result; -static fpv3_t next_accel_cal_bias; - -bool accel_cal_accumulate( - struct accel_cal *cal, uint32_t sample_time, fp_t x, fp_t y, fp_t z, - fp_t temp) -{ - if (next_accel_cal_accumulate_result) { - cal->bias[X] = next_accel_cal_bias[X]; - cal->bias[Y] = next_accel_cal_bias[Y]; - cal->bias[Z] = next_accel_cal_bias[Z]; - } - return next_accel_cal_accumulate_result; -} - -struct motion_sensor_t motion_sensors[] = { - [BASE] = { - .type = MOTIONSENSE_TYPE_ACCEL, - .default_range = 4, - .drv = &mock_sensor_driver, - .online_calib_data[0] = { - .type_specific_data = &base_accel_cal_data, - }, - }, - [LID] = { - .type = MOTIONSENSE_TYPE_MAG, - .default_range = 4, - .drv = &mock_sensor_driver, - .online_calib_data[0] = { - .type_specific_data = &lid_mag_cal_data, - } - }, -}; - -const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); - -static int test_read_temp_on_stage(void) -{ - struct mock_read_temp_result expected = { &motion_sensors[BASE], 200, - EC_SUCCESS, 0, NULL }; - struct ec_response_motion_sensor_data data; - int rc; - - mock_read_temp_results = &expected; - data.sensor_num = BASE; - rc = online_calibration_process_data( - &data, &motion_sensors[0], __hw_clock_source_read()); - - TEST_EQ(rc, EC_SUCCESS, "%d"); - TEST_EQ(expected.used_count, 1, "%d"); - - return EC_SUCCESS; -} - -static int test_read_temp_from_cache_on_stage(void) -{ - struct mock_read_temp_result expected = { &motion_sensors[BASE], 200, - EC_SUCCESS, 0, NULL }; - struct ec_response_motion_sensor_data data; - int rc; - - mock_read_temp_results = &expected; - data.sensor_num = BASE; - rc = online_calibration_process_data( - &data, &motion_sensors[0], __hw_clock_source_read()); - TEST_EQ(rc, EC_SUCCESS, "%d"); - - rc = online_calibration_process_data( - &data, &motion_sensors[0], __hw_clock_source_read()); - TEST_EQ(rc, EC_SUCCESS, "%d"); - - TEST_EQ(expected.used_count, 1, "%d"); - - return EC_SUCCESS; -} - -static int test_read_temp_twice_after_cache_stale(void) -{ - struct mock_read_temp_result expected = { &motion_sensors[BASE], 200, - EC_SUCCESS, 0, NULL }; - struct ec_response_motion_sensor_data data; - int rc; - - mock_read_temp_results = &expected; - data.sensor_num = BASE; - rc = online_calibration_process_data( - &data, &motion_sensors[0], __hw_clock_source_read()); - TEST_EQ(rc, EC_SUCCESS, "%d"); - - sleep(2); - rc = online_calibration_process_data( - &data, &motion_sensors[0], __hw_clock_source_read()); - TEST_EQ(rc, EC_SUCCESS, "%d"); - - TEST_EQ(expected.used_count, 2, "%d"); - - return EC_SUCCESS; -} - -static int test_new_calibration_value(void) -{ - struct mock_read_temp_result expected = { &motion_sensors[BASE], 200, - EC_SUCCESS, 0, NULL }; - struct ec_response_motion_sensor_data data; - struct ec_response_online_calibration_data cal_data; - int rc; - - mock_read_temp_results = &expected; - next_accel_cal_accumulate_result = false; - data.sensor_num = BASE; - - rc = online_calibration_process_data( - &data, &motion_sensors[BASE], __hw_clock_source_read()); - TEST_EQ(rc, EC_SUCCESS, "%d"); - TEST_EQ(online_calibration_has_new_values(), false, "%d"); - - next_accel_cal_accumulate_result = true; - next_accel_cal_bias[X] = 0.01f; /* expect: 81 */ - next_accel_cal_bias[Y] = -0.02f; /* expect: -163 */ - next_accel_cal_bias[Z] = 0; /* expect: 0 */ - rc = online_calibration_process_data( - &data, &motion_sensors[BASE], __hw_clock_source_read()); - TEST_EQ(rc, EC_SUCCESS, "%d"); - TEST_EQ(online_calibration_has_new_values(), true, "%d"); - - rc = online_calibration_read(&motion_sensors[BASE], &cal_data); - TEST_EQ(rc, true, "%d"); - TEST_EQ(cal_data.data[X], 81, "%d"); - TEST_EQ(cal_data.data[Y], -163, "%d"); - TEST_EQ(cal_data.data[Z], 0, "%d"); - - TEST_EQ(online_calibration_has_new_values(), false, "%d"); - - return EC_SUCCESS; -} - -int test_mag_reading_updated_cal(void) -{ - struct mag_cal_t expected_results; - struct ec_response_motion_sensor_data data; - int rc; - int test_values[] = { 207, -17, -37 }; - - data.sensor_num = LID; - data.data[X] = test_values[X]; - data.data[Y] = test_values[Y]; - data.data[Z] = test_values[Z]; - - init_mag_cal(&expected_results); - mag_cal_update(&expected_results, test_values); - - rc = online_calibration_process_data( - &data, &motion_sensors[LID], __hw_clock_source_read()); - TEST_EQ(rc, EC_SUCCESS, "%d"); - TEST_EQ(expected_results.kasa_fit.nsamples, - lid_mag_cal_data.kasa_fit.nsamples, "%d"); - - return EC_SUCCESS; -} - -void before_test(void) -{ - mock_read_temp_results = NULL; - online_calibration_init(); -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_read_temp_on_stage); - RUN_TEST(test_read_temp_from_cache_on_stage); - RUN_TEST(test_read_temp_twice_after_cache_stale); - RUN_TEST(test_new_calibration_value); - RUN_TEST(test_mag_reading_updated_cal); - - test_print_result(); -} diff --git a/test/online_calibration.tasklist b/test/online_calibration.tasklist deleted file mode 100644 index 5b67239ff8..0000000000 --- a/test/online_calibration.tasklist +++ /dev/null @@ -1,11 +0,0 @@ -/* Copyright 2020 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(MOTIONSENSE, motion_sense_task, NULL, TASK_STACK_SIZE) - diff --git a/test/online_calibration_spoof.c b/test/online_calibration_spoof.c deleted file mode 100644 index 66ef5d01de..0000000000 --- a/test/online_calibration_spoof.c +++ /dev/null @@ -1,196 +0,0 @@ -/* Copyright 2020 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 "accel_cal.h" -#include "accelgyro.h" -#include "hwtimer.h" -#include "mag_cal.h" -#include "online_calibration.h" -#include "test_util.h" -#include "gyro_cal_init_for_test.h" -#include "gyro_cal.h" -#include "timer.h" -#include <stdio.h> - -int mkbp_send_event(uint8_t event_type) -{ - return 1; -} - -/* - * Mocked driver (can be re-used for all sensors). - */ - -static int mock_read_temp(const struct motion_sensor_t *s, int *temp) -{ - if (temp) - *temp = 200; - return EC_SUCCESS; -} - -static struct accelgyro_drv mock_sensor_driver = { - .read_temp = mock_read_temp, -}; - -/* - * Accelerometer, magnetometer, and gyroscope data structs. - */ - -static struct accel_cal_algo accel_cal_algos[] = { { - .newton_fit = NEWTON_FIT(4, 15, FLOAT_TO_FP(0.01f), FLOAT_TO_FP(0.25f), - FLOAT_TO_FP(1.0e-8f), 100), -} }; - -static struct accel_cal accel_cal_data = { - .still_det = - STILL_DET(FLOAT_TO_FP(0.00025f), 800 * MSEC, 1200 * MSEC, 5), - .algos = accel_cal_algos, - .num_temp_windows = ARRAY_SIZE(accel_cal_algos), -}; - -static struct mag_cal_t mag_cal_data; - -static struct gyro_cal gyro_cal_data; - -/* - * Motion sensor array and count. - */ - -struct motion_sensor_t motion_sensors[] = { - { - .type = MOTIONSENSE_TYPE_ACCEL, - .default_range = 4, - .drv = &mock_sensor_driver, - .online_calib_data[0] = { - .type_specific_data = &accel_cal_data, - }, - }, - { - .type = MOTIONSENSE_TYPE_MAG, - .default_range = 4, - .drv = &mock_sensor_driver, - .online_calib_data[0] = { - .type_specific_data = &mag_cal_data, - }, - }, - { - .type = MOTIONSENSE_TYPE_GYRO, - .default_range = 4, - .drv = &mock_sensor_driver, - .online_calib_data[0] = { - .type_specific_data = &gyro_cal_data, - }, - }, -}; - -const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); - -static void spoof_sensor_data(struct motion_sensor_t *s, int x, int y, int z) -{ - struct ec_response_motion_sensor_data data; - uint32_t timestamp = 0; - - /* Set the data and flags. */ - data.data[X] = x; - data.data[Y] = y; - data.data[Z] = z; - s->flags |= MOTIONSENSE_FLAG_IN_SPOOF_MODE; - - /* Pass the data to online_calibdation. */ - online_calibration_process_data(&data, s, timestamp); -} - -/* - * Begin testing. - */ - -static int test_accel_calibration_on_spoof(void) -{ - struct ec_response_online_calibration_data out; - - /* Send spoof data (1, 2, 3). */ - spoof_sensor_data(&motion_sensors[0], 1, 2, 3); - - /* Check that we have new values. */ - TEST_ASSERT(online_calibration_has_new_values()); - - /* Get the new values for sensor 0. */ - TEST_ASSERT(online_calibration_read(&motion_sensors[0], &out)); - - /* Validate the new values. */ - TEST_EQ(out.data[X], 1, "%d"); - TEST_EQ(out.data[Y], 2, "%d"); - TEST_EQ(out.data[Z], 3, "%d"); - - /* Validate that no other sensors have data. */ - TEST_ASSERT(!online_calibration_has_new_values()); - - return EC_SUCCESS; -} - -static int test_mag_calibration_on_spoof(void) -{ - struct ec_response_online_calibration_data out; - - /* Send spoof data (4, 5, 6). */ - spoof_sensor_data(&motion_sensors[1], 4, 5, 6); - - /* Check that we have new values. */ - TEST_ASSERT(online_calibration_has_new_values()); - - /* Get the new values for sensor 0. */ - TEST_ASSERT(online_calibration_read(&motion_sensors[1], &out)); - - /* Validate the new values. */ - TEST_EQ(out.data[X], 4, "%d"); - TEST_EQ(out.data[Y], 5, "%d"); - TEST_EQ(out.data[Z], 6, "%d"); - - /* Validate that no other sensors have data. */ - TEST_ASSERT(!online_calibration_has_new_values()); - - return EC_SUCCESS; -} - -static int test_gyro_calibration_on_spoof(void) -{ - struct ec_response_online_calibration_data out; - - /* Send spoof data (7, 8, 9). */ - spoof_sensor_data(&motion_sensors[2], 7, 8, 9); - - /* Check that we have new values. */ - TEST_ASSERT(online_calibration_has_new_values()); - - /* Get the new values for sensor 0. */ - TEST_ASSERT(online_calibration_read(&motion_sensors[2], &out)); - - /* Validate the new values. */ - TEST_EQ(out.data[X], 7, "%d"); - TEST_EQ(out.data[Y], 8, "%d"); - TEST_EQ(out.data[Z], 9, "%d"); - - /* Validate that no other sensors have data. */ - TEST_ASSERT(!online_calibration_has_new_values()); - - return EC_SUCCESS; -} - -void before_test(void) -{ - online_calibration_init(); - gyro_cal_initialization_for_test(&gyro_cal_data); -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_accel_calibration_on_spoof); - RUN_TEST(test_mag_calibration_on_spoof); - RUN_TEST(test_gyro_calibration_on_spoof); - - test_print_result(); -} diff --git a/test/online_calibration_spoof.tasklist b/test/online_calibration_spoof.tasklist deleted file mode 100644 index 7d28eb5b64..0000000000 --- a/test/online_calibration_spoof.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2020 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(MOTIONSENSE, motion_sense_task, NULL, TASK_STACK_SIZE) diff --git a/test/pingpong.c b/test/pingpong.c deleted file mode 100644 index 9d3a7ed7af..0000000000 --- a/test/pingpong.c +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright 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. - * - * Tasks for scheduling test. - */ - -#include "common.h" -#include "console.h" -#include "task.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -#define TEST_COUNT 3000 - -static int wake_count[3]; - -int task_abc(void *data) -{ - int myid = task_get_current() - TASK_ID_TESTA; - task_id_t next = task_get_current() + 1; - if (next > TASK_ID_TESTC) - next = TASK_ID_TESTA; - - task_wait_event(-1); - - ccprintf("\n[starting Task %c]\n", ('A' + myid)); - - while (1) { - wake_count[myid]++; - if (myid == 2 && wake_count[myid] == TEST_COUNT) { - if (wake_count[0] == TEST_COUNT && - wake_count[1] == TEST_COUNT) - test_pass(); - else - test_fail(); - wake_count[0] = wake_count[1] = wake_count[2] = 0; - task_wait_event(-1); - } else { - task_set_event(next, TASK_EVENT_WAKE); - task_wait_event(-1); - } - } - - return EC_SUCCESS; -} - -int task_tick(void *data) -{ - task_wait_event(-1); - ccprintf("\n[starting Task T]\n"); - - /* Wake up every tick */ - while (1) { - /* Wait for timer interrupt message */ - usleep(3000); - } - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - wait_for_task_started(); - task_wake(TASK_ID_TICK); - task_wake(TASK_ID_TESTA); -} diff --git a/test/pingpong.tasklist b/test/pingpong.tasklist deleted file mode 100644 index 760d204b67..0000000000 --- a/test/pingpong.tasklist +++ /dev/null @@ -1,13 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(TESTA, task_abc, NULL, TASK_STACK_SIZE) \ - TASK_TEST(TESTB, task_abc, NULL, TASK_STACK_SIZE) \ - TASK_TEST(TESTC, task_abc, NULL, TASK_STACK_SIZE) \ - TASK_TEST(TICK, task_tick, NULL, 256) diff --git a/test/power_button.c b/test/power_button.c deleted file mode 100644 index 5fe9136105..0000000000 --- a/test/power_button.c +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright 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. - * - * Test lid switch. - */ - -#include "common.h" -#include "console.h" -#include "gpio.h" -#include "hooks.h" -#include "host_command.h" -#include "power_button.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -static int pb_hook_count; - -int lid_is_open(void) -{ - return 1; -} - -static void pb_change_hook(void) -{ - pb_hook_count++; -} -DECLARE_HOOK(HOOK_POWER_BUTTON_CHANGE, pb_change_hook, HOOK_PRIO_DEFAULT); - -int pb_memmap_state(void) -{ - uint8_t *memmap = host_get_memmap(EC_MEMMAP_SWITCHES); - return *memmap & EC_SWITCH_POWER_BUTTON_PRESSED; -} - -static int test_hook(void) -{ - /* Release power button for testing */ - gpio_set_level(GPIO_POWER_BUTTON_L, 1); - msleep(100); - pb_hook_count = 0; - host_clear_events(0xffffffff); - - gpio_set_level(GPIO_POWER_BUTTON_L, 0); - msleep(50); - TEST_ASSERT(pb_hook_count == 1); - TEST_ASSERT(power_button_is_pressed()); - TEST_ASSERT(pb_memmap_state()); - TEST_ASSERT(host_get_events() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON)); - host_clear_events(0xffffffff); - - gpio_set_level(GPIO_POWER_BUTTON_L, 1); - msleep(50); - TEST_ASSERT(pb_hook_count == 2); - TEST_ASSERT(!power_button_is_pressed()); - TEST_ASSERT(!pb_memmap_state()); - TEST_ASSERT(!(host_get_events() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON))); - - return EC_SUCCESS; -} - -static int test_debounce(void) -{ - /* Release power button for testing */ - gpio_set_level(GPIO_POWER_BUTTON_L, 1); - msleep(100); - pb_hook_count = 0; - host_clear_events(0xffffffff); - - gpio_set_level(GPIO_POWER_BUTTON_L, 0); - msleep(20); - TEST_ASSERT(pb_hook_count == 0); - TEST_ASSERT(!power_button_is_pressed()); - TEST_ASSERT(!pb_memmap_state()); - TEST_ASSERT(!(host_get_events() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON))); - - gpio_set_level(GPIO_POWER_BUTTON_L, 1); - msleep(50); - TEST_ASSERT(pb_hook_count == 0); - TEST_ASSERT(!power_button_is_pressed()); - TEST_ASSERT(!pb_memmap_state()); - TEST_ASSERT(!(host_get_events() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON))); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_hook); - RUN_TEST(test_debounce); - - test_print_result(); -} diff --git a/test/power_button.tasklist b/test/power_button.tasklist deleted file mode 100644 index da0ab6211a..0000000000 --- a/test/power_button.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/powerdemo.c b/test/powerdemo.c deleted file mode 100644 index e695bb8e5e..0000000000 --- a/test/powerdemo.c +++ /dev/null @@ -1,181 +0,0 @@ -/* Copyright 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. - */ - -/* Power state machine demo module for Chrome EC */ - -#include "clock.h" -#include "common.h" -#include "powerdemo.h" -#include "task.h" -#include "timer.h" -#include "registers.h" - -static volatile enum { - POWER_STATE_IDLE = 0, /* Idle */ - POWER_STATE_DOWN1, /* Assert output for 1ms */ - POWER_STATE_UP1, /* Deassert output for 1ms */ - POWER_STATE_DOWN10, /* Assert output for 10ms */ - POWER_STATE_UP5, /* Deassert output for 5ms */ - POWER_STATE_DOWN15, /* Assert output for 15ms */ - POWER_STATE_WAIT, /* Wait for button to be released */ - POWER_STATE_DOWN2 /* Assert output for 2ms */ -} state = POWER_STATE_IDLE; - - -/* Stops the timer. */ -static void __stop_timer(void) -{ - /* Disable timer A */ - LM4_TIMER_CTL(7) &= ~0x01; - /* Clear any pending interrupts */ - LM4_TIMER_ICR(7) = LM4_TIMER_RIS(7); -} - - -/* Starts the timer with the specified delay. If the timer is already - * started, resets it. */ -static void __start_timer(int usec) -{ - /* Stop the timer, if it was started */ - __stop_timer(); - /* Set the delay, counting function overhead */ - LM4_TIMER_TAILR(7) = usec; - /* Start timer A */ - LM4_TIMER_CTL(7) |= 0x01; -} - - -static void __set_state(int new_state, int pin_value, int timeout) -{ - LM4_GPIO_DATA(LM4_GPIO_D, 0x08) = (pin_value ? 0x08 : 0); - if (timeout) - __start_timer(timeout); - else - __stop_timer(); - state = new_state; -} - - -int power_demo_init(void) -{ - volatile uint32_t scratch __attribute__((unused)); - - /* Set up TIMER1 as our state timer */ - /* Enable TIMER1 clock */ - LM4_SYSTEM_RCGCWTIMER |= 0x02; - /* wait 3 clock cycles before using the module */ - scratch = LM4_SYSTEM_RCGCWTIMER; - /* Ensure timer is disabled : TAEN = TBEN = 0 */ - LM4_TIMER_CTL(7) &= ~0x101; - /* 32-bit timer mode */ - LM4_TIMER_CFG(7) = 4; - /* Set the prescaler to increment every microsecond */ - LM4_TIMER_TAPR(7) = clock_get_freq() / SECOND; - /* One-shot, counting down */ - LM4_TIMER_TAMR(7) = 0x01; - /* Set overflow interrupt */ - LM4_TIMER_IMR(7) = 0x1; - - /* Enable clock to GPIO module D */ - LM4_SYSTEM_RCGCGPIO |= 0x0008; - - /* Clear GPIOAFSEL and enable digital function for pins 0-3 */ - LM4_GPIO_AFSEL(LM4_GPIO_D) &= ~0x0f; - LM4_GPIO_DEN(LM4_GPIO_D) |= 0x0f; - - /* Set pins 0-2 as input, pin 3 as output */ - LM4_GPIO_DIR(LM4_GPIO_D) = (LM4_GPIO_DIR(LM4_GPIO_D) & ~0x0f) | 0x08; - - /* Set pin 0 to edge-sensitive, both edges, pull-up */ - LM4_GPIO_IS(LM4_GPIO_D) &= ~0x01; - LM4_GPIO_IBE(LM4_GPIO_D) |= 0x01; - LM4_GPIO_PUR(LM4_GPIO_D) |= 0x01; - - /* Move to idle state */ - __set_state(POWER_STATE_IDLE, 1, 0); - - /* Enable interrupt on pin 0 */ - LM4_GPIO_IM(LM4_GPIO_D) |= 0x01; - - return EC_SUCCESS; -} - - -/* GPIO interrupt handler */ -static void __gpio_d_interrupt(void) -{ - uint32_t mis = LM4_GPIO_MIS(LM4_GPIO_D); - - /* Clear the interrupt bits we're handling */ - LM4_GPIO_ICR(LM4_GPIO_D) = mis; - - /* Handle edges */ - if (mis & 0x01) { - if (LM4_GPIO_DATA(LM4_GPIO_D, 0x01)) { - if (state == POWER_STATE_WAIT) - __set_state(POWER_STATE_DOWN2, 0, 2000 - 28); - } else { - if (state == POWER_STATE_IDLE) - __set_state(POWER_STATE_DOWN1, 0, 1000 - 28); - } - } -} - -DECLARE_IRQ(LM4_IRQ_GPIOD, __gpio_d_interrupt, 1); - - -/* Timer interrupt handler */ -static void __timer_w1_interrupt(void) -{ - uint32_t mis = LM4_TIMER_RIS(7); - /* Clear the interrupt reasons we're handling */ - LM4_TIMER_ICR(7) = mis; - - /* Transition to next state */ - switch (state) { - case POWER_STATE_IDLE: - case POWER_STATE_WAIT: - /* Ignore timer events when waiting for GPIO edges */ - break; - case POWER_STATE_DOWN1: - __set_state(POWER_STATE_UP1, 1, 1000 - 28); - break; - case POWER_STATE_UP1: - __set_state(POWER_STATE_DOWN10, 0, 10000 - 228); - break; - case POWER_STATE_DOWN10: - __set_state(POWER_STATE_UP5, 1, 5000 - 128); - break; - case POWER_STATE_UP5: - __set_state(POWER_STATE_DOWN15, 0, 15000 - 328); - break; - case POWER_STATE_DOWN15: - if (LM4_GPIO_DATA(LM4_GPIO_D, 0x01)) { - /* Button has already been released; go straight to - * idle */ - __set_state(POWER_STATE_IDLE, 1, 0); - } else { - /* Wait for button release */ - __set_state(POWER_STATE_WAIT, 1, 0); - } - break; - case POWER_STATE_DOWN2: - __set_state(POWER_STATE_IDLE, 1, 0); - break; - } -} - -DECLARE_IRQ(LM4_IRQ_TIMERW1A, __timer_w1_interrupt, 1); - -int power_demo_task(void) -{ - /* Initialize the peripherals */ - power_demo_init(); - - /* suspend this task forever */ - task_wait_event(-1); - - return EC_SUCCESS; -} diff --git a/test/powerdemo.h b/test/powerdemo.h deleted file mode 100644 index 17ed482042..0000000000 --- a/test/powerdemo.h +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright 2011 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. - */ - -/* Power state machine demo module for Chrome EC */ - -#ifndef __TEST_POWERDEMO_H -#define __TEST_POWERDEMO_H - -#include "common.h" - -/* Initializes the module. */ -int power_demo_init(void); - -#endif /* __TEST_POWERDEMO_H */ diff --git a/test/powerdemo.tasklist b/test/powerdemo.tasklist deleted file mode 100644 index a4fff562e3..0000000000 --- a/test/powerdemo.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(POWERDEMO, power_demo_task, NULL, TASK_STACK_SIZE) diff --git a/test/printf.c b/test/printf.c deleted file mode 100644 index f7e9b9dd2d..0000000000 --- a/test/printf.c +++ /dev/null @@ -1,310 +0,0 @@ -/* Copyright 2019 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 <stdarg.h> -#include <stdbool.h> -#include <stddef.h> - -#include "common.h" -#include "printf.h" -#include "test_util.h" -#include "util.h" - -#define INIT_VALUE 0x5E -#define NO_BYTES_TOUCHED NULL - -static const char err_str[] = "ERROR"; -static char output[1024]; - -int run(int expect_ret, const char *expect, - bool output_null, size_t size_limit, - const char *format, va_list args) -{ - size_t expect_size = expect ? strlen(expect) + 1 : 0; - int rv; - - ccprintf("\n"); - ccprintf("size_limit=%-4zd | format='%s'\n", size_limit, format); - ccprintf("expect ='%s' | expect_status=%d\n", - expect ? expect : "NO_BYTES_TOUCHED", expect_ret); - - TEST_ASSERT(expect_size <= sizeof(output)); - TEST_ASSERT(expect_size <= size_limit); - memset(output, INIT_VALUE, sizeof(output)); - - rv = vsnprintf(output_null ? NULL : output, size_limit, - format, args); - ccprintf("received='%.*s' | ret =%d\n", - 30, output, rv); - - TEST_ASSERT_ARRAY_EQ(output, expect, expect_size); - TEST_ASSERT_MEMSET(&output[expect_size], INIT_VALUE, - sizeof(output) - expect_size); - - if (rv >= 0) { - TEST_ASSERT(rv == expect_size - 1); - TEST_ASSERT(EC_SUCCESS == expect_ret); - } else { - TEST_ASSERT(rv == -expect_ret); - } - - return EC_SUCCESS; -} - -int expect_success(const char *expect, const char *format, ...) -{ - va_list args; - int rv; - - va_start(args, format); - rv = run(EC_SUCCESS, expect, - false, sizeof(output), - format, args); - va_end(args); - - return rv; -} - -int expect(int expect_ret, const char *expect, - bool output_null, size_t size_limit, - const char *format, ...) -{ - va_list args; - int rv; - - va_start(args, format); - rv = run(expect_ret, expect, - output_null, size_limit, - format, args); - va_end(args); - - return rv; -} - -#define T(n) \ - do { \ - int rv = (n); \ - if (rv != EC_SUCCESS) \ - return rv; \ - } while (0) - -test_static int test_vsnprintf_args(void) -{ - T(expect_success("", "")); - T(expect_success("a", "a")); - - T(expect(/* expect an invalid args error */ - EC_ERROR_INVAL, NO_BYTES_TOUCHED, - /* given 0 as output size limit */ - false, 0, "")); - T(expect(/* expect SUCCESS */ - EC_SUCCESS, "", - /* given 1 as output size limit and a blank format */ - false, 1, "")); - T(expect(/* expect an overflow error */ - EC_ERROR_OVERFLOW, "", - /* given 1 as output size limit with a non-blank format */ - false, 1, "a")); - - T(expect(/* expect an invalid args error */ - EC_ERROR_INVAL, NO_BYTES_TOUCHED, - /* given NULL as the output buffer */ - true, sizeof(output), "")); - T(expect(/* expect an invalid args error */ - EC_ERROR_INVAL, NO_BYTES_TOUCHED, - /* given a NULL format string */ - false, sizeof(output), NULL)); - - return EC_SUCCESS; -} - -test_static int test_vsnprintf_int(void) -{ - T(expect_success("123", "%d", 123)); - T(expect_success("-123", "%d", -123)); - T(expect_success("+123", "%+d", 123)); - T(expect_success("-123", "%+d", -123)); - T(expect_success("123", "%-d", 123)); - T(expect_success("-123", "%-d", -123)); - - T(expect_success(" 123", "%5d", 123)); - T(expect_success(" +123", "%+5d", 123)); - T(expect_success("00123", "%05d", 123)); - T(expect_success("00123", "%005d", 123)); - /* - * TODO(crbug.com/974084): This odd behavior should be fixed. - * T(expect_success("+0123", "%+05d", 123)); - * Actual: "0+123" - * T(expect_success("+0123", "%+005d", 123)); - * Actual: "0+123" - */ - - T(expect_success(" 123", "%*d", 5, 123)); - T(expect_success(" +123", "%+*d", 5, 123)); - T(expect_success("00123", "%0*d", 5, 123)); - /* - * TODO(crbug.com/974084): This odd behavior should be fixed. - * T(expect_success("00123", "%00*d", 5, 123)); - * Actual: "ERROR" - */ - T(expect_success("0+123", "%+0*d", 5, 123)); - /* - * TODO(crbug.com/974084): This odd behavior should be fixed. - * T(expect_success("0+123", "%+00*d", 5, 123)); - * Actual: "ERROR" - */ - - T(expect_success("123 ", "%-5d", 123)); - T(expect_success("+123 ", "%-+5d", 123)); - T(expect_success(err_str, "%+-5d", 123)); - T(expect_success("123 ", "%-05d", 123)); - T(expect_success("123 ", "%-005d", 123)); - T(expect_success("+123 ", "%-+05d", 123)); - T(expect_success("+123 ", "%-+005d", 123)); - - T(expect_success("0.00123", "%.5d", 123)); - T(expect_success("+0.00123", "%+.5d", 123)); - T(expect_success("0.00123", "%7.5d", 123)); - T(expect_success(" 0.00123", "%9.5d", 123)); - T(expect_success(" +0.00123", "%+9.5d", 123)); - - T(expect_success("123", "%u", 123)); - T(expect_success("4294967295", "%u", -1)); - T(expect_success("18446744073709551615", "%llu", (uint64_t)-1)); - - T(expect_success("0", "%x", 0)); - T(expect_success("0", "%X", 0)); - T(expect_success("5e", "%x", 0X5E)); - T(expect_success("5E", "%X", 0X5E)); - - /* - * %l is deprecated on 32-bit systems (see crbug.com/984041), but is - * is still functional on 64-bit systems. - */ - if (sizeof(long) == sizeof(uint32_t)) { - T(expect_success(err_str, "%lx", 0x7b)); - T(expect_success(err_str, "%08lu", 0x7b)); - T(expect_success("13ERROR", "%d%lu", 13, 14)); - } else { - T(expect_success("7b", "%lx", 0x7b)); - T(expect_success("00000123", "%08lu", 123)); - T(expect_success("131415", "%d%lu%d", 13, 14L, 15)); - } - - return EC_SUCCESS; -} - -test_static int test_vsnprintf_pointers(void) -{ - void *ptr = (void *)0x55005E00; - unsigned int val = 0; - - T(expect_success("55005e00", "%pP", ptr)); - T(expect_success(err_str, "%P", ptr)); - /* %p by itself is invalid */ - T(expect(EC_ERROR_INVAL, NO_BYTES_TOUCHED, - false, 0, "%p")); - /* %p with an unknown suffix is invalid */ - T(expect(EC_ERROR_INVAL, NO_BYTES_TOUCHED, - false, 0, "%p ")); - /* %p with an unknown suffix is invalid */ - T(expect(EC_ERROR_INVAL, NO_BYTES_TOUCHED, - false, 0, "%pQ")); - - /* Test %pb, binary format */ - T(expect_success("0", "%pb", BINARY_VALUE(val, 0))); - val = 0x5E; - T(expect_success("1011110", "%pb", BINARY_VALUE(val, 0))); - T(expect_success("0000000001011110", "%pb", BINARY_VALUE(val, 16))); - val = 0x12345678; - T(expect_success("10010001101000101011001111000", "%pb", - BINARY_VALUE(val, 0))); - val = 0xFEDCBA90; - /* Test a number that makes the longest string possible */ - T(expect_success("11111110110111001011101010010000", "%pb", - BINARY_VALUE(val, 0))); - return EC_SUCCESS; -} - -test_static int test_vsnprintf_chars(void) -{ - T(expect_success("a", "%c", 'a')); - T(expect_success("*", "%c", '*')); - return EC_SUCCESS; -} - -test_static int test_vsnprintf_strings(void) -{ - T(expect_success("abc", "%s", "abc")); - T(expect_success(" abc", "%5s", "abc")); - T(expect_success("abc", "%0s", "abc")); - T(expect_success("abc ", "%-5s", "abc")); - T(expect_success("abc", "%*s", 0, "abc")); - T(expect_success("a", "%.1s", "abc")); - T(expect_success("a", "%.*s", 1, "abc")); - T(expect_success("", "%.0s", "abc")); - T(expect_success("", "%.*s", 0, "abc")); - /* - * TODO(crbug.com/974084): - * Ignoring the padding parameter is slightly - * odd behavior and could use a review. - */ - T(expect_success("ab", "%5.2s", "abc")); - T(expect_success("abc", "%.4s", "abc")); - - /* - * Given a malformed string (address 0x1 is a good example), - * if we ask for zero precision, expect no bytes to be read - * from the malformed address and a blank output string. - */ - T(expect_success("", "%.0s", (char *)1)); - - return EC_SUCCESS; -} - -test_static int test_vsnprintf_timestamps(void) -{ - uint64_t ts = 0; - - T(expect_success("0.000000", "%pT", &ts)); - ts = 123456; - T(expect_success("0.123456", "%pT", &ts)); - ts = 9999999000000; - T(expect_success("9999999.000000", "%pT", &ts)); - return EC_SUCCESS; -} - -test_static int test_vsnprintf_hexdump(void) -{ - const char bytes[] = {0x00, 0x5E}; - - T(expect_success("005e", "%ph", HEX_BUF(bytes, 2))); - T(expect_success("", "%ph", HEX_BUF(bytes, 0))); - T(expect_success("00", "%ph", HEX_BUF(bytes, 1))); - return EC_SUCCESS; -} - -test_static int test_vsnprintf_combined(void) -{ - T(expect_success("abc", "%c%s", 'a', "bc")); - T(expect_success("12\tbc", "%d\t%s", 12, "bc")); - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_vsnprintf_args); - RUN_TEST(test_vsnprintf_int); - RUN_TEST(test_vsnprintf_pointers); - RUN_TEST(test_vsnprintf_chars); - RUN_TEST(test_vsnprintf_strings); - RUN_TEST(test_vsnprintf_timestamps); - RUN_TEST(test_vsnprintf_hexdump); - RUN_TEST(test_vsnprintf_combined); - - test_print_result(); -} diff --git a/test/printf.tasklist b/test/printf.tasklist deleted file mode 100644 index 9fc1a80f4d..0000000000 --- a/test/printf.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST diff --git a/test/queue.c b/test/queue.c deleted file mode 100644 index e0be1b5d9a..0000000000 --- a/test/queue.c +++ /dev/null @@ -1,441 +0,0 @@ -/* Copyright 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. - * - * Test queue. - */ - -#include "common.h" -#include "console.h" -#include "queue.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -static struct queue const test_queue8 = QUEUE_NULL(8, char); -static struct queue const test_queue2 = QUEUE_NULL(2, int16_t); - -static int test_queue8_empty(void) -{ - char tmp = 1; - - TEST_ASSERT(queue_is_empty(&test_queue8)); - TEST_ASSERT(!queue_remove_units(&test_queue8, &tmp, 1)); - TEST_ASSERT(queue_add_units(&test_queue8, &tmp, 1) == 1); - TEST_ASSERT(!queue_is_empty(&test_queue8)); - - return EC_SUCCESS; -} - -static int test_queue8_init(void) -{ - char tmp = 1; - - TEST_ASSERT(queue_add_units(&test_queue8, &tmp, 1) == 1); - queue_init(&test_queue8); - TEST_ASSERT(queue_is_empty(&test_queue8)); - - return EC_SUCCESS; -} - -static int test_queue8_fifo(void) -{ - char buf1[3] = {1, 2, 3}; - char buf2[3]; - - TEST_ASSERT(queue_add_units(&test_queue8, buf1 + 0, 1) == 1); - TEST_ASSERT(queue_add_units(&test_queue8, buf1 + 1, 1) == 1); - TEST_ASSERT(queue_add_units(&test_queue8, buf1 + 2, 1) == 1); - - TEST_ASSERT(queue_remove_units(&test_queue8, buf2, 3) == 3); - TEST_ASSERT_ARRAY_EQ(buf1, buf2, 3); - - return EC_SUCCESS; -} - -static int test_queue8_multiple_units_add(void) -{ - char buf1[5] = {1, 2, 3, 4, 5}; - char buf2[5]; - - TEST_ASSERT(queue_space(&test_queue8) >= 5); - TEST_ASSERT(queue_add_units(&test_queue8, buf1, 5) == 5); - TEST_ASSERT(queue_remove_units(&test_queue8, buf2, 5) == 5); - TEST_ASSERT_ARRAY_EQ(buf1, buf2, 5); - - return EC_SUCCESS; -} - -static int test_queue8_removal(void) -{ - char buf1[5] = {1, 2, 3, 4, 5}; - char buf2[5]; - - TEST_ASSERT(queue_add_units(&test_queue8, buf1, 5) == 5); - /* 1, 2, 3, 4, 5 */ - TEST_ASSERT(queue_remove_units(&test_queue8, buf2, 3) == 3); - TEST_ASSERT_ARRAY_EQ(buf1, buf2, 3); - /* 4, 5 */ - TEST_ASSERT(queue_add_units(&test_queue8, buf1, 2) == 2); - /* 4, 5, 1, 2 */ - TEST_ASSERT(queue_space(&test_queue8) == 4); - TEST_ASSERT(queue_remove_units(&test_queue8, buf2, 1) == 1); - TEST_ASSERT(buf2[0] == 4); - /* 5, 1, 2 */ - TEST_ASSERT(queue_add_units(&test_queue8, buf1 + 2, 2) == 2); - /* 5, 1, 2, 3, 4 */ - TEST_ASSERT(queue_space(&test_queue8) == 3); - TEST_ASSERT(queue_add_units(&test_queue8, buf1 + 2, 3) == 3); - /* 5, 1, 2, 3, 4, 3, 4, 5 */ - TEST_ASSERT(queue_space(&test_queue8) == 0); - TEST_ASSERT(queue_remove_units(&test_queue8, buf2, 1) == 1); - TEST_ASSERT(buf2[0] == 5); - TEST_ASSERT(queue_remove_units(&test_queue8, buf2, 4) == 4); - TEST_ASSERT_ARRAY_EQ(buf1, buf2, 4); - TEST_ASSERT(queue_remove_units(&test_queue8, buf2, 3) == 3); - TEST_ASSERT_ARRAY_EQ(buf1 + 2, buf2, 3); - TEST_ASSERT(queue_is_empty(&test_queue8)); - /* Empty */ - TEST_ASSERT(queue_add_units(&test_queue8, buf1, 5) == 5); - TEST_ASSERT(queue_remove_units(&test_queue8, buf2, 5) == 5); - TEST_ASSERT_ARRAY_EQ(buf1, buf2, 5); - - return EC_SUCCESS; -} - -static int test_queue8_peek(void) -{ - char buf1[5] = {1, 2, 3, 4, 5}; - char buf2[5]; - - TEST_ASSERT(queue_add_units(&test_queue8, buf1, 5) == 5); - /* 1, 2, 3, 4, 5 */ - TEST_ASSERT(queue_count(&test_queue8) == 5); - TEST_ASSERT(queue_space(&test_queue8) == 3); - TEST_ASSERT(queue_peek_units(&test_queue8, buf2, 2, 3) == 3); - TEST_ASSERT_ARRAY_EQ(buf1 + 2, buf2, 3); - TEST_ASSERT(queue_count(&test_queue8) == 5); - TEST_ASSERT(queue_space(&test_queue8) == 3); - - return EC_SUCCESS; -} - -static int test_queue2_odd_even(void) -{ - uint16_t buf1[3] = {1, 2, 3}; - uint16_t buf2[3]; - - TEST_ASSERT(queue_add_units(&test_queue2, buf1, 1) == 1); - /* 1 */ - TEST_ASSERT(queue_space(&test_queue2) == 1); - TEST_ASSERT(queue_add_units(&test_queue2, buf1 + 1, 1) == 1); - /* 1, 2 */ - TEST_ASSERT(queue_space(&test_queue2) == 0); - TEST_ASSERT(queue_remove_units(&test_queue2, buf2, 2) == 2); - TEST_ASSERT_ARRAY_EQ(buf1, buf2, 2); - TEST_ASSERT(queue_is_empty(&test_queue2)); - /* Empty */ - TEST_ASSERT(queue_space(&test_queue2) == 2); - TEST_ASSERT(queue_add_units(&test_queue2, buf1 + 2, 1) == 1); - /* 3 */ - TEST_ASSERT(queue_remove_units(&test_queue2, buf2, 1) == 1); - TEST_ASSERT(buf2[0] == 3); - TEST_ASSERT(queue_is_empty(&test_queue2)); - - return EC_SUCCESS; -} - -static int test_queue8_chunks(void) -{ - static uint8_t const data[3] = {1, 2, 3}; - struct queue_chunk chunk; - - chunk = queue_get_write_chunk(&test_queue8, 0); - - TEST_ASSERT(chunk.count == 8); - - memcpy(chunk.buffer, data, 3); - - TEST_ASSERT(queue_advance_tail(&test_queue8, 3) == 3); - - chunk = queue_get_read_chunk(&test_queue8); - - TEST_ASSERT(chunk.count == 3); - TEST_ASSERT_ARRAY_EQ((uint8_t *) chunk.buffer, data, 3); - - TEST_ASSERT(queue_advance_head(&test_queue8, 3) == 3); - TEST_ASSERT(queue_is_empty(&test_queue8)); - - return EC_SUCCESS; -} - -static int test_queue8_chunks_wrapped(void) -{ - static uint8_t const data[3] = {1, 2, 3}; - - /* Move near the end of the queue */ - TEST_ASSERT(queue_advance_tail(&test_queue8, 6) == 6); - TEST_ASSERT(queue_advance_head(&test_queue8, 6) == 6); - - /* Add three units, causing the tail to wrap */ - TEST_ASSERT(queue_add_units(&test_queue8, data, 3) == 3); - - /* - * With a wrapped tail we should only be able to access the first two - * elements for reading, but all five free elements for writing. - */ - TEST_ASSERT(queue_get_read_chunk(&test_queue8).count == 2); - TEST_ASSERT(queue_get_write_chunk(&test_queue8, 0).count == 5); - - /* Signal that we have read an element */ - TEST_ASSERT(queue_advance_head(&test_queue8, 1) == 1); - - /* - * Now we should only be able to see a single element for reading, but - * all six free element. - */ - TEST_ASSERT(queue_get_read_chunk(&test_queue8).count == 1); - TEST_ASSERT(queue_get_write_chunk(&test_queue8, 0).count == 6); - - /* Signal that we have read the last two elements */ - TEST_ASSERT(queue_advance_head(&test_queue8, 2) == 2); - - /* - * Now there should be no elements available for reading, and only - * seven, not eight elements available for writing. This is because - * the head/tail pointers now point to the second unit in the array. - */ - TEST_ASSERT(queue_get_read_chunk(&test_queue8).count == 0); - TEST_ASSERT(queue_get_write_chunk(&test_queue8, 0).count == 7); - - return EC_SUCCESS; -} - -static int test_queue8_chunks_full(void) -{ - static uint8_t const data[8] = {1, 2, 3, 4, 5, 6, 7, 8}; - struct queue_chunk chunk; - - /* Move near the end of the queue */ - TEST_ASSERT(queue_advance_tail(&test_queue8, 6) == 6); - TEST_ASSERT(queue_advance_head(&test_queue8, 6) == 6); - - /* Fill the queue */ - TEST_ASSERT(queue_add_units(&test_queue8, data, 8) == 8); - - /* With a full queue we shouldn't be able to write */ - TEST_ASSERT(queue_get_write_chunk(&test_queue8, 0).count == 0); - - /* But we should be able to read, though only two entries at first */ - chunk = queue_get_read_chunk(&test_queue8); - - TEST_ASSERT(chunk.count == 2); - TEST_ASSERT_ARRAY_EQ((uint8_t *) chunk.buffer, data, 2); - - /* Signal that we have read both units */ - TEST_ASSERT(queue_advance_head(&test_queue8, 2) == 2); - - /* Now we should only be able to see the rest */ - chunk = queue_get_read_chunk(&test_queue8); - - TEST_ASSERT(chunk.count == 6); - TEST_ASSERT_ARRAY_EQ((uint8_t *) chunk.buffer, data + 2, 6); - - - return EC_SUCCESS; -} - -static int test_queue8_chunks_empty(void) -{ - /* With an empty queue we shouldn't be able to read */ - TEST_ASSERT(queue_get_read_chunk(&test_queue8).count == 0); - - /* But we should be able to write, everything */ - TEST_ASSERT(queue_get_write_chunk(&test_queue8, 0).count == 8); - - return EC_SUCCESS; -} - -static int test_queue8_chunks_advance(void) -{ - /* - * We should only be able to advance the tail (add units) as many - * units as there are in an empty queue. - */ - TEST_ASSERT(queue_advance_tail(&test_queue8, 10) == 8); - - /* - * Similarly, we should only be able to advance the head (remove - * units) as many units as there are in the now full queue. - */ - TEST_ASSERT(queue_advance_head(&test_queue8, 10) == 8); - - /* - * And it shouldn't matter if we start in the middle of the queue. - */ - TEST_ASSERT(queue_advance_tail(&test_queue8, 3) == 3); - TEST_ASSERT(queue_advance_head(&test_queue8, 3) == 3); - - TEST_ASSERT(queue_advance_tail(&test_queue8, 10) == 8); - TEST_ASSERT(queue_advance_head(&test_queue8, 10) == 8); - - return EC_SUCCESS; -} - -static int test_queue8_chunks_offset(void) -{ - /* Check offsetting by 1 */ - TEST_ASSERT(queue_get_write_chunk(&test_queue8, 1).count == 7); - TEST_ASSERT(queue_get_write_chunk(&test_queue8, 1).buffer == - test_queue8.buffer + 1); - - /* Check offsetting by 4 */ - TEST_ASSERT(queue_get_write_chunk(&test_queue8, 4).count == 4); - TEST_ASSERT(queue_get_write_chunk(&test_queue8, 4).buffer == - test_queue8.buffer + 4); - - /* Check offset wrapping around */ - TEST_ASSERT(queue_get_write_chunk(&test_queue8, 10).count == 0); - TEST_ASSERT(queue_get_write_chunk(&test_queue8, 10).buffer == NULL); - - /* - * Check offsetting when used memory is in the middle: - * H T - * |--xx----| - */ - TEST_ASSERT(queue_advance_tail(&test_queue8, 4) == 4); - TEST_ASSERT(queue_advance_head(&test_queue8, 2) == 2); - - /* Get writable chunk to right of tail. */ - TEST_ASSERT(queue_get_write_chunk(&test_queue8, 2).count == 2); - TEST_ASSERT(queue_get_write_chunk(&test_queue8, 2).buffer == - test_queue8.buffer + 6); - - /* Get writable chunk wrapped and before head. */ - TEST_ASSERT(queue_get_write_chunk(&test_queue8, 4).count == 2); - TEST_ASSERT(queue_get_write_chunk(&test_queue8, 4).buffer == - test_queue8.buffer); - - /* Check offsetting into non-writable memory. */ - TEST_ASSERT(queue_get_write_chunk(&test_queue8, 6).count == 0); - TEST_ASSERT(queue_get_write_chunk(&test_queue8, 6).buffer == NULL); - - return EC_SUCCESS; -} - -static int test_queue8_iterate_begin(void) -{ - struct queue const *q = &test_queue8; - char data[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; - struct queue_iterator it; - - queue_begin(q, &it); - TEST_EQ(it.ptr, NULL, "%p"); - - queue_add_units(q, data, 4); - queue_begin(q, &it); - TEST_EQ(*((char *)it.ptr), 0, "%d"); - - return EC_SUCCESS; -} - -static int test_queue8_iterate_next(void) -{ - struct queue const *q = &test_queue8; - char data[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; - struct queue_iterator it; - - queue_add_units(q, data, 4); - queue_begin(q, &it); - TEST_EQ(*((char *)it.ptr), 0, "%d"); - - queue_next(q, &it); - TEST_NE(it.ptr, NULL, "%p"); - TEST_EQ(*((char *)it.ptr), 1, "%d"); - - queue_next(q, &it); - TEST_NE(it.ptr, NULL, "%p"); - TEST_EQ(*((char *)it.ptr), 2, "%d"); - - queue_next(q, &it); - TEST_NE(it.ptr, NULL, "%p"); - TEST_EQ(*((char *)it.ptr), 3, "%d"); - - queue_next(q, &it); - TEST_EQ(it.ptr, NULL, "%p"); - - return EC_SUCCESS; -} - -static int test_queue2_iterate_next_full(void) -{ - struct queue const *q = &test_queue2; - int16_t data[2] = { 523, -788 }; - struct queue_iterator it; - - queue_add_units(q, data, 2); - queue_begin(q, &it); - TEST_EQ(*((int16_t *)it.ptr), 523, "%d"); - - queue_next(q, &it); - TEST_NE(it.ptr, NULL, "%p"); - TEST_EQ(*((int16_t *)it.ptr), -788, "%d"); - - queue_next(q, &it); - TEST_EQ(it.ptr, NULL, "%p"); - - return EC_SUCCESS; -} - -static int test_queue8_iterate_next_reset_on_change(void) -{ - struct queue const *q = &test_queue8; - char data[8] = { -88, -37, -5, -1, 3, 16, 56, 100 }; - struct queue_iterator it; - - queue_add_units(q, data, 4); - queue_begin(q, &it); - TEST_NE(it.ptr, NULL, "%p"); - queue_add_units(q, data + 4, 4); - queue_next(q, &it); - TEST_EQ(it.ptr, NULL, "%p"); - - queue_begin(q, &it); - TEST_NE(it.ptr, NULL, "%p"); - queue_advance_head(q, 3); - queue_next(q, &it); - TEST_EQ(it.ptr, NULL, "%p"); - - return EC_SUCCESS; -} - -void before_test(void) -{ - queue_init(&test_queue2); - queue_init(&test_queue8); -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_queue8_empty); - RUN_TEST(test_queue8_init); - RUN_TEST(test_queue8_fifo); - RUN_TEST(test_queue8_multiple_units_add); - RUN_TEST(test_queue8_removal); - RUN_TEST(test_queue8_peek); - RUN_TEST(test_queue2_odd_even); - RUN_TEST(test_queue8_chunks); - RUN_TEST(test_queue8_chunks_wrapped); - RUN_TEST(test_queue8_chunks_full); - RUN_TEST(test_queue8_chunks_empty); - RUN_TEST(test_queue8_chunks_advance); - RUN_TEST(test_queue8_chunks_offset); - RUN_TEST(test_queue8_iterate_begin); - RUN_TEST(test_queue8_iterate_next); - RUN_TEST(test_queue2_iterate_next_full); - RUN_TEST(test_queue8_iterate_next_reset_on_change); - - test_print_result(); -} diff --git a/test/queue.tasklist b/test/queue.tasklist deleted file mode 100644 index da0ab6211a..0000000000 --- a/test/queue.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/rollback.c b/test/rollback.c deleted file mode 100644 index 2038333311..0000000000 --- a/test/rollback.c +++ /dev/null @@ -1,127 +0,0 @@ -/* Copyright 2020 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 <stdbool.h> -#include "flash.h" -#include "mpu.h" -#include "string.h" -#include "test_util.h" - -struct rollback_info { - int region_0_offset; - int region_1_offset; - uint32_t region_size_bytes; -}; - -/* These values are intentionally hardcoded here instead of using the chip - * config headers, so that if the headers are accidentally changed we can catch - * it. - */ -#if defined(CHIP_VARIANT_STM32F412) -struct rollback_info rollback_info = { - .region_0_offset = 0x20000, - .region_1_offset = 0x40000, - .region_size_bytes = 128 * 1024, -}; -#elif defined(CHIP_VARIANT_STM32H7X3) -struct rollback_info rollback_info = { - .region_0_offset = 0xC0000, - .region_1_offset = 0xE0000, - .region_size_bytes = 128 * 1024, -}; -#else -#error "Rollback info not defined for this chip. Please add it." -#endif - -test_static int read_rollback_region(const struct rollback_info *info, - int region) -{ - int i; - char data; - uint32_t bytes_read = 0; - - int offset = region == 0 ? info->region_0_offset : - info->region_1_offset; - - for (i = 0; i < info->region_size_bytes; i++) { - if (crec_flash_read(offset + i, sizeof(data), &data) == - EC_SUCCESS) - bytes_read++; - } - - return bytes_read; -} - -test_static int _test_lock_rollback(const struct rollback_info *info, - int region) -{ - int rv; - - /* - * We expect the MPU to have already been enabled during the - * initialization process (mpu_pre_init). - */ - - rv = mpu_lock_rollback(0); - TEST_EQ(rv, EC_SUCCESS, "%d"); - - /* unlocked we should be able to read both regions */ - rv = read_rollback_region(info, 0); - TEST_EQ(rv, rollback_info.region_size_bytes, "%d"); - - rv = read_rollback_region(info, 1); - TEST_EQ(rv, rollback_info.region_size_bytes, "%d"); - - rv = mpu_lock_rollback(1); - TEST_EQ(rv, EC_SUCCESS, "%d"); - - /* TODO(b/156112448): Validate that it actually reboots with the correct - * data access violation. - */ - read_rollback_region(info, region); - - /* Should not get here. Should reboot with: - * - * Data access violation, mfar = XXX - * - * where XXX = start of rollback - */ - TEST_ASSERT(false); - - return EC_ERROR_UNKNOWN; -} - -test_static int test_lock_rollback_region_0(void) -{ - /* This call should never return due to panic. */ - return _test_lock_rollback(&rollback_info, 0); -} - -test_static int test_lock_rollback_region_1(void) -{ - /* This call should never return due to panic. */ - return _test_lock_rollback(&rollback_info, 1); -} - -void run_test(int argc, char **argv) -{ - if (argc < 2) { - ccprintf("usage: runtest [region0|region1]\n"); - return; - } - - ccprintf("Running rollback test\n"); - - /* - * TODO(b/156112448): For now you have to run the test separately for - * each region. - */ - if (strncmp(argv[1], "region0", 7) == 0) - RUN_TEST(test_lock_rollback_region_0); - else if (strncmp(argv[1], "region1", 7) == 0) - RUN_TEST(test_lock_rollback_region_1); - - test_print_result(); -} diff --git a/test/rollback.tasklist b/test/rollback.tasklist deleted file mode 100644 index 51734f058d..0000000000 --- a/test/rollback.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2020 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* no tasks */ diff --git a/test/rollback_entropy.c b/test/rollback_entropy.c deleted file mode 100644 index 788fab2572..0000000000 --- a/test/rollback_entropy.c +++ /dev/null @@ -1,194 +0,0 @@ -/* Copyright 2020 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 "rollback.h" -#include "rollback_private.h" -#include "string.h" -#include "system.h" -#include "test_util.h" - -static const uint32_t VALID_ROLLBACK_COOKIE = 0x0b112233; -static const uint32_t UNINITIALIZED_ROLLBACK_COOKIE = 0xffffffff; - -static const uint8_t FAKE_ENTROPY[] = { - 0xff, 0xff, 0xff, 0xff -}; - -/* - * Generated by concatenating 32-bytes (256-bits) of zeros with the 4 bytes - * of FAKE_ENTROPY and computing SHA256 sum: - * - * echo -n -e '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'\ - * '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'\ - * '\xFF\xFF\xFF\xFF' | sha256sum - * - * 890ed82cf09f22243bdc4252e4d79c8a9810c1391f455dce37a7b732eb0a0e4f - */ -#define EXPECTED_SECRET \ - 0x89, 0x0e, 0xd8, 0x2c, 0xf0, 0x9f, 0x22, 0x24, 0x3b, 0xdc, 0x42, \ - 0x52, 0xe4, 0xd7, 0x9c, 0x8a, 0x98, 0x10, 0xc1, 0x39, 0x1f, 0x45, \ - 0x5d, 0xce, 0x37, 0xa7, 0xb7, 0x32, 0xeb, 0x0a, 0x0e, 0x4f -__maybe_unused static const uint8_t _EXPECTED_SECRET[] = { - EXPECTED_SECRET -}; -BUILD_ASSERT(sizeof(_EXPECTED_SECRET) == CONFIG_ROLLBACK_SECRET_SIZE); - -/* - * Generated by concatenating 32-bytes (256-bits) of EXPECTED_SECRET with the 4 - * bytes of FAKE_ENTROPY and computing SHA256 sum: - * - * echo -n -e '\x89\x0e\xd8\x2c\xf0\x9f\x22\x24\x3b\xdc\x42\x52\xe4\xd7\x9c'\ - * '\x8a\x98\x10\xc1\x39\x1f\x45\x5d\xce\x37\xa7\xb7\x32\xeb\x0a\x0e\x4f\xFF'\ - * '\FF\xFF' | sha256sum - * - * b5d2c08b1f9109ac5c67de15486f0ac267ef9501bd9f646f4ea80085cb08284c - */ -#define EXPECTED_SECRET2 \ - 0xb5, 0xd2, 0xc0, 0x8b, 0x1f, 0x91, 0x09, 0xac, 0x5c, 0x67, 0xde, \ - 0x15, 0x48, 0x6f, 0x0a, 0xc2, 0x67, 0xef, 0x95, 0x01, 0xbd, 0x9f, \ - 0x64, 0x6f, 0x4e, 0xa8, 0x00, 0x85, 0xcb, 0x08, 0x28, 0x4c -__maybe_unused static const uint8_t _EXPECTED_SECRET2[] = { - EXPECTED_SECRET2 -}; -BUILD_ASSERT(sizeof(_EXPECTED_SECRET2) == CONFIG_ROLLBACK_SECRET_SIZE); - -#define EXPECTED_UNINITIALIZED_ROLLBACK_SECRET \ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -__maybe_unused static const uint8_t -_EXPECTED_UNINITIALIZED_ROLLBACK_SECRET[] = { - EXPECTED_UNINITIALIZED_ROLLBACK_SECRET -}; -BUILD_ASSERT(sizeof(_EXPECTED_UNINITIALIZED_ROLLBACK_SECRET) == - CONFIG_ROLLBACK_SECRET_SIZE); - -test_static void print_rollback(const struct rollback_data *rb_data) -{ - int i; - - ccprintf("rollback secret: 0x"); - for (i = 0; i < sizeof(rb_data->secret); i++) - ccprintf("%02x", rb_data->secret[i]); - ccprintf("\n"); - - ccprintf("rollback id: %d\n", rb_data->id); - ccprintf("rollback cookie: %0x\n", rb_data->cookie); - ccprintf("rollback_min_version: %d\n", rb_data->rollback_min_version); -} - -test_static int check_equal(const struct rollback_data *actual, - const struct rollback_data *expected) -{ - int rv = memcmp(actual->secret, expected->secret, - sizeof(*actual->secret)); - TEST_EQ(rv, 0, "%d"); - TEST_EQ(actual->rollback_min_version, expected->rollback_min_version, - "%d"); - TEST_EQ(actual->id, expected->id, "%d"); - TEST_EQ(actual->cookie, expected->cookie, "%d"); - return EC_SUCCESS; -} - -test_static int test_add_entropy(void) -{ - int rv; - struct rollback_data rb_data; - - const struct rollback_data expected_empty = { - .id = 0, - .rollback_min_version = 0, - .secret = { 0 }, - .cookie = VALID_ROLLBACK_COOKIE - }; - - const struct rollback_data expected_uninitialized = { - .id = -1, - .rollback_min_version = -1, - .secret = { EXPECTED_UNINITIALIZED_ROLLBACK_SECRET }, - .cookie = UNINITIALIZED_ROLLBACK_COOKIE - }; - - const struct rollback_data expected_secret = { - .id = 1, - .rollback_min_version = 0, - .secret = { EXPECTED_SECRET }, - .cookie = VALID_ROLLBACK_COOKIE - }; - - const struct rollback_data expected_secret2 = { - .id = 2, - .rollback_min_version = 0, - .secret = { EXPECTED_SECRET2 }, - .cookie = VALID_ROLLBACK_COOKIE - }; - - if (system_get_image_copy() != EC_IMAGE_RO) { - ccprintf("This test is only works when running RO\n"); - return EC_ERROR_UNKNOWN; - } - - /* - * After flashing both rollback regions will be uninitialized (all - * 0xFF). During the boot process, we expect region 0 to be initialized - * by the call to rollback_get_minimum_version(). - */ - rv = read_rollback(0, &rb_data); - TEST_EQ(rv, EC_SUCCESS, "%d"); - TEST_EQ(check_equal(&rb_data, &expected_empty), EC_SUCCESS, "%d"); - - /* Immediately after boot region 1 should not yet be initialized. */ - rv = read_rollback(1, &rb_data); - TEST_EQ(rv, EC_SUCCESS, "%d"); - TEST_EQ(check_equal(&rb_data, &expected_uninitialized), EC_SUCCESS, "%d"); - - /* - * Add entropy. The result should end up being written to the unused - * region (region 1). - */ - if (IS_ENABLED(SECTION_IS_RO)) { - rv = rollback_add_entropy(FAKE_ENTROPY, sizeof(FAKE_ENTROPY)); - TEST_EQ(rv, EC_SUCCESS, "%d"); - } - - /* Validate that region 1 has been updated correctly. */ - rv = read_rollback(1, &rb_data); - TEST_EQ(rv, EC_SUCCESS, "%d"); - TEST_EQ(check_equal(&rb_data, &expected_secret), EC_SUCCESS, "%d"); - - /* Validate that region 0 has not changed. */ - rv = read_rollback(0, &rb_data); - TEST_EQ(rv, EC_SUCCESS, "%d"); - TEST_EQ(check_equal(&rb_data, &expected_empty), EC_SUCCESS, "%d"); - - /* - * Add more entropy. The result should now end up being written to - * region 0. - */ - if (IS_ENABLED(SECTION_IS_RO)) { - rv = rollback_add_entropy(FAKE_ENTROPY, sizeof(FAKE_ENTROPY)); - TEST_EQ(rv, EC_SUCCESS, "%d"); - } - - /* Check region 0. */ - rv = read_rollback(0, &rb_data); - TEST_EQ(rv, EC_SUCCESS, "%d"); - TEST_EQ(check_equal(&rb_data, &expected_secret2), EC_SUCCESS, "%d"); - - /* Check region 1 has not changed. */ - rv = read_rollback(1, &rb_data); - TEST_EQ(rv, EC_SUCCESS, "%d"); - TEST_EQ(check_equal(&rb_data, &expected_secret), EC_SUCCESS, "%d"); - - return rv; -} - -void run_test(int argc, char **argv) -{ - ccprintf("Running rollback_entropy test\n"); - RUN_TEST(test_add_entropy); - test_print_result(); -} diff --git a/test/rollback_entropy.tasklist b/test/rollback_entropy.tasklist deleted file mode 100644 index 51734f058d..0000000000 --- a/test/rollback_entropy.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2020 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* no tasks */ diff --git a/test/rsa.c b/test/rsa.c deleted file mode 100644 index 7170e2ff15..0000000000 --- a/test/rsa.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright 2016 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. - * - * Tests RSA implementation. - */ - -#include "console.h" -#include "common.h" -#include "rsa.h" -#include "test_util.h" -#include "util.h" - -#ifdef TEST_RSA3 -#if CONFIG_RSA_KEY_SIZE == 3072 -#include "rsa3072-3.h" -#else -#include "rsa2048-3.h" -#endif -#else -#include "rsa2048-F4.h" -#endif - -static uint32_t rsa_workbuf[3 * RSANUMBYTES/4]; - -void run_test(int argc, char **argv) -{ - int good; - - good = rsa_verify(rsa_key, sig, hash, rsa_workbuf); - if (!good) { - ccprintf("RSA verify FAILED\n"); - test_fail(); - return; - } - ccprintf("RSA verify OK\n"); - - /* Test with a wrong hash */ - good = rsa_verify(rsa_key, sig, hash_wrong, rsa_workbuf); - if (good) { - ccprintf("RSA verify OK (expected fail)\n"); - test_fail(); - return; - } - ccprintf("RSA verify FAILED (as expected)\n"); - - /* Test with a wrong signature */ - good = rsa_verify(rsa_key, sig+1, hash, rsa_workbuf); - if (good) { - ccprintf("RSA verify OK (expected fail)\n"); - test_fail(); - return; - } - ccprintf("RSA verify FAILED (as expected)\n"); - - test_pass(); -} - diff --git a/test/rsa.tasklist b/test/rsa.tasklist deleted file mode 100644 index f46a2eaa1d..0000000000 --- a/test/rsa.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2016 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST diff --git a/test/rsa2048-3.h b/test/rsa2048-3.h deleted file mode 100644 index d1b15c15a4..0000000000 --- a/test/rsa2048-3.h +++ /dev/null @@ -1,111 +0,0 @@ -/* Copyright 2016 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. - * - * RSA 2048 with 3 exponent public key and verification. - * Private key in rsa2048-3.pem. - */ - -/* First generate a key: - * # openssl genrsa -3 -out key.pem 2048 - * # openssl rsa -in key.pem -pubout > key.pub - * Then dump the key: - * # dumpRSAPublicKey -pub key.pub | xxd -i - */ -const uint8_t rsa_data[] = { - 0x40, 0x00, 0x00, 0x00, 0x0f, 0x46, 0xe8, 0x2c, 0x11, 0x17, 0x38, 0xfd, - 0xef, 0xa2, 0xb5, 0x2d, 0x6d, 0x76, 0xe1, 0x70, 0x7d, 0x67, 0xb1, 0x9a, - 0x18, 0x78, 0x90, 0xe2, 0xce, 0xa6, 0x81, 0xa0, 0x13, 0x37, 0xf2, 0x71, - 0xf0, 0x44, 0x96, 0xaf, 0x52, 0x53, 0xd4, 0x23, 0x51, 0x19, 0xe5, 0xb0, - 0x6d, 0x95, 0x99, 0x11, 0x88, 0x5c, 0xed, 0x52, 0x62, 0x07, 0xa6, 0x02, - 0xc6, 0xba, 0x48, 0xae, 0x78, 0xd9, 0xfb, 0x73, 0x7a, 0x33, 0xfe, 0x8b, - 0xe5, 0x38, 0xf6, 0x8b, 0xa1, 0x3f, 0x1d, 0xe1, 0xfc, 0xae, 0x19, 0xf1, - 0x80, 0x94, 0x06, 0xfc, 0x44, 0x69, 0x3c, 0xec, 0xb2, 0xf0, 0x29, 0x9a, - 0x97, 0x09, 0x81, 0x88, 0x1a, 0x56, 0x2e, 0xcb, 0xf9, 0x0b, 0x08, 0x5c, - 0xd3, 0x44, 0x6a, 0xce, 0xe2, 0xbc, 0x71, 0x03, 0x93, 0x0b, 0x80, 0x0e, - 0x12, 0x4c, 0x25, 0x61, 0x97, 0x15, 0x8a, 0x91, 0x37, 0x1e, 0x63, 0x35, - 0x83, 0xa0, 0xb8, 0xbb, 0x07, 0x80, 0x7f, 0xbf, 0x2c, 0x1e, 0xab, 0xeb, - 0xfb, 0x3d, 0x2c, 0xe7, 0xee, 0x32, 0xca, 0x7f, 0x9b, 0xe5, 0xf7, 0x04, - 0xcc, 0xd5, 0xc9, 0x99, 0x55, 0xd2, 0xdb, 0xe5, 0x27, 0x70, 0xac, 0x1a, - 0x81, 0x07, 0xff, 0x99, 0x5f, 0x34, 0x6a, 0x91, 0x5a, 0xb3, 0x3a, 0x37, - 0xef, 0x61, 0xd4, 0xab, 0xf2, 0x90, 0x98, 0x9a, 0xf7, 0x35, 0x73, 0x93, - 0x64, 0xf1, 0x27, 0x3f, 0x9a, 0x52, 0xa6, 0x91, 0x89, 0xb0, 0x5e, 0x70, - 0x4c, 0x7e, 0x9e, 0x80, 0x50, 0x2a, 0x25, 0x78, 0xea, 0x6d, 0xad, 0x96, - 0x04, 0x45, 0x92, 0xaa, 0x03, 0x6f, 0xec, 0x31, 0xbf, 0x82, 0x4b, 0x4e, - 0xb5, 0xf2, 0xc2, 0x0b, 0x88, 0x0a, 0x26, 0xac, 0x2e, 0x02, 0x08, 0x38, - 0xce, 0xbd, 0x12, 0xd0, 0x1b, 0x6a, 0x82, 0xe2, 0xe9, 0xb2, 0x9a, 0x3c, - 0x1f, 0x61, 0xa0, 0xac, 0xa6, 0x8d, 0x49, 0x60, 0xd6, 0xf5, 0x65, 0xda, - 0xde, 0x9e, 0xda, 0x20, 0x67, 0x58, 0x0f, 0xd8, 0x71, 0xd4, 0x21, 0xf5, - 0xef, 0x64, 0x91, 0x14, 0x1b, 0xc2, 0x2d, 0x8f, 0x5f, 0xa2, 0x09, 0xc4, - 0x82, 0x7f, 0x3a, 0xca, 0xef, 0x5a, 0x12, 0x20, 0x0e, 0x68, 0x36, 0xf1, - 0xe0, 0xa2, 0x03, 0x90, 0x68, 0x67, 0xdc, 0x6c, 0x44, 0x41, 0xc7, 0x49, - 0xad, 0xa3, 0x93, 0xe7, 0xa3, 0xa1, 0x88, 0xd9, 0xf6, 0x14, 0x2d, 0x8a, - 0xc2, 0x8f, 0xb9, 0x14, 0x06, 0xdc, 0x14, 0xd1, 0xe2, 0xf6, 0x04, 0x0b, - 0x24, 0x42, 0x24, 0x8a, 0x2e, 0x09, 0x02, 0xeb, 0x55, 0x62, 0x57, 0x67, - 0x34, 0xf0, 0xa4, 0x30, 0xb3, 0x06, 0xd9, 0xa3, 0x6c, 0xf3, 0x1f, 0x5f, - 0x8f, 0x36, 0x82, 0x3c, 0x12, 0x97, 0x6a, 0xff, 0x84, 0xcd, 0x98, 0x88, - 0xad, 0xc2, 0xa0, 0xcc, 0xea, 0x33, 0x7a, 0xc3, 0x7d, 0x29, 0x90, 0x1e, - 0xd0, 0x3e, 0x2e, 0x0f, 0xa1, 0xc1, 0x16, 0x46, 0x1c, 0xcd, 0xb0, 0x4e, - 0x44, 0x61, 0xa2, 0x77, 0x25, 0x40, 0xba, 0xe6, 0x89, 0xf8, 0xba, 0x5d, - 0xe0, 0x4b, 0x6d, 0x8c, 0xe4, 0xe7, 0xf0, 0x5f, 0x13, 0x25, 0x51, 0x72, - 0x3b, 0xeb, 0x32, 0xaf, 0x80, 0xde, 0xa6, 0x20, 0x63, 0x38, 0x43, 0x10, - 0xf7, 0x8e, 0xfb, 0xd3, 0x06, 0xf9, 0x51, 0x98, 0xf8, 0xc1, 0x62, 0x0d, - 0x23, 0x2b, 0x66, 0xd9, 0xe7, 0xd5, 0x03, 0xbb, 0xee, 0x36, 0xde, 0x5c, - 0xd8, 0x22, 0x7c, 0x4b, 0xf9, 0x26, 0x63, 0x96, 0x6a, 0x4c, 0x9b, 0x59, - 0xd0, 0xf2, 0xc4, 0xf8, 0x79, 0xf5, 0x43, 0x9b, 0xdf, 0x26, 0xeb, 0x2e, - 0x80, 0xe2, 0x27, 0x9e, 0xd3, 0xa5, 0x45, 0x37, 0x4c, 0xbd, 0xf9, 0xb0, - 0x23, 0xa1, 0x21, 0x4e, 0x1f, 0x6e, 0xdd, 0xac, 0xa6, 0x2c, 0x83, 0x61, - 0xdf, 0x8f, 0x9a, 0xfb, 0x55, 0x0a, 0x88, 0x0b, 0x0b, 0x34, 0xbd, 0x35, - 0x43, 0x2d, 0xe4, 0x49, -}; - -const struct rsa_public_key *rsa_key = (struct rsa_public_key *)rsa_data; -BUILD_ASSERT(sizeof(*rsa_key) == sizeof(rsa_data)); - -/* SHA-256 sum to verify: - * # sha256sum README | sed -e 's/\(..\)/0x\1, /mg' - */ -const uint8_t hash[] = { - 0x6c, 0x5f, 0xef, 0x7f, 0x63, 0x1d, 0xb4, 0x35, 0x6c, 0xae, 0x8b, 0x2a, - 0x4e, 0xde, 0xc5, 0xeb, 0x11, 0xba, 0x1f, 0x44, 0x40, 0xb6, 0x3a, 0x52, - 0xf2, 0x70, 0xef, 0xee, 0x44, 0x4b, 0x57, 0x62 -}; - -/* Incorrect hash to test the negative case */ -const uint8_t hash_wrong[] = { - 0x61, 0x1b, 0xd2, 0x44, 0xc7, 0x18, 0xa7, 0x2d, 0x0f, 0x2d, 0x3d, 0x0f, - 0xe3, 0xb3, 0xc5, 0xe4, 0x12, 0xc2, 0x7b, 0x1e, 0x05, 0x2c, 0x6f, 0xad, - 0xc4, 0xac, 0x71, 0x55, 0xe8, 0x80, 0x5c, 0x38 -}; - -/* Generate signature using futility: - * # futility create key.pem - * # futility sign --type rwsig --prikey key.vbprik2 README README.out - * # dd skip=56 bs=1 if=README.out | xxd -i - */ -const uint8_t sig[] = { - 0xad, 0x93, 0x9d, 0x5e, 0x4b, 0x66, 0xbd, 0xaa, 0xd0, 0x31, 0x15, 0x0f, - 0x0c, 0x2c, 0x48, 0x61, 0xfc, 0x81, 0xef, 0xbf, 0x99, 0x7d, 0xc8, 0x51, - 0x78, 0x84, 0xb0, 0x7c, 0x26, 0x09, 0x5c, 0x53, 0x36, 0x8c, 0xef, 0xef, - 0x24, 0x71, 0xe8, 0xff, 0xa7, 0xac, 0x1a, 0xe3, 0xf7, 0xf3, 0x88, 0xde, - 0xc8, 0x2c, 0x13, 0x29, 0x30, 0x90, 0xf9, 0xb0, 0xbc, 0x10, 0xcc, 0x72, - 0xc7, 0xb0, 0x4c, 0x0e, 0x0c, 0x14, 0xe1, 0xca, 0x41, 0x4d, 0x3c, 0x40, - 0x8e, 0x2e, 0x45, 0x90, 0x7a, 0xb4, 0xa5, 0xd6, 0x8f, 0xf6, 0xfb, 0xef, - 0x51, 0x47, 0x60, 0x21, 0x6d, 0x6f, 0xae, 0x9b, 0xb1, 0x9b, 0x34, 0x48, - 0x21, 0x9a, 0x5e, 0x70, 0xa3, 0x52, 0xa2, 0x00, 0x11, 0x20, 0x2d, 0x2a, - 0xda, 0xc1, 0x23, 0x46, 0xbc, 0xb5, 0xa4, 0x0a, 0xec, 0x6a, 0x3a, 0xe4, - 0x96, 0x17, 0x8a, 0x69, 0xce, 0x6f, 0xb0, 0x1d, 0x24, 0xd5, 0x20, 0x03, - 0x0d, 0xe4, 0x6a, 0xf2, 0x8d, 0x19, 0x13, 0x7f, 0xd0, 0xe9, 0x51, 0xc7, - 0x9b, 0x43, 0x11, 0xb4, 0x77, 0x1c, 0xed, 0xb9, 0xf0, 0xfc, 0xc3, 0xf7, - 0x1a, 0xa0, 0x5e, 0x35, 0x2d, 0xc4, 0x35, 0x15, 0x42, 0xfa, 0x2f, 0xeb, - 0xe6, 0xc6, 0xed, 0x98, 0x42, 0x93, 0xb1, 0x26, 0x61, 0x29, 0x37, 0xee, - 0x87, 0x88, 0x7c, 0xc6, 0xa3, 0xd0, 0x5b, 0xaf, 0xb3, 0x19, 0xa1, 0x1d, - 0x5f, 0x13, 0x37, 0x58, 0x33, 0x3b, 0xa8, 0xef, 0xea, 0x17, 0x87, 0x99, - 0x43, 0xe3, 0x0a, 0x97, 0xdb, 0x8d, 0x54, 0x69, 0x33, 0x58, 0x9d, 0x2f, - 0xfc, 0x32, 0x78, 0xca, 0x3a, 0x65, 0xca, 0x8e, 0x9b, 0x94, 0x18, 0xaa, - 0xf0, 0x2b, 0x97, 0xcc, 0xa9, 0xd2, 0xd0, 0x8c, 0x73, 0xd6, 0x82, 0x99, - 0xac, 0x07, 0x74, 0x47, 0x6e, 0x4c, 0x7b, 0xf9, 0x18, 0xf6, 0x13, 0x50, - 0x9e, 0xea, 0xc7, 0x1c, - /* Padding */ - 0x00 -}; diff --git a/test/rsa2048-3.pem b/test/rsa2048-3.pem deleted file mode 100644 index 0f89ecf9d3..0000000000 --- a/test/rsa2048-3.pem +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEA2mX11mBJjaasoGEfPJqy6eKCahvQEr3OOAgCLqwmCogLwvK1 -TkuCvzHsbwOqkkUElq1t6nglKlCAnn5McF6wiZGmUpo/J/Fkk3M195qYkPKr1GHv -NzqzWpFqNF+Z/weBGqxwJ+Xb0lWZydXMBPflm3/KMu7nLD3766seLL9/gAe7uKCD -NWMeN5GKFZdhJUwSDoALkwNxvOLOakTTXAgL+csuVhqIgQmXminwsuw8aUT8BpSA -8Rmu/OEdP6GL9jjli/4zenP72XiuSLrGAqYHYlLtXIgRmZVtsOUZUSPUU1KvlkTw -cfI3E6CBps7ikHgYmrFnfXDhdm0ttaLv/TgXEQIBAwKCAQEAkZlOjurbs8RzFZYU -0xHMm+xW8WfgDH6JerABdHLEBwVdLKHONDJXKiFISgJxttitucjz8aVuHDWrFFQy -9ZR1sQvENxF/b/ZDDPd5T7xltfcdOEFKJNHM5wucIupmqgUAvHL1b+6SjDkRMTky -rfqZElUxd0nvctP9R8dpcypVAAPsiicMqUCbqLyc+fovk8ooQ752pNZBYGI6VwgE -PgXq2ltM/MAyZmH98R2/uSHTqa3kN5oYv36XnMwJ7LkMrZnipNcEKg+In3EGFhoF -hiRGh4EFQd0yGx68Lq1DX5BhjZjDsDeAiKzSk2jJwcmr679cYokFfTj7zv2QtyEp -rfeqSwKBgQDtpNcRRTuTkZEcmBiI6s8wtNtREo5l+ciGzB+IWXzp6UhRECYAEK6C -hnlT6kLivQhHKyWMfn/ziXvqoduB8iU2Q8YWo8vjzLzhHAsnlq7fQx/IB5ShbRAc -OiIfloAQbNpVfIpbGY1pbvlccuWmPn3KBfTTnx1vZLcTbkMvwFAevQKBgQDrRI7e -8kahKOWCBoeQ3M2k9AcIiTOpsobwG5lEpYJByPnpytQ81sgYKgP9MvacLbfeiAfP -U1vYCDMjurB2/6zbUPWWl5DLHZJEC4iWIsC+U/GdcielA9c3ML8Uq0sxkhM0kWdU -i2GRx4n2kTq6cFtEAO8Lon34WznBNK4Bt/R45QKBgQCebeS2Lie3tmC9ursF8d91 -zeeLYbRD+9sEiBUFkP3xRjA2CsQACx8BrvuNRtdB01raHMOy/v/3sP1HFpJWoW4k -LS65woftMyiWErIaZHSU12qFWmMWSLVoJsFqZFVgSJGOUwbnZl5GSfuS90PEKakx -WU3iahOfmHoM9CzKgDVp0wKBgQCc2F8/TC8WG0OsBFpgkzPDTVoFsM0bzFn1Z7uD -GQGBMKab3I195IVlcVf+Ifm9c8/psAU04j06sCIX0cr5/8iSNfkPD7XcvmGCslsO -wdXUN/Zo9sUYrTokyyoNx4d2YWIjC5o4XOu2hQakYNHRoDzYAJ9dFv6lkiaAzclW -eqL7QwKBgDgfnTj3blHv+u9PmxcStiP2LAh53fXutbqzkRTJ4y+Dzoi2NHrn0+uF -LL61l2UDg+s/0oACZtaMV1Iqf/LdCEEb1IONE1OL6vm3WuKLB/QY82apnufP+TA5 -OujowZYvaIllZ2ujwPJ14t/XbFzBiaioLlPwIzyh5DFKA1hZJxSU ------END RSA PRIVATE KEY----- diff --git a/test/rsa2048-F4.h b/test/rsa2048-F4.h deleted file mode 100644 index afe66a198f..0000000000 --- a/test/rsa2048-F4.h +++ /dev/null @@ -1,111 +0,0 @@ -/* Copyright 2016 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. - * - * RSA 2048 with F4 exponent public key and verification. - * Private key in rsa2048-F4.pem. - */ - -/* First generate a key: - * # openssl genrsa -out key.pem 2048 - * # openssl rsa -in key.pem -pubout > key.pub - * Then dump the key: - * # dumpRSAPublicKey -pub key.pub | xxd -i - */ -const uint8_t rsa_data[] = { - 0x40, 0x00, 0x00, 0x00, 0xeb, 0xb6, 0x8c, 0xb4, 0x3d, 0xbe, 0xa2, 0xde, - 0x0c, 0xa8, 0x6b, 0xcc, 0x1b, 0x58, 0x2e, 0x1b, 0x44, 0x3f, 0xda, 0xdb, - 0x1d, 0xe1, 0xe4, 0xfd, 0x4b, 0xc5, 0x34, 0xc9, 0x7e, 0x58, 0xfc, 0x82, - 0x6d, 0x95, 0x9f, 0x46, 0x01, 0xaf, 0x7c, 0xa1, 0x50, 0xd5, 0x9c, 0x22, - 0xe1, 0x04, 0xcb, 0x41, 0x9a, 0xc4, 0xfe, 0xfa, 0xb6, 0x67, 0x89, 0x0f, - 0xe5, 0x59, 0xa0, 0xd4, 0x55, 0xb3, 0xb1, 0x6f, 0x06, 0x28, 0x68, 0x1b, - 0x0e, 0x25, 0x97, 0x47, 0xc6, 0xbe, 0x46, 0x14, 0x60, 0x77, 0x11, 0x46, - 0xe2, 0x0c, 0x20, 0x59, 0x8c, 0x95, 0x87, 0x62, 0xe8, 0x05, 0xa9, 0xaf, - 0x53, 0xab, 0x19, 0xca, 0xc0, 0xf4, 0x41, 0x05, 0x95, 0x3a, 0x6f, 0xd0, - 0xdd, 0x87, 0xa7, 0xad, 0xcb, 0x5a, 0x43, 0x86, 0xb4, 0xf4, 0xe9, 0x45, - 0x2a, 0x50, 0xe9, 0xe0, 0xf3, 0x16, 0x29, 0x87, 0xd9, 0xec, 0xc5, 0x48, - 0xee, 0xf3, 0x53, 0xec, 0x18, 0x7f, 0x46, 0xdd, 0x4b, 0xb9, 0xf9, 0x4b, - 0xcd, 0xe4, 0x2a, 0xc8, 0x7d, 0x1a, 0x5e, 0x58, 0x8b, 0x55, 0xf8, 0xed, - 0x4d, 0x65, 0xc0, 0x4a, 0x8e, 0x27, 0x2f, 0x97, 0x82, 0x2f, 0x86, 0x69, - 0xcf, 0xde, 0x00, 0x95, 0x0e, 0x90, 0x39, 0x12, 0x3e, 0x69, 0x2b, 0x7f, - 0xd4, 0xc2, 0xb0, 0x4b, 0x89, 0x41, 0xb2, 0x8f, 0xb7, 0xfb, 0xed, 0xf3, - 0x13, 0x1d, 0xb5, 0x01, 0x10, 0x00, 0xdf, 0x3a, 0xbe, 0x0d, 0x1f, 0x12, - 0xd8, 0x9c, 0xeb, 0x30, 0xfa, 0x7e, 0x57, 0xde, 0x95, 0x7e, 0xdf, 0x06, - 0x9f, 0x7e, 0x08, 0xfc, 0x4f, 0xd4, 0xfa, 0x8f, 0x9a, 0x8a, 0xc8, 0x03, - 0xe7, 0xf2, 0xd0, 0x8e, 0x35, 0xb7, 0x33, 0x67, 0x02, 0x77, 0x1e, 0x8f, - 0xe9, 0xc8, 0x80, 0x35, 0x6d, 0x24, 0xa2, 0xf9, 0x1c, 0x05, 0xd8, 0x1e, - 0x79, 0x07, 0x7e, 0xd4, 0x48, 0xb8, 0x95, 0xfd, 0xf8, 0xb4, 0x0b, 0xd6, - 0x29, 0x86, 0xb1, 0x7e, 0xbe, 0xf4, 0xe6, 0xfb, 0x24, 0x62, 0xf1, 0x00, - 0x1c, 0xf1, 0x4a, 0x33, 0xea, 0x90, 0xf9, 0xbc, 0x5d, 0x4a, 0xf1, 0x6b, - 0x07, 0xfe, 0x77, 0x62, 0x60, 0x83, 0xc2, 0x22, 0x54, 0xfa, 0x94, 0xf9, - 0x59, 0x48, 0x62, 0x02, 0xd4, 0x97, 0x53, 0x3e, 0xfb, 0xfc, 0x06, 0x63, - 0xf7, 0x28, 0x75, 0x34, 0x2c, 0xac, 0x98, 0xae, 0x8b, 0x78, 0xbd, 0x3c, - 0x94, 0x58, 0x40, 0xdf, 0x8e, 0xec, 0x13, 0xcd, 0xe7, 0x20, 0xb8, 0x84, - 0xda, 0xbd, 0x8e, 0x76, 0xbd, 0x1a, 0x7d, 0x3d, 0x18, 0x99, 0x91, 0x54, - 0x19, 0xbb, 0xab, 0xbe, 0xc3, 0x8c, 0x0d, 0x23, 0x0b, 0xef, 0x5f, 0x1c, - 0x49, 0xf0, 0xd1, 0x02, 0x81, 0x37, 0xc8, 0x75, 0x2e, 0xb9, 0x41, 0xf3, - 0x90, 0xc4, 0xa2, 0xdc, 0x2f, 0xa2, 0x21, 0xd0, 0x8b, 0x3b, 0x40, 0x3a, - 0xc4, 0x26, 0x7c, 0x7d, 0x7b, 0x79, 0xe2, 0x9b, 0xe3, 0xb7, 0x68, 0xd1, - 0xcf, 0xc7, 0xce, 0x8c, 0x26, 0x8f, 0x2d, 0xd0, 0x89, 0xc3, 0x18, 0xd1, - 0x07, 0x93, 0xa6, 0x1f, 0x9d, 0x13, 0x2a, 0xf2, 0xaf, 0xef, 0xbe, 0xb2, - 0x02, 0x39, 0xd8, 0xd3, 0xeb, 0xdf, 0x97, 0xe7, 0x91, 0xb2, 0xc5, 0xd0, - 0x21, 0x8f, 0xdd, 0x0c, 0x95, 0x30, 0xc0, 0x5b, 0xd6, 0x00, 0xd2, 0x62, - 0x71, 0x89, 0x69, 0x2b, 0x22, 0x67, 0x05, 0x67, 0x1f, 0x02, 0x57, 0x6d, - 0xc6, 0x3f, 0xed, 0xfe, 0x1f, 0x4c, 0x28, 0x7b, 0x36, 0x32, 0x3a, 0xa2, - 0x61, 0xd2, 0x7a, 0xe1, 0xfd, 0x74, 0x02, 0xe3, 0x70, 0x76, 0x02, 0x19, - 0x3a, 0x46, 0xe9, 0x86, 0x50, 0x6e, 0xce, 0x3f, 0x58, 0x0b, 0x0e, 0xef, - 0xcf, 0x5a, 0xa2, 0x66, 0x7a, 0xa2, 0x0e, 0x02, 0x56, 0x87, 0x98, 0x67, - 0x90, 0xf4, 0x9f, 0x3b, 0xf7, 0xaa, 0x1c, 0xd9, 0xda, 0x0d, 0x49, 0x12, - 0x50, 0xa3, 0x70, 0x62, -}; - -const struct rsa_public_key *rsa_key = (struct rsa_public_key *)rsa_data; -BUILD_ASSERT(sizeof(*rsa_key) == sizeof(rsa_data)); - -/* SHA-256 sum to verify: - * # sha256sum README | sed -e 's/\(..\)/0x\1, /mg' - */ -const uint8_t hash[] = { - 0x6c, 0x5f, 0xef, 0x7f, 0x63, 0x1d, 0xb4, 0x35, 0x6c, 0xae, 0x8b, 0x2a, - 0x4e, 0xde, 0xc5, 0xeb, 0x11, 0xba, 0x1f, 0x44, 0x40, 0xb6, 0x3a, 0x52, - 0xf2, 0x70, 0xef, 0xee, 0x44, 0x4b, 0x57, 0x62 -}; - -/* Incorrect hash to test the negative case */ -const uint8_t hash_wrong[] = { - 0x61, 0x1b, 0xd2, 0x44, 0xc7, 0x18, 0xa7, 0x2d, 0x0f, 0x2d, 0x3d, 0x0f, - 0xe3, 0xb3, 0xc5, 0xe4, 0x12, 0xc2, 0x7b, 0x1e, 0x05, 0x2c, 0x6f, 0xad, - 0xc4, 0xac, 0x71, 0x55, 0xe8, 0x80, 0x5c, 0x38 -}; - -/* Generate signature using futility: - * # futility create key.pem - * # futility sign --type rwsig --prikey key.vbprik2 README README.out - * # dd skip=56 bs=1 if=README.out | xxd -i - */ -const uint8_t sig[] = { - 0x1a, 0xd8, 0xa0, 0x94, 0x1f, 0x96, 0x8c, 0x40, 0x22, 0xbf, 0xb7, 0xe0, - 0x65, 0x30, 0xf8, 0xe1, 0xef, 0x9e, 0x70, 0x38, 0x02, 0xd9, 0x30, 0x10, - 0x9f, 0xf9, 0x23, 0x34, 0xd8, 0xe3, 0x04, 0xed, 0x10, 0xcb, 0xde, 0x8b, - 0xc3, 0x1e, 0x89, 0x58, 0x24, 0x90, 0xc1, 0x09, 0x3a, 0x08, 0xd9, 0x2f, - 0x5b, 0xe9, 0xbe, 0x0c, 0x23, 0xd6, 0xd0, 0x5d, 0x1e, 0x85, 0x59, 0x62, - 0xcb, 0x14, 0x76, 0x3f, 0x8f, 0xe6, 0xb9, 0xd2, 0xbd, 0x1c, 0xef, 0xd6, - 0xb0, 0x21, 0xaf, 0x3d, 0x93, 0x6d, 0x2d, 0x78, 0x31, 0x87, 0x37, 0xab, - 0xfe, 0xca, 0xe8, 0x32, 0xda, 0x86, 0x67, 0x48, 0x0e, 0xab, 0xd0, 0xdd, - 0x14, 0x39, 0xe5, 0x8e, 0x65, 0xbb, 0x28, 0xe6, 0xcd, 0xb7, 0xad, 0xbe, - 0x86, 0x95, 0xec, 0xf5, 0xc0, 0x00, 0x45, 0x92, 0x3d, 0x67, 0xd7, 0xb6, - 0x30, 0x60, 0x6c, 0x6d, 0x86, 0xb5, 0xb5, 0x97, 0xe7, 0x52, 0xca, 0xa4, - 0x21, 0xae, 0x48, 0xf9, 0x4a, 0xc8, 0xad, 0xeb, 0xd6, 0x0b, 0xa4, 0x58, - 0x61, 0xf2, 0xaf, 0xbc, 0x2a, 0xe6, 0xd7, 0x78, 0x23, 0x66, 0x9c, 0x12, - 0x87, 0x54, 0x30, 0x68, 0x4b, 0xdb, 0xc2, 0x66, 0xf6, 0x4b, 0x49, 0x44, - 0xbd, 0xb9, 0x1a, 0xdc, 0x71, 0x0f, 0xa4, 0x63, 0xfc, 0x56, 0x41, 0x91, - 0xe5, 0x30, 0xb6, 0xa9, 0xe6, 0x8c, 0x6f, 0x91, 0x8e, 0x36, 0xd6, 0x4d, - 0xe1, 0xdd, 0x0e, 0x1d, 0x1a, 0x71, 0x51, 0x68, 0xf6, 0xf3, 0xea, 0x74, - 0x3a, 0x5f, 0x35, 0x6a, 0x0f, 0xd4, 0x86, 0x96, 0x3e, 0x89, 0xab, 0x88, - 0x03, 0x40, 0xe2, 0x2b, 0x72, 0xa5, 0xa5, 0xf7, 0x79, 0xd0, 0x5a, 0xcb, - 0xfa, 0x40, 0x12, 0xe2, 0x0c, 0xf0, 0xfb, 0xd8, 0x9c, 0x41, 0x30, 0xab, - 0x99, 0x5d, 0x26, 0xe0, 0x6a, 0xcf, 0x0b, 0x4b, 0x4f, 0xe4, 0x85, 0xe6, - 0x8d, 0xe3, 0x11, 0xe0, - /* Padding */ - 0x00 -}; diff --git a/test/rsa2048-F4.pem b/test/rsa2048-F4.pem deleted file mode 100644 index 1662f8ebb5..0000000000 --- a/test/rsa2048-F4.pem +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEA1gu0+P2VuEjUfgd5HtgFHPmiJG01gMjpjx53AmcztzWO0PLn -A8iKmo/61E/8CH6fBt9+ld5Xfvow65zYEh8NvjrfABABtR0T8+37t4+yQYlLsMLU -fytpPhI5kA6VAN7PaYYvgpcvJ45KwGVN7fhVi1heGn3IKuTNS/m5S91GfxjsU/Pu -SMXs2YcpFvPg6VAqRen0tIZDWsutp4fd0G86lQVB9MDKGatTr6kF6GKHlYxZIAzi -RhF3YBRGvsZHlyUOG2goBm+xs1XUoFnlD4lntvr+xJpBywThIpzVUKF8rwFGn5Vt -gvxYfsk0xUv95OEd29o/RBsuWBvMa6gM3qK+PQIDAQABAoIBAAc0ca0H7Cg921k6 -qysMnm9xP7H2MxzYpnP41IyyKJ18IgiKhJguAexd+FV5M8SdboDuuPYWe998UHU9 -3FAP14iVtrfr0gLkra1CT3zIS3nFQ1T52elF7s72EhX1R7K1zUmCCMteh2nPcliz -kEH4X/jGyrQdk8VN2lM6XrBdDGhuwI6iGA+/lxc8xJAmNvpw6qPVAacv1/2af7/u -s37JD/jpyCibhMvoguRDDozeWckWNcFEhICz6fmwCUHIG48XwwWV2sHPimG1WNwb -uF6Ma5VxnUNHvNG8uAEy4437AKxBGIVVresTyfDpY2LSIpWAPag/MXEoUBBjcOTm -8L5IjMkCgYEA9cZH0rrkUEHH+OajhWO1Ca/tgICxRn5PdlYHGhFXv1va5XPZbEdL -R8s4Gth5c7jLqjehbfOv8p070oz1KMYsrjO+WpZbxmTzse1TzHEaZhwfdt09+y+v -43dKZgMoj1whlILOWw39cS9jrbh7YWLeAYydwy2/V8pw/7MVFY0a2gsCgYEA3vN8 -cpudgrv4TnyVKJ388hSEwMVp2wompfou5toumlOnGosnQvcgXBt0EsJJUiD9KYOo -wQDeExTGAkHntcU2VJuqsO3Wn7sI8gXQbU1XUTqhqEsLftWkKj2reLe09rGYWlSw -ad5miBH4LTSO/2wZfUSxfxBaTcS7ISna9NsDPdcCgYAMQmCwxTvAORfFdZOwgqG0 -Iv9gyoqNLp2+FFp0VWsgE2/exCGTQhciNKPOyv974zrdebrmpiIfovIp9XgBGal+ -4vvavudDBSQWuvTUHMwpTbvQDQcbcWx/lyKx5fRu+jR+mOu8JP2AWNHLB4m3+NuE -DkSMSMrjkSiDyKYDli9BswKBgQCAwysKnelYSetcmQMkVCp0PXl2RA2g3bn4fgd8 -eGIV615FLDzepg9gYtKkyuTBtB/CTDG4ViHr70F0qE+EYYPBVa49RP+BfOnrrYP0 -vIhDd5NJuR3IgOaxJrDTpXW0TFlrQiIo4rNgvtAQe5xi1DHccUH52p3s8EQLITs9 -0weKPQKBgANF9UkCnISX6HeOJmvSg9dBSZlQMON3Jwk01yTH9fDxFykfip6y/RC4 -izprxpUjWJIGlAAR/nW+/gGaK0EhuCnWcmE46u0ho6ylqpkScrKQ8jPqXoZ9gqn0 -uyKzLlyv0r+jEs87SWBjKc1Lt84piq93dNrlzXkf4/zCDPif5vML ------END RSA PRIVATE KEY----- diff --git a/test/rsa3.tasklist b/test/rsa3.tasklist deleted file mode 120000 index 6cfe0ef051..0000000000 --- a/test/rsa3.tasklist +++ /dev/null @@ -1 +0,0 @@ -rsa.tasklist
\ No newline at end of file diff --git a/test/rsa3072-3.h b/test/rsa3072-3.h deleted file mode 100644 index c407a4ed2b..0000000000 --- a/test/rsa3072-3.h +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright 2020 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. - * - * RSA 3072 with 3 exponent public key and verification. - * Private key in rsa3072-3.pem. - */ - -/* First generate a key: - * # openssl genrsa -3 -out key.pem 3072 - * # openssl rsa -in key.pem -pubout > key.pub - * Then dump the key: sudo emerge vboot_reference - * # /usr/bin/dumpRSAPublicKey -pub key.pub | xxd -i - */ -const uint8_t rsa_data[] = { - 0x60, 0x00, 0x00, 0x00, 0xdd, 0x54, 0xe6, 0xe2, 0x8b, 0xdc, 0xea, 0xd2, - 0x58, 0x10, 0x72, 0xf1, 0x39, 0x2d, 0x10, 0x6e, 0x37, 0x4b, 0x19, 0x0d, - 0x0a, 0x02, 0x80, 0xdc, 0xb9, 0xee, 0xb4, 0x6b, 0xb6, 0x19, 0x73, 0x22, - 0x43, 0x09, 0x22, 0x7e, 0xf1, 0x48, 0xdd, 0xf2, 0x66, 0x12, 0x90, 0xb9, - 0x58, 0x54, 0x4b, 0xc4, 0xce, 0xf0, 0xb3, 0xbf, 0xad, 0x86, 0x1a, 0x6a, - 0x23, 0x66, 0x08, 0x10, 0x83, 0xda, 0xa3, 0xec, 0x8e, 0x36, 0x2d, 0xb2, - 0x91, 0x2c, 0xbd, 0x11, 0x2f, 0xa8, 0xdc, 0x8f, 0x52, 0x7a, 0x23, 0x58, - 0xad, 0x36, 0x9b, 0xde, 0xd6, 0x0d, 0x21, 0x1b, 0x5d, 0x7b, 0x1d, 0x51, - 0x6d, 0x7e, 0xa1, 0xca, 0x13, 0x0a, 0x11, 0x29, 0x63, 0xaa, 0x6e, 0x64, - 0x7a, 0x15, 0xa3, 0xf6, 0xed, 0xfd, 0xce, 0x5d, 0x17, 0xfb, 0x16, 0x38, - 0x55, 0x0b, 0xed, 0x6b, 0x12, 0xf9, 0xcf, 0x8b, 0xa7, 0xeb, 0x92, 0xd0, - 0x5e, 0x91, 0x91, 0x4e, 0x6e, 0x41, 0xa2, 0x88, 0x51, 0xf9, 0xf9, 0x0b, - 0x99, 0x72, 0x2e, 0xab, 0x50, 0xbb, 0xc6, 0xc0, 0x64, 0x88, 0x26, 0x7f, - 0xc1, 0x91, 0x8d, 0xe8, 0xea, 0x5a, 0x15, 0x1c, 0x0a, 0xac, 0xa3, 0x8a, - 0x8f, 0x42, 0x68, 0xc6, 0x7d, 0x3a, 0x53, 0xf6, 0x6a, 0x65, 0x7a, 0xb4, - 0x51, 0xf0, 0xce, 0xe3, 0x49, 0xd8, 0x38, 0x1a, 0x30, 0x1a, 0xd3, 0xa2, - 0x98, 0xf8, 0x53, 0x6d, 0xa2, 0x35, 0x22, 0x92, 0xd8, 0x46, 0x7b, 0x9d, - 0xc7, 0x25, 0xb6, 0xc6, 0x28, 0x12, 0x0d, 0x0d, 0x91, 0xbf, 0x9b, 0x58, - 0x73, 0xc1, 0x78, 0x39, 0xed, 0x16, 0x61, 0x90, 0x25, 0x14, 0xba, 0x9b, - 0x17, 0x4f, 0xaa, 0xf9, 0x5c, 0xfd, 0xc7, 0x18, 0xf3, 0x1d, 0xd7, 0xaa, - 0xea, 0x11, 0x18, 0xbb, 0x24, 0x3d, 0xf0, 0x57, 0x33, 0x9c, 0x23, 0x04, - 0x33, 0x81, 0xa0, 0x10, 0xc3, 0x6d, 0x12, 0xb6, 0xd0, 0xdc, 0xad, 0xd2, - 0x9c, 0x76, 0x01, 0x7a, 0x70, 0x04, 0x72, 0x29, 0xeb, 0x82, 0x60, 0x1b, - 0xea, 0x19, 0xe6, 0xdc, 0xeb, 0xec, 0xaf, 0xad, 0xce, 0xfa, 0x5b, 0xbc, - 0x81, 0x0c, 0x82, 0x19, 0xde, 0xbd, 0x65, 0xe6, 0x69, 0x1b, 0x8e, 0x38, - 0x93, 0xf3, 0x3f, 0x9f, 0x75, 0x69, 0xa9, 0x0f, 0xb7, 0x94, 0xca, 0xfd, - 0x30, 0xa9, 0x09, 0x59, 0x77, 0xd3, 0xef, 0x8d, 0x0a, 0x11, 0xfa, 0x07, - 0xd8, 0xe5, 0x35, 0x59, 0x23, 0xb5, 0x20, 0x28, 0xa7, 0x9f, 0x6d, 0xb6, - 0x18, 0x72, 0x51, 0x06, 0x02, 0xe7, 0x2b, 0xfb, 0xa5, 0x96, 0xf8, 0x8b, - 0x2d, 0xb4, 0x01, 0xd8, 0x66, 0xd0, 0x12, 0xa3, 0xd3, 0x67, 0x94, 0x37, - 0x21, 0xb4, 0xfc, 0xc5, 0x73, 0xd7, 0x77, 0x39, 0x75, 0xdd, 0xb2, 0x57, - 0x62, 0x83, 0xcd, 0x2d, 0xca, 0x8a, 0xf9, 0xd8, 0xc3, 0x00, 0xc2, 0x64, - 0x45, 0xaa, 0xaa, 0xe7, 0xf8, 0xdb, 0x9c, 0xd4, 0x33, 0x77, 0x5b, 0x55, - 0x57, 0x12, 0xcd, 0x33, 0xbe, 0x70, 0xa5, 0x78, 0x26, 0x3c, 0x56, 0xee, - 0xe3, 0xac, 0x23, 0xfe, 0x54, 0x98, 0xd6, 0x2e, 0xfe, 0xdd, 0xc4, 0x5a, - 0x23, 0xca, 0x5a, 0x22, 0xec, 0x8e, 0x36, 0x3b, 0xfb, 0x9f, 0x97, 0x7d, - 0x75, 0x37, 0xf7, 0x59, 0xef, 0x1d, 0x96, 0xad, 0x2b, 0x82, 0x19, 0x67, - 0x46, 0x7f, 0x92, 0x1f, 0xcb, 0xf0, 0xf7, 0x31, 0x72, 0x34, 0x4d, 0xdd, - 0x8b, 0x5b, 0x90, 0xe2, 0xeb, 0xdd, 0x04, 0x00, 0xde, 0x28, 0x15, 0x03, - 0x6b, 0x4e, 0x4e, 0x6b, 0x03, 0xd0, 0x54, 0x81, 0xea, 0xe4, 0x26, 0xbb, - 0x4c, 0x6f, 0x65, 0x70, 0x12, 0x6d, 0x84, 0x1d, 0x71, 0xfe, 0xc1, 0x63, - 0x1c, 0x33, 0x43, 0xcd, 0x8a, 0x92, 0xa6, 0x2d, 0xa3, 0xbd, 0xef, 0x93, - 0x39, 0x2f, 0x9b, 0xa9, 0x5c, 0x0d, 0xb9, 0x61, 0x23, 0xcf, 0x12, 0x1f, - 0x98, 0x85, 0x19, 0xa7, 0x08, 0xfc, 0xee, 0x8e, 0x79, 0x25, 0x0b, 0xed, - 0xb3, 0x72, 0xf4, 0x27, 0x9f, 0xee, 0x7b, 0x22, 0xd0, 0x6e, 0xdf, 0x4b, - 0x05, 0xef, 0xbd, 0x13, 0xb6, 0x22, 0xeb, 0x9e, 0xc5, 0x7d, 0xb6, 0x1c, - 0xfd, 0xf8, 0xc6, 0x82, 0x89, 0xd2, 0xc4, 0x01, 0xac, 0xec, 0xd5, 0xbd, - 0x2d, 0xbb, 0x09, 0x17, 0x0f, 0xd6, 0xc1, 0xb9, 0x07, 0xf0, 0xce, 0x23, - 0x81, 0x0c, 0xa9, 0x60, 0x58, 0x17, 0xbf, 0xf5, 0x14, 0xd0, 0x68, 0x33, - 0xf6, 0xc6, 0xae, 0xc3, 0xc3, 0x1f, 0x01, 0xd6, 0xae, 0xc8, 0x94, 0xba, - 0x35, 0x47, 0xa9, 0x77, 0x2b, 0x68, 0xd2, 0x75, 0x19, 0x75, 0x40, 0xce, - 0x11, 0x93, 0xaa, 0xb9, 0x09, 0x37, 0x91, 0xca, 0x83, 0x3d, 0x7a, 0xb1, - 0x03, 0x57, 0x34, 0x06, 0x37, 0x86, 0xf9, 0x64, 0xe4, 0xcf, 0x49, 0x0b, - 0x20, 0x21, 0xda, 0x0a, 0x25, 0xd4, 0x17, 0x21, 0x73, 0x39, 0xf9, 0x2f, - 0xeb, 0x81, 0x6f, 0x90, 0xea, 0x83, 0xfc, 0xc7, 0xe9, 0x44, 0xd1, 0xd2, - 0x8b, 0xc5, 0xf3, 0x1f, 0x35, 0x1c, 0xc5, 0xa3, 0x75, 0x36, 0xb7, 0x84, - 0xed, 0x67, 0xa0, 0xbd, 0xaf, 0x6b, 0x00, 0x15, 0x5a, 0x7c, 0x5c, 0xc7, - 0x95, 0x22, 0x76, 0xd9, 0x9c, 0x1f, 0xf0, 0xb2, 0x6e, 0x5b, 0xcb, 0x32, - 0x88, 0xa4, 0xc6, 0x7f, 0xfa, 0x2e, 0xc6, 0x40, 0x40, 0xa3, 0xe2, 0x57, - 0xb7, 0x08, 0xe0, 0xe9, 0x93, 0x10, 0x95, 0x70, 0x2d, 0x90, 0x0c, 0xeb, - 0x44, 0x50, 0xbc, 0xd9, 0xc7, 0xd5, 0x2b, 0x74, 0xac, 0x6e, 0x7f, 0xcf, - 0xfa, 0x8c, 0xf6, 0x76, 0x77, 0x79, 0xf8, 0xf4, 0x11, 0x8e, 0x5a, 0xe4, - 0x2c, 0xa2, 0x84, 0x56, 0xdb, 0x39, 0x54, 0x82, 0x8e, 0x85, 0x31, 0xc0, - 0x51, 0xf7, 0x6c, 0x2c, 0x5f, 0xbc, 0x63, 0x5c, 0xf3, 0x68, 0x4e, 0xa4, - 0x52, 0xc9, 0xe8, 0x06, 0xff, 0x94, 0xd3, 0xa1, -}; - -const struct rsa_public_key *rsa_key = (struct rsa_public_key *)rsa_data; -BUILD_ASSERT(sizeof(*rsa_key) == sizeof(rsa_data)); - -/* SHA-256 sum to verify: - * # sha256sum README.md | sed -e 's/\(..\)/0x\1, /mg' - */ -const uint8_t hash[] = { 0xc7, 0xc3, 0xd0, 0xa3, 0x7e, 0xbd, 0x50, 0xe8, - 0x3c, 0xb3, 0x5b, 0xed, 0x02, 0xf9, 0x8f, 0x97, - 0xf8, 0xb5, 0x23, 0x43, 0x74, 0xda, 0x0a, 0x24, - 0xdb, 0x04, 0xe4, 0x1e, 0xbd, 0x43, 0x02, 0xdc }; - -/* Incorrect hash to test the negative case */ -const uint8_t hash_wrong[] = { 0x61, 0x1b, 0xd2, 0x44, 0xc7, 0x18, 0xa7, 0x2d, - 0x0f, 0x2d, 0x3d, 0x0f, 0xe3, 0xb3, 0xc5, 0xe4, - 0x12, 0xc2, 0x7b, 0x1e, 0x05, 0x2c, 0x6f, 0xad, - 0xc4, 0xac, 0x71, 0x55, 0xe8, 0x80, 0x5c, 0x38 }; - -/* Generate signature using openssl: - * openssl dgst -sha256 -sign test/rsa3072-3.pem README.md | xxd -i - */ -const uint8_t sig[] = { - 0xb3, 0xac, 0xcb, 0x5c, 0xbc, 0x82, 0x74, 0x14, 0xce, 0x7d, 0xbd, 0x3b, - 0xc6, 0x6e, 0x2d, 0x3e, 0xfd, 0xdb, 0x76, 0xb3, 0xfe, 0xed, 0x29, 0xd6, - 0xb8, 0x20, 0x8a, 0x79, 0xf8, 0xe4, 0x1b, 0xc1, 0x99, 0x21, 0x77, 0xb0, - 0xa7, 0x49, 0xfc, 0x31, 0x70, 0xe2, 0x5c, 0xc9, 0xc4, 0xc8, 0x5b, 0xbd, - 0xf9, 0xc9, 0x81, 0x43, 0x7e, 0x16, 0x23, 0xc7, 0xb3, 0x8f, 0x95, 0xca, - 0xb2, 0x56, 0x96, 0xfc, 0x53, 0xba, 0xf3, 0x77, 0x31, 0xde, 0x69, 0x9f, - 0x2e, 0xb1, 0xc0, 0xe1, 0xb9, 0x05, 0x7a, 0xf2, 0x92, 0x9c, 0xf2, 0x0b, - 0x54, 0xa1, 0x93, 0x58, 0x52, 0x2e, 0x9b, 0x02, 0x59, 0x05, 0x67, 0xc2, - 0x8c, 0x27, 0x1d, 0xc2, 0x70, 0x2f, 0x5c, 0x4f, 0xb2, 0xb4, 0x87, 0x71, - 0x75, 0x33, 0x2d, 0x96, 0x02, 0x81, 0x80, 0x13, 0xb1, 0xff, 0x8a, 0x73, - 0x1c, 0x66, 0x54, 0xec, 0x97, 0x08, 0x4f, 0x98, 0xec, 0x01, 0xa6, 0x93, - 0x59, 0xa9, 0x16, 0x28, 0x41, 0x60, 0x83, 0xb2, 0xe1, 0xe8, 0x42, 0xf7, - 0x92, 0x96, 0x5c, 0x91, 0x06, 0xf8, 0xde, 0x45, 0x67, 0x4e, 0xef, 0xde, - 0xb5, 0x87, 0x72, 0x02, 0x5e, 0x39, 0x7a, 0xa7, 0xf2, 0x22, 0xbc, 0x10, - 0x59, 0x13, 0xfb, 0x53, 0x98, 0x99, 0x2a, 0x51, 0xc5, 0x46, 0x7e, 0xdf, - 0x6f, 0xd8, 0xbd, 0xcd, 0x0e, 0xd7, 0x00, 0x2f, 0x76, 0x17, 0x8b, 0xce, - 0x05, 0x56, 0xc2, 0xe1, 0xcd, 0x37, 0xa1, 0x2f, 0xa6, 0xc4, 0xcd, 0xd5, - 0xaf, 0x10, 0x9b, 0x1f, 0x72, 0x28, 0x14, 0x3f, 0xa1, 0x9d, 0x08, 0x7f, - 0x3d, 0x0a, 0xac, 0x80, 0x7b, 0xe3, 0x31, 0x4f, 0x9c, 0x79, 0x7c, 0x4b, - 0xd7, 0x01, 0xcc, 0x9f, 0xbd, 0x9d, 0x52, 0x84, 0xd7, 0xea, 0xf8, 0xc8, - 0xf5, 0xf3, 0x0c, 0x83, 0x5c, 0x30, 0x0c, 0x50, 0x66, 0x5f, 0xee, 0x4d, - 0x23, 0x8a, 0x32, 0x07, 0x55, 0xb1, 0xfa, 0x5e, 0x89, 0x57, 0x18, 0x24, - 0xcc, 0x20, 0x30, 0x79, 0xf0, 0x4c, 0x09, 0xe2, 0x9a, 0x34, 0xc7, 0x07, - 0xf7, 0x29, 0x3a, 0xcf, 0x38, 0x18, 0x2c, 0x53, 0x2f, 0x33, 0xca, 0x95, - 0xfc, 0x3b, 0x23, 0x75, 0xbc, 0x15, 0xac, 0x1a, 0xbd, 0xf1, 0xa5, 0x6c, - 0x3e, 0x4b, 0xc3, 0x39, 0xb2, 0x1e, 0x18, 0xf1, 0xb9, 0x28, 0xcd, 0x13, - 0x05, 0x32, 0xd5, 0x46, 0x3e, 0x9b, 0x55, 0x9f, 0x13, 0xe3, 0x5d, 0x53, - 0x6a, 0xa8, 0x93, 0x33, 0xbb, 0x78, 0x1d, 0x3a, 0xeb, 0xbd, 0x3d, 0x2e, - 0xd1, 0xdc, 0x1c, 0xb6, 0x76, 0x6f, 0x29, 0x9f, 0x9f, 0x59, 0x23, 0x45, - 0xcc, 0x80, 0x23, 0xd7, 0x51, 0x06, 0xc8, 0x72, 0x94, 0x3a, 0xf8, 0x14, - 0x4d, 0x76, 0x2d, 0x59, 0x3c, 0xd7, 0x4e, 0x17, 0x52, 0xad, 0x1a, 0xe4, - 0xa9, 0xfb, 0x09, 0xc8, 0xb4, 0x28, 0x0b, 0x7d, 0xa8, 0x0a, 0x71, 0x81, - /* Padding */ - 0x00 -}; diff --git a/test/rsa3072-3.pem b/test/rsa3072-3.pem deleted file mode 100644 index 78fbce265e..0000000000 --- a/test/rsa3072-3.pem +++ /dev/null @@ -1,39 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIG4wIBAAKCAYEA1Jzb+OeqqkVkwgDD2PmKyi3Ng2JXst11OXfXc8X8tCE3lGfT -oxLQZtgBtC2L+Jal+yvnAgZRchi2bZ+nKCC1I1k15dgH+hEKje/Td1kJqTD9ypS3 -D6lpdZ8/85M4jhtp5mW93hmCDIG8W/rOra/s69zmGeobYILrKXIEcHoBdpzSrdzQ -thJtwxCggTMEI5wzV/A9JLsYEeqq1x3zGMf9XPmqTxebuhQlkGEW7Tl4wXNYm7+R -DQ0SKMa2Jcede0bYkiI1om1T+Jii0xowGjjYSePO8FG0emVq9lM6fcZoQo+Ko6wK -HBVa6uiNkcF/JohkwMa7UKsucpkL+flRiKJBbk6RkV7Qkuuni8/5EmvtC1U4FvsX -Xc797fajFXpkbqpjKREKE8qhfm1RHXtdGyEN1t6bNq1YI3pSj9yoLxG9LJGyLTaO -7KPagxAIZiNqGoatv7PwzsRLVFi5kBJm8t1I8X4iCUMicxm2a7TuudyAAgoNGUs3 -bhAtOfFyEFjS6tyLAgEDAoIBgQCNvef7RRxxg5iBVdfl+7HcHokCQY/Mk6N7pTpN -Lqh4FiUNmo0XYeBEkAEiyQf7DxlSHUSsBDZMEHmeam9wFc4XkM6ZOq/8C1xen+JP -kLEbdf6HDc9fxkZOaiqiYiW0EkaZmSk+u6wIVn2SpzRzyp3yk0QRRrzrAfIboVhK -/AD5veHJPeB5YZ6CCxWrd1gXvXeP9X4YfLq2nHHkvqIQhVOTURw0umfRYsO1lg9I -0PsrojsSf7YIs2FwhHluhROnhI8qFy2Va0j/5ypoKtWitNOUb2K//I/E5a8s7N86 -GhG0Vn0iolTxgJfj5kI0/5B5jXRYrLCvOJvnmOL6rbR1HPOmSC62VorgvsF3ExXh -Z+9mpjMjDdHZAZRLpr8Toj7nZabbIGZMfLFFutSvVXSvhNPezKeREJ3uS65E0oeK -Vl3qi5IZA02X7WrlYJYop7HGH/ZSqR+iIIJEHhYhLt5oST3XZ3cSEUTupyWE1cxm -2HBkuUULO8eIo9CmLEnLxUUjZlsCgcEA8yLuYy3pfAdUOJulycDHuTjN4BAsqXLV -lpO/6Cq+jeNzChobcpWWUsx0E3gjaUfRTEEuSoHo/oHUIFjOGdv1VdsZjXIh0RS+ -3ltf2zMHoTwnsHIDrAIdyLMEylDQXefpKsievPj8YJx180/ZUcmaCV2s0YL//vxg -moL3ynXkQQhHSbwz+TSEOkdU5r6G1TNiJnup3W3+elB7zmyU4yFboNC5P1clLiVM -9InAq1mLn2CP9GCqtJTnU1ij55929C8NAoHBAN/cgt8efPy2jv4+Sdxo0zID7PBG -sCmaDpxcK750jyYqW+Webz8+4MJCti7KAwbsZO+Cg/9UW5ix42Gb9L8a3p8HMfJq -3nC4xnrX+GUc/lAfw7H0WOxKgbPJf622NbWp/7WX0eQWmzU4nCMrVMIQNf9N8wuR -az8MbI4d5RUaTAu4D731Zo+LNfC30kJpWJwjWh06l34liXPbHI/fhHNOEI2SNi7S -Fd75sS/qe3Q+S8uTlZQQ4WyFjO1WX3cRdEGT9wKBwQCiF0mXc/D9WjglvRkxKy/Q -0IlACshw9zkPDSqaxymz7PdcEWehuQ7h3aK3pWzw2ouIK3Qxq/Cpq+LAOzQRPU45 -PLuzoWvguH8+55U8zK/A0sUgTAJyrBPbIgMxizWT7/DHMGnTUKhAaE6iNTuL27wG -PnM2V1VUqEBnAfqG+ULWBYTb0s1Qza18L43vKa84zOwZp8aTnqmm4FKJnbiXa5Jr -NdDU5MN0GN34W9XHkQe/lbVNlccjDe+M5cKaak9NdLMCgcEAlT2slL79/c8J/tQx -PZs3dq1IoC8gG7wJvZLH1E20xBw9Q7701NSV1tckHzFXWfLt9QGtVOLnuyFCQRKj -KhHpv1ohTEc+9dCEUeVQQ2ipir/Xy/g7SDGrzTD/ySQjznFVI7qL7WRneNBoF3I4 -gWAj/4lMsmDyKghIXr6YuLwysnq1KU5EX7Ij9c/hgZuQaBeRaNG6VBkGTTy9tT+t -ojQLCQwkHza5P1EgypxSTX7dMmJjuAtA8wOzSOQ/pLZNgQ1PAoHAbZMZo5yF+yzC -Ofu/Wq38ftt3KGzaiN+xwPu8MG8jFLNnQXCpI+qiszBK0lkS3W/yPlouUYJXfbec -LCp/z+lfUe5glm7AUxvuSZ63ZBTx8q/Vgl7490mzFzOSoL5iBtnq3qzwGHWfM0au -h3hlTdBpYnuIGqcU910JsJ3tdzcLoJe9OaihQrgBudGftAr9nm3uuvLtVRuHSAP1 -m6u+qq5Ae/0ejhJWnyPcYE4Gnv4JWLRYywBT0WpdSNiV/3aAPoq3 ------END RSA PRIVATE KEY----- diff --git a/test/rtc.c b/test/rtc.c deleted file mode 100644 index 3e53f85611..0000000000 --- a/test/rtc.c +++ /dev/null @@ -1,104 +0,0 @@ -/* Copyright 2017 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. - * - * Tests for rtc time conversions - */ - -#include "console.h" -#include "common.h" -#include "rtc.h" -#include "test_util.h" -#include "util.h" - -/* Known conversion pairs of date and epoch time. */ -static struct { - struct calendar_date time; - uint32_t sec; -} test_case[] = { - {{8, 3, 1}, 1204329600}, - {{17, 10, 1}, 1506816000}, -}; - -static int calendar_time_comp(struct calendar_date time_1, - struct calendar_date time_2) -{ - return (time_1.year == time_2.year && - time_1.month == time_2.month && - time_1.day == time_2.day); -} - -static int test_time_conversion(void) -{ - struct calendar_date time_1; - struct calendar_date time_2; - uint32_t sec; - int i; - - /* The seconds elapsed from 01-01-1970 to 01-01-2000 */ - sec = SECS_TILL_YEAR_2K; - time_1.year = 0; - time_1.month = 1; - time_1.day = 1; - - /* Test from year 2000 to 2050 */ - for (i = 0; i <= 50; i++) { - /* Test Jan. 1 */ - time_1.year = i; - time_1.month = 1; - time_1.day = 1; - - TEST_ASSERT(date_to_sec(time_1) == sec); - time_2 = sec_to_date(sec); - TEST_ASSERT(calendar_time_comp(time_1, time_2)); - - /* Test the day boundary between Jan. 1 and Jan. 2 */ - time_2 = sec_to_date(sec + SECS_PER_DAY - 1); - TEST_ASSERT(calendar_time_comp(time_1, time_2)); - - time_1.day = 2; - - TEST_ASSERT(date_to_sec(time_1) == sec + SECS_PER_DAY); - time_2 = sec_to_date(sec + SECS_PER_DAY); - TEST_ASSERT(calendar_time_comp(time_1, time_2)); - - /* - * Test the month boundary and leap year: - * Is the 60th day of a year Mar. 1 or Feb. 29? - */ - time_2 = sec_to_date(sec + 59 * SECS_PER_DAY); - if (IS_LEAP_YEAR(i)) - TEST_ASSERT(time_2.month == 2 && time_2.day == 29); - else - TEST_ASSERT(time_2.month == 3 && time_2.day == 1); - - /* Test the year boundary on Dec. 31 */ - sec += SECS_PER_YEAR - (IS_LEAP_YEAR(i) ? 0 : SECS_PER_DAY); - time_1.month = 12; - time_1.day = 31; - - TEST_ASSERT(date_to_sec(time_1) == sec); - time_2 = sec_to_date(sec); - TEST_ASSERT(calendar_time_comp(time_1, time_2)); - - sec += SECS_PER_DAY; - time_2 = sec_to_date(sec - 1); - TEST_ASSERT(calendar_time_comp(time_1, time_2)); - } - - /* Verify known test cases */ - for (i = 0; i < ARRAY_SIZE(test_case); i++) { - TEST_ASSERT(date_to_sec(test_case[i].time) == test_case[i].sec); - time_1 = sec_to_date(test_case[i].sec); - TEST_ASSERT(calendar_time_comp(time_1, test_case[i].time)); - } - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - RUN_TEST(test_time_conversion); - - test_print_result(); -} diff --git a/test/rtc.tasklist b/test/rtc.tasklist deleted file mode 100644 index 80072bb620..0000000000 --- a/test/rtc.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2017 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST diff --git a/test/run_device_tests.py b/test/run_device_tests.py deleted file mode 100755 index 8207f83f66..0000000000 --- a/test/run_device_tests.py +++ /dev/null @@ -1,519 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright 2020 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. - -"""Runs unit tests on device and displays the results. - -This script assumes you have a ~/.servodrc config file with a line that -corresponds to the board being tested. - -See https://chromium.googlesource.com/chromiumos/third_party/hdctools/+/HEAD/docs/servo.md#servodrc -""" -import argparse -import concurrent -import io -import logging -import os -import re -import subprocess -import sys -import time -from concurrent.futures.thread import ThreadPoolExecutor -from enum import Enum -from pathlib import Path -from typing import Optional, BinaryIO, List - -import colorama # type: ignore[import] - -EC_DIR = Path(os.path.dirname(os.path.realpath(__file__))).parent -JTRACE_FLASH_SCRIPT = os.path.join(EC_DIR, 'util/flash_jlink.py') -SERVO_MICRO_FLASH_SCRIPT = os.path.join(EC_DIR, 'util/flash_ec') - -ALL_TESTS_PASSED_REGEX = re.compile(r'Pass!\r\n') -ALL_TESTS_FAILED_REGEX = re.compile(r'Fail! \(\d+ tests\)\r\n') - -SINGLE_CHECK_PASSED_REGEX = re.compile(r'Pass: .*') -SINGLE_CHECK_FAILED_REGEX = re.compile(r'.*failed:.*') - -ASSERTION_FAILURE_REGEX = re.compile(r'ASSERTION FAILURE.*') - -DATA_ACCESS_VIOLATION_8020000_REGEX = re.compile( - r'Data access violation, mfar = 8020000\r\n') -DATA_ACCESS_VIOLATION_8040000_REGEX = re.compile( - r'Data access violation, mfar = 8040000\r\n') -DATA_ACCESS_VIOLATION_80C0000_REGEX = re.compile( - r'Data access violation, mfar = 80c0000\r\n') -DATA_ACCESS_VIOLATION_80E0000_REGEX = re.compile( - r'Data access violation, mfar = 80e0000\r\n') -DATA_ACCESS_VIOLATION_20000000_REGEX = re.compile( - r'Data access violation, mfar = 20000000\r\n') -DATA_ACCESS_VIOLATION_24000000_REGEX = re.compile( - r'Data access violation, mfar = 24000000\r\n') - -BLOONCHIPPER = 'bloonchipper' -DARTMONKEY = 'dartmonkey' - -JTRACE = 'jtrace' -SERVO_MICRO = 'servo_micro' - -GCC = 'gcc' -CLANG = 'clang' - - -class ImageType(Enum): - """EC Image type to use for the test.""" - RO = 1 - RW = 2 - - -class BoardConfig: - """Board-specific configuration.""" - - def __init__(self, name, servo_uart_name, servo_power_enable, - rollback_region0_regex, rollback_region1_regex, mpu_regex): - self.name = name - self.servo_uart_name = servo_uart_name - self.servo_power_enable = servo_power_enable - self.rollback_region0_regex = rollback_region0_regex - self.rollback_region1_regex = rollback_region1_regex - self.mpu_regex = mpu_regex - - -class TestConfig: - """Configuration for a given test.""" - - def __init__(self, name, image_to_use=ImageType.RW, finish_regexes=None, - toggle_power=False, test_args=None, num_flash_attempts=2, - timeout_secs=10, enable_hw_write_protect=False): - if test_args is None: - test_args = [] - if finish_regexes is None: - finish_regexes = [ALL_TESTS_PASSED_REGEX, ALL_TESTS_FAILED_REGEX] - - self.name = name - self.image_to_use = image_to_use - self.finish_regexes = finish_regexes - self.test_args = test_args - self.toggle_power = toggle_power - self.num_flash_attempts = num_flash_attempts - self.timeout_secs = timeout_secs - self.enable_hw_write_protect = enable_hw_write_protect - self.logs = [] - self.passed = False - self.num_fails = 0 - self.num_passes = 0 - - -# All possible tests. -class AllTests: - """All possible tests.""" - - @staticmethod - def get(board_config: BoardConfig): - tests = { - 'aes': - TestConfig(name='aes'), - 'cec': - TestConfig(name='cec'), - 'crc': - TestConfig(name='crc'), - 'flash_physical': - TestConfig(name='flash_physical', image_to_use=ImageType.RO, - toggle_power=True), - 'flash_write_protect': - TestConfig(name='flash_write_protect', - image_to_use=ImageType.RO, - toggle_power=True, enable_hw_write_protect=True), - 'fpsensor_hw': - TestConfig(name='fpsensor_hw'), - 'fpsensor_spi_ro': - TestConfig(name='fpsensor', image_to_use=ImageType.RO, - test_args=['spi']), - 'fpsensor_spi_rw': - TestConfig(name='fpsensor', test_args=['spi']), - 'fpsensor_uart_ro': - TestConfig(name='fpsensor', image_to_use=ImageType.RO, - test_args=['uart']), - 'fpsensor_uart_rw': - TestConfig(name='fpsensor', test_args=['uart']), - 'mpu_ro': - TestConfig(name='mpu', - image_to_use=ImageType.RO, - finish_regexes=[board_config.mpu_regex]), - 'mpu_rw': - TestConfig(name='mpu', - finish_regexes=[board_config.mpu_regex]), - 'mutex': - TestConfig(name='mutex'), - 'pingpong': - TestConfig(name='pingpong'), - 'printf': - TestConfig(name='printf'), - 'queue': - TestConfig(name='queue'), - 'rollback_region0': - TestConfig(name='rollback', finish_regexes=[ - board_config.rollback_region0_regex], - test_args=['region0']), - 'rollback_region1': - TestConfig(name='rollback', finish_regexes=[ - board_config.rollback_region1_regex], - test_args=['region1']), - 'rollback_entropy': - TestConfig(name='rollback_entropy', image_to_use=ImageType.RO), - 'rtc': - TestConfig(name='rtc'), - 'sha256': - TestConfig(name='sha256'), - 'sha256_unrolled': - TestConfig(name='sha256_unrolled'), - 'static_if': - TestConfig(name='static_if'), - 'timer_dos': - TestConfig(name='timer_dos'), - 'utils': - TestConfig(name='utils', timeout_secs=20), - 'utils_str': - TestConfig(name='utils_str'), - } - - if board_config.name == BLOONCHIPPER: - tests['stm32f_rtc'] = TestConfig(name='stm32f_rtc') - - return tests - - -BLOONCHIPPER_CONFIG = BoardConfig( - name=BLOONCHIPPER, - servo_uart_name='raw_fpmcu_console_uart_pty', - servo_power_enable='fpmcu_pp3300', - rollback_region0_regex=DATA_ACCESS_VIOLATION_8020000_REGEX, - rollback_region1_regex=DATA_ACCESS_VIOLATION_8040000_REGEX, - mpu_regex=DATA_ACCESS_VIOLATION_20000000_REGEX, -) - -DARTMONKEY_CONFIG = BoardConfig( - name=DARTMONKEY, - servo_uart_name='raw_fpmcu_console_uart_pty', - servo_power_enable='fpmcu_pp3300', - rollback_region0_regex=DATA_ACCESS_VIOLATION_80C0000_REGEX, - rollback_region1_regex=DATA_ACCESS_VIOLATION_80E0000_REGEX, - mpu_regex=DATA_ACCESS_VIOLATION_24000000_REGEX, -) - -BOARD_CONFIGS = { - 'bloonchipper': BLOONCHIPPER_CONFIG, - 'dartmonkey': DARTMONKEY_CONFIG, -} - - -def get_console(board_config: BoardConfig) -> Optional[str]: - """Get the name of the console for a given board.""" - cmd = [ - 'dut-control', - board_config.servo_uart_name, - ] - logging.debug('Running command: "%s"', ' '.join(cmd)) - - with subprocess.Popen(cmd, stdout=subprocess.PIPE) as proc: - for line in io.TextIOWrapper(proc.stdout): # type: ignore[arg-type] - logging.debug(line) - pty = line.split(':') - if len(pty) == 2 and pty[0] == board_config.servo_uart_name: - return pty[1].strip() - - return None - - -def power(board_config: BoardConfig, on: bool) -> None: - """Turn power to board on/off.""" - if on: - state = 'pp3300' - else: - state = 'off' - - cmd = [ - 'dut-control', - board_config.servo_power_enable + ':' + state, - ] - logging.debug('Running command: "%s"', ' '.join(cmd)) - subprocess.run(cmd).check_returncode() - - -def hw_write_protect(enable: bool) -> None: - """Enable/disable hardware write protect.""" - if enable: - state = 'force_on' - else: - state = 'force_off' - - cmd = [ - 'dut-control', - 'fw_wp_state:' + state, - ] - logging.debug('Running command: "%s"', ' '.join(cmd)) - subprocess.run(cmd).check_returncode() - - -def build(test_name: str, board_name: str, compiler: str) -> None: - """Build specified test for specified board.""" - cmd = ['make'] - - if compiler == CLANG: - cmd = cmd + ['CC=arm-none-eabi-clang'] - - cmd = cmd + [ - 'BOARD=' + board_name, - 'test-' + test_name, - '-j', - ] - - logging.debug('Running command: "%s"', ' '.join(cmd)) - subprocess.run(cmd).check_returncode() - - -def flash(test_name: str, board: str, flasher: str, remote: str) -> bool: - """Flash specified test to specified board.""" - logging.info("Flashing test") - - cmd = [] - if flasher == JTRACE: - cmd.append(JTRACE_FLASH_SCRIPT) - if remote: - cmd.extend(['--remote', remote]) - elif flasher == SERVO_MICRO: - cmd.append(SERVO_MICRO_FLASH_SCRIPT) - else: - logging.error('Unknown flasher: "%s"', flasher) - return False - cmd.extend([ - '--board', board, - '--image', os.path.join(EC_DIR, 'build', board, test_name, - test_name + '.bin'), - ]) - logging.debug('Running command: "%s"', ' '.join(cmd)) - completed_process = subprocess.run(cmd) - return completed_process.returncode == 0 - - -def readline(executor: ThreadPoolExecutor, f: BinaryIO, timeout_secs: int) -> \ - Optional[bytes]: - """Read a line with timeout.""" - a = executor.submit(f.readline) - try: - return a.result(timeout_secs) - except concurrent.futures.TimeoutError: - return None - - -def readlines_until_timeout(executor, f: BinaryIO, timeout_secs: int) -> \ - List[bytes]: - """Continuously read lines for timeout_secs.""" - lines: List[bytes] = [] - while True: - line = readline(executor, f, timeout_secs) - if not line: - return lines - lines.append(line) - - -def process_console_output_line(line: bytes, test: TestConfig): - try: - line_str = line.decode() - - if SINGLE_CHECK_PASSED_REGEX.match(line_str): - test.num_passes += 1 - - if SINGLE_CHECK_FAILED_REGEX.match(line_str): - test.num_fails += 1 - - if ALL_TESTS_FAILED_REGEX.match(line_str): - test.num_fails += 1 - - if ASSERTION_FAILURE_REGEX.match(line_str): - test.num_fails += 1 - - return line_str - except UnicodeDecodeError: - # Sometimes we get non-unicode from the console (e.g., when the - # board reboots.) Not much we can do in this case, so we'll just - # ignore it. - return None - - -def run_test(test: TestConfig, console: str, executor: ThreadPoolExecutor) ->\ - bool: - """Run specified test.""" - start = time.time() - with open(console, "wb+", buffering=0) as c: - # Wait for boot to finish - time.sleep(1) - c.write('\n'.encode()) - if test.image_to_use == ImageType.RO: - c.write('reboot ro\n'.encode()) - time.sleep(1) - - test_cmd = 'runtest ' + ' '.join(test.test_args) + '\n' - c.write(test_cmd.encode()) - - while True: - c.flush() - line = readline(executor, c, 1) - if not line: - now = time.time() - if now - start > test.timeout_secs: - logging.debug("Test timed out") - return False - continue - - logging.debug(line) - test.logs.append(line) - # Look for test_print_result() output (success or failure) - line_str = process_console_output_line(line, test) - if line_str is None: - # Sometimes we get non-unicode from the console (e.g., when the - # board reboots.) Not much we can do in this case, so we'll just - # ignore it. - continue - - for r in test.finish_regexes: - if r.match(line_str): - # flush read the remaining - lines = readlines_until_timeout(executor, c, 1) - logging.debug(lines) - test.logs.append(lines) - - for line in lines: - process_console_output_line(line, test) - - return test.num_fails == 0 - - -def get_test_list(config: BoardConfig, test_args) -> List[TestConfig]: - """Get a list of tests to run.""" - if test_args == 'all': - return list(AllTests.get(config).values()) - - test_list = [] - for t in test_args: - logging.debug('test: %s', t) - test_config = AllTests.get(config).get(t) - if test_config is None: - logging.error('Unable to find test config for "%s"', t) - sys.exit(1) - test_list.append(test_config) - - return test_list - - -def main(): - parser = argparse.ArgumentParser() - - default_board = 'bloonchipper' - parser.add_argument( - '--board', '-b', - help='Board (default: ' + default_board + ')', - default=default_board) - - default_tests = 'all' - parser.add_argument( - '--tests', '-t', - nargs='+', - help='Tests (default: ' + default_tests + ')', - default=default_tests) - - log_level_choices = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] - parser.add_argument( - '--log_level', '-l', - choices=log_level_choices, - default='DEBUG' - ) - - flasher_choices = [SERVO_MICRO, JTRACE] - parser.add_argument( - '--flasher', '-f', - choices=flasher_choices, - default=JTRACE - ) - - compiler_options = [GCC, CLANG] - parser.add_argument('--compiler', '-c', - choices=compiler_options, - default=GCC) - - # This might be expanded to serve as a "remote" for flash_ec also, so - # we will leave it generic. - parser.add_argument( - '--remote', '-n', - help='The remote host:ip to connect to J-Link. ' - 'This is passed to flash_jlink.py.', - ) - - args = parser.parse_args() - logging.basicConfig(level=args.log_level) - - if args.board not in BOARD_CONFIGS: - logging.error('Unable to find a config for board: "%s"', args.board) - sys.exit(1) - - board_config = BOARD_CONFIGS[args.board] - - e = ThreadPoolExecutor(max_workers=1) - - test_list = get_test_list(board_config, args.tests) - logging.debug('Running tests: %s', [t.name for t in test_list]) - - for test in test_list: - # build test binary - build(test.name, args.board, args.compiler) - - # flash test binary - # TODO(b/158327221): First attempt to flash fails after - # flash_write_protect test is run; works after second attempt. - flash_succeeded = False - for i in range(0, test.num_flash_attempts): - logging.debug('Flash attempt %d', i + 1) - if flash(test.name, args.board, args.flasher, args.remote): - flash_succeeded = True - break - time.sleep(1) - - if not flash_succeeded: - logging.debug('Flashing failed after max attempts: %d', - test.num_flash_attempts) - test.passed = False - continue - - if test.toggle_power: - power(board_config, on=False) - time.sleep(1) - power(board_config, on=True) - - hw_write_protect(test.enable_hw_write_protect) - - # run the test - logging.info('Running test: "%s"', test.name) - console = get_console(board_config) - test.passed = run_test(test, console, executor=e) - - colorama.init() - exit_code = 0 - for test in test_list: - # print results - print('Test "' + test.name + '": ', end='') - if test.passed: - print(colorama.Fore.GREEN + 'PASSED') - else: - print(colorama.Fore.RED + 'FAILED') - exit_code = 1 - - print(colorama.Style.RESET_ALL) - - e.shutdown(wait=False) - sys.exit(exit_code) - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/test/sbs_charging_v2.c b/test/sbs_charging_v2.c deleted file mode 100644 index bdca592d6c..0000000000 --- a/test/sbs_charging_v2.c +++ /dev/null @@ -1,940 +0,0 @@ -/* Copyright 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. - * - * Test charge_state_v2 behavior - */ - -#include "battery_smart.h" -#include "charge_state.h" -#include "chipset.h" -#include "common.h" -#include "gpio.h" -#include "hooks.h" -#include "host_command.h" -#include "math_util.h" -#include "power.h" -#include "task.h" -#include "test_util.h" -#include "util.h" - -#define WAIT_CHARGER_TASK 600 -#define BATTERY_DETACH_DELAY 35000 - -enum ec_charge_control_mode get_chg_ctrl_mode(void); - -static int mock_chipset_state = CHIPSET_STATE_ON; -static int is_shutdown; -static int is_force_discharge; -static int is_hibernated; -static int override_voltage, override_current, override_usec; -static int display_soc; -static int is_full; - -/* The simulation doesn't really hibernate, so we must reset this ourselves */ -extern timestamp_t shutdown_target_time; - -static void reset_mocks(void) -{ - mock_chipset_state = CHIPSET_STATE_ON; - is_shutdown = is_force_discharge = is_hibernated = 0; - override_voltage = override_current = override_usec = 0; - shutdown_target_time.val = 0ULL; - is_full = 0; -} - -int board_cut_off_battery(void) -{ - return EC_SUCCESS; -} - -void chipset_force_shutdown(enum chipset_shutdown_reason reason) -{ - is_shutdown = 1; - mock_chipset_state = CHIPSET_STATE_HARD_OFF; -} - -int chipset_in_state(int state_mask) -{ - return state_mask & mock_chipset_state; -} - -int chipset_in_or_transitioning_to_state(int state_mask) -{ - return state_mask & mock_chipset_state; -} - -enum power_state power_get_state(void) -{ - if (is_shutdown) - return POWER_S5; - else if (is_hibernated) - return POWER_G3; - else - return POWER_S0; -} - -int board_discharge_on_ac(int enabled) -{ - is_force_discharge = enabled; - return EC_SUCCESS; -} - -void system_hibernate(int sec, int usec) -{ - is_hibernated = 1; -} - -int charger_profile_override(struct charge_state_data *curr) -{ - if (override_voltage) - curr->requested_voltage = override_voltage; - if (override_current) - curr->requested_current = override_current; - - if (override_usec) - return override_usec; - - /* Don't let it sleep a whole minute when the AP is off */ - if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) - return CHARGE_POLL_PERIOD_LONG; - - return 0; -} - -static uint32_t meh; -enum ec_status charger_profile_override_get_param(uint32_t param, - uint32_t *value) -{ - if (param == CS_PARAM_CUSTOM_PROFILE_MIN) { - *value = meh; - return EC_RES_SUCCESS; - } - return EC_RES_INVALID_PARAM; -} -enum ec_status charger_profile_override_set_param(uint32_t param, - uint32_t value) -{ - if (param == CS_PARAM_CUSTOM_PROFILE_MIN) { - meh = value; - return EC_RES_SUCCESS; - } - return EC_RES_INVALID_PARAM; -} - -static int wait_charging_state(void) -{ - enum charge_state state; - task_wake(TASK_ID_CHARGER); - msleep(WAIT_CHARGER_TASK); - state = charge_get_state(); - ccprintf("[CHARGING TEST] state = %d\n", state); - return state; -} - -static int charge_control(enum ec_charge_control_mode mode) -{ - struct ec_params_charge_control p; - - p.cmd = EC_CHARGE_CONTROL_CMD_SET; - p.mode = mode; - p.sustain_soc.lower = -1; - p.sustain_soc.upper = -1; - return test_send_host_command(EC_CMD_CHARGE_CONTROL, 2, &p, sizeof(p), - NULL, 0); -} - -__override int charge_get_display_charge(void) -{ - return display_soc; -} - -__override int calc_is_full(void) -{ - return is_full; -} - -/* Setup init condition */ -static void test_setup(int on_ac) -{ - const struct battery_info *bat_info = battery_get_info(); - - reset_mocks(); - - /* 50% of charge */ - sb_write(SB_RELATIVE_STATE_OF_CHARGE, 50); - sb_write(SB_ABSOLUTE_STATE_OF_CHARGE, 50); - /* full charge capacity in mAh */ - sb_write(SB_FULL_CHARGE_CAPACITY, 0xf000); - /* 25 degree Celsius */ - sb_write(SB_TEMPERATURE, CELSIUS_TO_DECI_KELVIN(25)); - /* battery pack voltage */ - sb_write(SB_VOLTAGE, bat_info->voltage_normal); - /* desired charging voltage/current */ - sb_write(SB_CHARGING_VOLTAGE, bat_info->voltage_max); - sb_write(SB_CHARGING_CURRENT, 4000); - - /* battery pack current is positive when charging */ - if (on_ac) { - sb_write(SB_CURRENT, 1000); - gpio_set_level(GPIO_AC_PRESENT, 1); - } else { - sb_write(SB_CURRENT, -100); - gpio_set_level(GPIO_AC_PRESENT, 0); - } - - /* Reset the charger state to initial state */ - charge_control(CHARGE_CONTROL_NORMAL); - - /* Let things stabilize */ - wait_charging_state(); -} - -/* Host Event helpers */ -static int ev_is_set(int event) -{ - return host_get_events() & EC_HOST_EVENT_MASK(event); -} -static int ev_is_clear(int event) -{ - return !ev_is_set(event); -} -static void ev_clear(int event) -{ - host_clear_events(EC_HOST_EVENT_MASK(event)); -} - -static int test_charge_state(void) -{ - enum charge_state state; - uint32_t flags; - - /* On AC */ - test_setup(1); - - ccprintf("[CHARGING TEST] AC on\n"); - - /* Detach battery, charging error */ - ccprintf("[CHARGING TEST] Detach battery\n"); - TEST_ASSERT(test_detach_i2c(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS) == - EC_SUCCESS); - msleep(BATTERY_DETACH_DELAY); - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_ERROR); - - /* Attach battery again, charging */ - ccprintf("[CHARGING TEST] Attach battery\n"); - test_attach_i2c(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS); - /* And changing full capacity should trigger a host event */ - ev_clear(EC_HOST_EVENT_BATTERY); - sb_write(SB_FULL_CHARGE_CAPACITY, 0xeff0); - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_CHARGE); - TEST_ASSERT(ev_is_set(EC_HOST_EVENT_BATTERY)); - - /* Unplug AC, discharging at 1000mAh */ - ccprintf("[CHARGING TEST] AC off\n"); - gpio_set_level(GPIO_AC_PRESENT, 0); - sb_write(SB_CURRENT, -1000); - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_DISCHARGE); - flags = charge_get_flags(); - TEST_ASSERT(!(flags & CHARGE_FLAG_EXTERNAL_POWER)); - TEST_ASSERT(!(flags & CHARGE_FLAG_FORCE_IDLE)); - - /* Discharging waaaay overtemp is ignored */ - ccprintf("[CHARGING TEST] AC off, batt temp = 0xffff\n"); - gpio_set_level(GPIO_AC_PRESENT, 0); - sb_write(SB_CURRENT, -1000); - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_DISCHARGE); - sb_write(SB_TEMPERATURE, 0xffff); - state = wait_charging_state(); - TEST_ASSERT(!is_shutdown); - TEST_ASSERT(state == PWR_STATE_DISCHARGE); - sb_write(SB_TEMPERATURE, CELSIUS_TO_DECI_KELVIN(40)); - - /* Discharging overtemp */ - ccprintf("[CHARGING TEST] AC off, batt temp = 90 C\n"); - gpio_set_level(GPIO_AC_PRESENT, 0); - sb_write(SB_CURRENT, -1000); - - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_DISCHARGE); - sb_write(SB_TEMPERATURE, CELSIUS_TO_DECI_KELVIN(90)); - state = wait_charging_state(); - sleep(CONFIG_BATTERY_CRITICAL_SHUTDOWN_TIMEOUT); - TEST_ASSERT(is_shutdown); - TEST_ASSERT(state == PWR_STATE_DISCHARGE); - sb_write(SB_TEMPERATURE, CELSIUS_TO_DECI_KELVIN(40)); - - /* Force idle */ - ccprintf("[CHARGING TEST] AC on, force idle\n"); - gpio_set_level(GPIO_AC_PRESENT, 1); - sb_write(SB_CURRENT, 1000); - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_CHARGE); - flags = charge_get_flags(); - TEST_ASSERT(flags & CHARGE_FLAG_EXTERNAL_POWER); - TEST_ASSERT(!(flags & CHARGE_FLAG_FORCE_IDLE)); - charge_control(CHARGE_CONTROL_IDLE); - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_IDLE); - flags = charge_get_flags(); - TEST_ASSERT(flags & CHARGE_FLAG_EXTERNAL_POWER); - TEST_ASSERT(flags & CHARGE_FLAG_FORCE_IDLE); - charge_control(CHARGE_CONTROL_NORMAL); - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_CHARGE); - - /* Force discharge */ - ccprintf("[CHARGING TEST] AC on, force discharge\n"); - gpio_set_level(GPIO_AC_PRESENT, 1); - sb_write(SB_CURRENT, 1000); - charge_control(CHARGE_CONTROL_DISCHARGE); - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_IDLE); - TEST_ASSERT(is_force_discharge); - charge_control(CHARGE_CONTROL_NORMAL); - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_CHARGE); - TEST_ASSERT(!is_force_discharge); - - return EC_SUCCESS; -} - -static int test_low_battery(void) -{ - test_setup(1); - - ccprintf("[CHARGING TEST] Low battery with AC and positive current\n"); - sb_write(SB_RELATIVE_STATE_OF_CHARGE, 2); - sb_write(SB_CURRENT, 1000); - wait_charging_state(); - mock_chipset_state = CHIPSET_STATE_SOFT_OFF; - hook_notify(HOOK_CHIPSET_SHUTDOWN); - TEST_ASSERT(!is_hibernated); - - ccprintf("[CHARGING TEST] Low battery with AC and negative current\n"); - sb_write(SB_CURRENT, -1000); - wait_charging_state(); - sleep(CONFIG_BATTERY_CRITICAL_SHUTDOWN_TIMEOUT); - TEST_ASSERT(is_hibernated); - - ccprintf("[CHARGING TEST] Low battery shutdown S0->S5\n"); - mock_chipset_state = CHIPSET_STATE_ON; - hook_notify(HOOK_CHIPSET_PRE_INIT); - hook_notify(HOOK_CHIPSET_STARTUP); - gpio_set_level(GPIO_AC_PRESENT, 0); - is_hibernated = 0; - sb_write(SB_CURRENT, -1000); - sb_write(SB_RELATIVE_STATE_OF_CHARGE, 2); - wait_charging_state(); - mock_chipset_state = CHIPSET_STATE_SOFT_OFF; - hook_notify(HOOK_CHIPSET_SHUTDOWN); - wait_charging_state(); - /* after a while, the EC should hibernate */ - sleep(CONFIG_BATTERY_CRITICAL_SHUTDOWN_TIMEOUT); - TEST_ASSERT(is_hibernated); - - ccprintf("[CHARGING TEST] Low battery shutdown S5\n"); - is_hibernated = 0; - sb_write(SB_RELATIVE_STATE_OF_CHARGE, 10); - wait_charging_state(); - sb_write(SB_RELATIVE_STATE_OF_CHARGE, 2); - wait_charging_state(); - /* after a while, the EC should hibernate */ - sleep(CONFIG_BATTERY_CRITICAL_SHUTDOWN_TIMEOUT); - TEST_ASSERT(is_hibernated); - - ccprintf("[CHARGING TEST] Low battery AP shutdown\n"); - is_shutdown = 0; - mock_chipset_state = CHIPSET_STATE_ON; - sb_write(SB_RELATIVE_STATE_OF_CHARGE, 10); - gpio_set_level(GPIO_AC_PRESENT, 1); - sb_write(SB_CURRENT, 1000); - wait_charging_state(); - gpio_set_level(GPIO_AC_PRESENT, 0); - sb_write(SB_CURRENT, -1000); - sb_write(SB_RELATIVE_STATE_OF_CHARGE, 2); - wait_charging_state(); - usleep(32 * SECOND); - wait_charging_state(); - TEST_ASSERT(is_shutdown); - - return EC_SUCCESS; -} - -static int test_high_temp_battery(void) -{ - test_setup(1); - - ccprintf("[CHARGING TEST] High battery temperature shutdown\n"); - ev_clear(EC_HOST_EVENT_BATTERY_SHUTDOWN); - sb_write(SB_TEMPERATURE, CELSIUS_TO_DECI_KELVIN(90)); - wait_charging_state(); - TEST_ASSERT(ev_is_set(EC_HOST_EVENT_BATTERY_SHUTDOWN)); - TEST_ASSERT(!is_shutdown); - sleep(CONFIG_BATTERY_CRITICAL_SHUTDOWN_TIMEOUT); - TEST_ASSERT(is_shutdown); - - ccprintf("[CHARGING TEST] High battery temp S0->S5 hibernate\n"); - mock_chipset_state = CHIPSET_STATE_SOFT_OFF; - wait_charging_state(); - TEST_ASSERT(is_hibernated); - - return EC_SUCCESS; -} - -static int test_cold_battery_with_ac(void) -{ - test_setup(1); - - ccprintf("[CHARGING TEST] Cold battery no shutdown with AC\n"); - ev_clear(EC_HOST_EVENT_BATTERY_SHUTDOWN); - sb_write(SB_TEMPERATURE, CELSIUS_TO_DECI_KELVIN(-90)); - wait_charging_state(); - sleep(CONFIG_BATTERY_CRITICAL_SHUTDOWN_TIMEOUT); - TEST_ASSERT(!is_shutdown); - - return EC_SUCCESS; -} - -static int test_cold_battery_no_ac(void) -{ - test_setup(0); - - ccprintf("[CHARGING TEST] Cold battery shutdown when discharging\n"); - ev_clear(EC_HOST_EVENT_BATTERY_SHUTDOWN); - sb_write(SB_TEMPERATURE, CELSIUS_TO_DECI_KELVIN(-90)); - wait_charging_state(); - TEST_ASSERT(ev_is_set(EC_HOST_EVENT_BATTERY_SHUTDOWN)); - TEST_ASSERT(!is_shutdown); - sleep(CONFIG_BATTERY_CRITICAL_SHUTDOWN_TIMEOUT); - TEST_ASSERT(is_shutdown); - - return EC_SUCCESS; -} - -static int test_external_funcs(void) -{ - int rv, temp; - uint32_t flags; - int state; - - /* Connect the AC */ - test_setup(1); - - flags = charge_get_flags(); - TEST_ASSERT(flags & CHARGE_FLAG_EXTERNAL_POWER); - TEST_ASSERT(!(flags & CHARGE_FLAG_FORCE_IDLE)); - - /* Invalid or do-nothing commands first */ - UART_INJECT("chg\n"); - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_CHARGE); - flags = charge_get_flags(); - TEST_ASSERT(flags & CHARGE_FLAG_EXTERNAL_POWER); - TEST_ASSERT(!(flags & CHARGE_FLAG_FORCE_IDLE)); - - UART_INJECT("chg blahblah\n"); - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_CHARGE); - flags = charge_get_flags(); - TEST_ASSERT(flags & CHARGE_FLAG_EXTERNAL_POWER); - TEST_ASSERT(!(flags & CHARGE_FLAG_FORCE_IDLE)); - - UART_INJECT("chg idle\n"); - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_CHARGE); - flags = charge_get_flags(); - TEST_ASSERT(flags & CHARGE_FLAG_EXTERNAL_POWER); - TEST_ASSERT(!(flags & CHARGE_FLAG_FORCE_IDLE)); - - UART_INJECT("chg idle blargh\n"); - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_CHARGE); - flags = charge_get_flags(); - TEST_ASSERT(flags & CHARGE_FLAG_EXTERNAL_POWER); - TEST_ASSERT(!(flags & CHARGE_FLAG_FORCE_IDLE)); - - /* Now let's force idle on and off */ - UART_INJECT("chg idle on\n"); - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_IDLE); - flags = charge_get_flags(); - TEST_ASSERT(flags & CHARGE_FLAG_EXTERNAL_POWER); - TEST_ASSERT(flags & CHARGE_FLAG_FORCE_IDLE); - - UART_INJECT("chg idle off\n"); - wait_charging_state(); - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_CHARGE); - flags = charge_get_flags(); - TEST_ASSERT(flags & CHARGE_FLAG_EXTERNAL_POWER); - TEST_ASSERT(!(flags & CHARGE_FLAG_FORCE_IDLE)); - - /* and the rest */ - TEST_ASSERT(charge_get_state() == PWR_STATE_CHARGE); - TEST_ASSERT(!charge_want_shutdown()); - TEST_ASSERT(charge_get_percent() == 50); - temp = 0; - rv = charge_get_battery_temp(0, &temp); - TEST_ASSERT(rv == EC_SUCCESS); - TEST_ASSERT(K_TO_C(temp) == 25); - - return EC_SUCCESS; -} - -#define CHG_OPT1 0x2000 -#define CHG_OPT2 0x4000 -static int test_hc_charge_state(void) -{ - enum charge_state state; - int i, rv, tmp; - struct ec_params_charge_state params; - struct ec_response_charge_state resp; - - /* Let's connect the AC again. */ - test_setup(1); - - /* Initialize the charger options with some nonzero value */ - TEST_ASSERT(charger_set_option(CHG_OPT1) == EC_SUCCESS); - - /* Get the state */ - memset(&resp, 0, sizeof(resp)); - params.cmd = CHARGE_STATE_CMD_GET_STATE; - rv = test_send_host_command(EC_CMD_CHARGE_STATE, 0, - ¶ms, sizeof(params), - &resp, sizeof(resp)); - TEST_ASSERT(rv == EC_RES_SUCCESS); - TEST_ASSERT(resp.get_state.ac); - TEST_ASSERT(resp.get_state.chg_voltage); - TEST_ASSERT(resp.get_state.chg_current); - TEST_ASSERT(resp.get_state.chg_input_current); - TEST_ASSERT(resp.get_state.batt_state_of_charge); - - /* Check all the params */ - for (i = 0; i < CS_NUM_BASE_PARAMS; i++) { - - /* Read it */ - memset(&resp, 0, sizeof(resp)); - params.cmd = CHARGE_STATE_CMD_GET_PARAM; - params.get_param.param = i; - rv = test_send_host_command(EC_CMD_CHARGE_STATE, 0, - ¶ms, sizeof(params), - &resp, sizeof(resp)); - TEST_ASSERT(rv == EC_RES_SUCCESS); - if (i != CS_PARAM_LIMIT_POWER) - TEST_ASSERT(resp.get_param.value); - else - TEST_ASSERT(!resp.get_param.value); - - /* Bump it up a bit */ - tmp = resp.get_param.value; - switch (i) { - case CS_PARAM_CHG_VOLTAGE: - case CS_PARAM_CHG_CURRENT: - case CS_PARAM_CHG_INPUT_CURRENT: - tmp -= 128; /* Should be valid delta */ - break; - case CS_PARAM_CHG_STATUS: - case CS_PARAM_LIMIT_POWER: - /* These ones can't be set */ - break; - case CS_PARAM_CHG_OPTION: - tmp = CHG_OPT2; - break; - } - params.cmd = CHARGE_STATE_CMD_SET_PARAM; - params.set_param.param = i; - params.set_param.value = tmp; - rv = test_send_host_command(EC_CMD_CHARGE_STATE, 0, - ¶ms, sizeof(params), - &resp, sizeof(resp)); - if (i == CS_PARAM_CHG_STATUS || i == CS_PARAM_LIMIT_POWER) - TEST_ASSERT(rv == EC_RES_ACCESS_DENIED); - else - TEST_ASSERT(rv == EC_RES_SUCCESS); - /* Allow the change to take effect */ - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_CHARGE); - - /* Read it back again*/ - memset(&resp, 0, sizeof(resp)); - params.cmd = CHARGE_STATE_CMD_GET_PARAM; - params.get_param.param = i; - rv = test_send_host_command(EC_CMD_CHARGE_STATE, 0, - ¶ms, sizeof(params), - &resp, sizeof(resp)); - TEST_ASSERT(rv == EC_RES_SUCCESS); - TEST_ASSERT(resp.get_param.value == tmp); - } - - /* And a custom profile param */ - meh = 0xdeadbeef; - memset(&resp, 0, sizeof(resp)); - params.cmd = CHARGE_STATE_CMD_GET_PARAM; - params.get_param.param = CS_PARAM_CUSTOM_PROFILE_MIN; - rv = test_send_host_command(EC_CMD_CHARGE_STATE, 0, - ¶ms, sizeof(params), - &resp, sizeof(resp)); - TEST_ASSERT(rv == EC_RES_SUCCESS); - TEST_ASSERT(resp.get_param.value == meh); - params.cmd = CHARGE_STATE_CMD_SET_PARAM; - params.set_param.param = CS_PARAM_CUSTOM_PROFILE_MIN; - params.set_param.value = 0xc0def00d; - rv = test_send_host_command(EC_CMD_CHARGE_STATE, 0, - ¶ms, sizeof(params), - &resp, sizeof(resp)); - TEST_ASSERT(rv == EC_RES_SUCCESS); - /* Allow the change to take effect */ - state = wait_charging_state(); - TEST_ASSERT(meh == params.set_param.value); - - /* param out of range */ - params.cmd = CHARGE_STATE_CMD_GET_PARAM; - params.get_param.param = CS_NUM_BASE_PARAMS; - rv = test_send_host_command(EC_CMD_CHARGE_STATE, 0, - ¶ms, sizeof(params), - &resp, sizeof(resp)); - TEST_ASSERT(rv == EC_RES_INVALID_PARAM); - params.cmd = CHARGE_STATE_CMD_SET_PARAM; - params.set_param.param = CS_NUM_BASE_PARAMS; - params.set_param.value = 0x1000; /* random value */ - rv = test_send_host_command(EC_CMD_CHARGE_STATE, 0, - ¶ms, sizeof(params), - &resp, sizeof(resp)); - TEST_ASSERT(rv == EC_RES_INVALID_PARAM); - - /* command out of range */ - params.cmd = CHARGE_STATE_NUM_CMDS; - rv = test_send_host_command(EC_CMD_CHARGE_STATE, 0, - ¶ms, sizeof(params), - &resp, sizeof(resp)); - TEST_ASSERT(rv == EC_RES_INVALID_PARAM); - - /* - * We've screwed with the charger settings, so let the state machine - * reset itself before we stop. - */ - test_setup(0); - test_setup(1); - - return EC_SUCCESS; -} - -static int test_hc_current_limit(void) -{ - int rv, norm_current, lower_current; - struct ec_params_charge_state cs_params; - struct ec_response_charge_state cs_resp; - struct ec_params_current_limit cl_params; - - /* On AC */ - test_setup(1); - - /* See what current the charger is delivering */ - cs_params.cmd = CHARGE_STATE_CMD_GET_STATE; - rv = test_send_host_command(EC_CMD_CHARGE_STATE, 0, - &cs_params, sizeof(cs_params), - &cs_resp, sizeof(cs_resp)); - TEST_ASSERT(rv == EC_RES_SUCCESS); - norm_current = cs_resp.get_state.chg_current; - - /* Lower it a bit */ - lower_current = norm_current - 256; - cl_params.limit = lower_current; - rv = test_send_host_command(EC_CMD_CHARGE_CURRENT_LIMIT, 0, - &cl_params, sizeof(cl_params), - 0, 0); - TEST_ASSERT(rv == EC_RES_SUCCESS); - wait_charging_state(); - - /* See that it's changed */ - rv = test_send_host_command(EC_CMD_CHARGE_STATE, 0, - &cs_params, sizeof(cs_params), - &cs_resp, sizeof(cs_resp)); - TEST_ASSERT(rv == EC_RES_SUCCESS); - TEST_ASSERT(lower_current == cs_resp.get_state.chg_current); - - /* Remove the limit */ - cl_params.limit = -1U; - rv = test_send_host_command(EC_CMD_CHARGE_CURRENT_LIMIT, 0, - &cl_params, sizeof(cl_params), - 0, 0); - TEST_ASSERT(rv == EC_RES_SUCCESS); - wait_charging_state(); - - /* See that it's back */ - rv = test_send_host_command(EC_CMD_CHARGE_STATE, 0, - &cs_params, sizeof(cs_params), - &cs_resp, sizeof(cs_resp)); - TEST_ASSERT(rv == EC_RES_SUCCESS); - TEST_ASSERT(norm_current == cs_resp.get_state.chg_current); - - return EC_SUCCESS; -} - -static int test_low_battery_hostevents(void) -{ - int state; - - test_setup(0); - - ccprintf("[CHARGING TEST] Low battery host events\n"); - - /* You know you make me wanna */ - sb_write(SB_RELATIVE_STATE_OF_CHARGE, BATTERY_LEVEL_LOW + 1); - ev_clear(EC_HOST_EVENT_BATTERY_LOW); - ev_clear(EC_HOST_EVENT_BATTERY_CRITICAL); - ev_clear(EC_HOST_EVENT_BATTERY_SHUTDOWN); - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_DISCHARGE); - TEST_ASSERT(ev_is_clear(EC_HOST_EVENT_BATTERY_LOW)); - TEST_ASSERT(ev_is_clear(EC_HOST_EVENT_BATTERY_CRITICAL)); - TEST_ASSERT(ev_is_clear(EC_HOST_EVENT_BATTERY_SHUTDOWN)); - - /* (Shout) a little bit louder now */ - sb_write(SB_RELATIVE_STATE_OF_CHARGE, BATTERY_LEVEL_LOW - 1); - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_DISCHARGE); - TEST_ASSERT(ev_is_set(EC_HOST_EVENT_BATTERY_LOW)); - TEST_ASSERT(ev_is_clear(EC_HOST_EVENT_BATTERY_CRITICAL)); - TEST_ASSERT(ev_is_clear(EC_HOST_EVENT_BATTERY_SHUTDOWN)); - TEST_ASSERT(!is_shutdown); - - /* (Shout) a little bit louder now */ - sb_write(SB_RELATIVE_STATE_OF_CHARGE, BATTERY_LEVEL_CRITICAL + 1); - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_DISCHARGE); - TEST_ASSERT(ev_is_set(EC_HOST_EVENT_BATTERY_LOW)); - TEST_ASSERT(ev_is_clear(EC_HOST_EVENT_BATTERY_CRITICAL)); - TEST_ASSERT(ev_is_clear(EC_HOST_EVENT_BATTERY_SHUTDOWN)); - TEST_ASSERT(!is_shutdown); - - /* (Shout) a little bit louder now */ - sb_write(SB_RELATIVE_STATE_OF_CHARGE, BATTERY_LEVEL_CRITICAL - 1); - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_DISCHARGE); - TEST_ASSERT(ev_is_set(EC_HOST_EVENT_BATTERY_LOW)); - TEST_ASSERT(ev_is_set(EC_HOST_EVENT_BATTERY_CRITICAL)); - TEST_ASSERT(ev_is_clear(EC_HOST_EVENT_BATTERY_SHUTDOWN)); - TEST_ASSERT(!is_shutdown); - - /* (Shout) a little bit louder now */ - sb_write(SB_RELATIVE_STATE_OF_CHARGE, BATTERY_LEVEL_SHUTDOWN + 1); - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_DISCHARGE); - TEST_ASSERT(ev_is_set(EC_HOST_EVENT_BATTERY_LOW)); - TEST_ASSERT(ev_is_set(EC_HOST_EVENT_BATTERY_CRITICAL)); - TEST_ASSERT(ev_is_clear(EC_HOST_EVENT_BATTERY_SHUTDOWN)); - TEST_ASSERT(!is_shutdown); - - /* (Shout) a little bit louder now */ - sb_write(SB_RELATIVE_STATE_OF_CHARGE, BATTERY_LEVEL_SHUTDOWN - 1); - state = wait_charging_state(); - TEST_ASSERT(state == PWR_STATE_DISCHARGE); - TEST_ASSERT(ev_is_set(EC_HOST_EVENT_BATTERY_LOW)); - TEST_ASSERT(ev_is_set(EC_HOST_EVENT_BATTERY_CRITICAL)); - /* hey-hey-HEY-hey. Doesn't immediately shut down */ - TEST_ASSERT(ev_is_set(EC_HOST_EVENT_BATTERY_SHUTDOWN)); - TEST_ASSERT(!is_shutdown); - /* after a while, the AP should shut down */ - sleep(CONFIG_BATTERY_CRITICAL_SHUTDOWN_TIMEOUT); - TEST_ASSERT(is_shutdown); - - return EC_SUCCESS; -} - -static int test_battery_sustainer(void) -{ - struct ec_params_charge_control p; - struct ec_response_charge_control r; - int rv; - - test_setup(1); - - /* Enable sustainer */ - p.cmd = EC_CHARGE_CONTROL_CMD_SET; - p.mode = CHARGE_CONTROL_NORMAL; - p.sustain_soc.lower = 79; - p.sustain_soc.upper = 80; - rv = test_send_host_command(EC_CMD_CHARGE_CONTROL, 2, - &p, sizeof(p), NULL, 0); - TEST_ASSERT(rv == EC_RES_SUCCESS); - - p.cmd = EC_CHARGE_CONTROL_CMD_GET; - rv = test_send_host_command(EC_CMD_CHARGE_CONTROL, 2, - &p, sizeof(p), &r, sizeof(r)); - TEST_ASSERT(rv == EC_RES_SUCCESS); - TEST_ASSERT(r.sustain_soc.lower == 79); - TEST_ASSERT(r.sustain_soc.upper == 80); - - /* Check mode transition as the SoC changes. */ - - ccprintf("Test SoC < lower < upper.\n"); - display_soc = 780; - wait_charging_state(); - TEST_ASSERT(get_chg_ctrl_mode() == CHARGE_CONTROL_NORMAL); - ccprintf("Pass.\n"); - - ccprintf("Test lower < upper < SoC.\n"); - display_soc = 810; - wait_charging_state(); - TEST_ASSERT(get_chg_ctrl_mode() == CHARGE_CONTROL_DISCHARGE); - ccprintf("Pass.\n"); - - ccprintf("Test unplug AC.\n"); - gpio_set_level(GPIO_AC_PRESENT, 0); - wait_charging_state(); - TEST_ASSERT(get_chg_ctrl_mode() == CHARGE_CONTROL_NORMAL); - ccprintf("Pass.\n"); - - ccprintf("Test replug AC.\n"); - gpio_set_level(GPIO_AC_PRESENT, 1); - wait_charging_state(); - TEST_ASSERT(get_chg_ctrl_mode() == CHARGE_CONTROL_DISCHARGE); - ccprintf("Pass.\n"); - - ccprintf("Test lower < SoC < upper.\n"); - display_soc = 799; - wait_charging_state(); - TEST_ASSERT(get_chg_ctrl_mode() == CHARGE_CONTROL_DISCHARGE); - ccprintf("Pass.\n"); - - ccprintf("Test SoC < lower < upper.\n"); - display_soc = 789; - wait_charging_state(); - TEST_ASSERT(get_chg_ctrl_mode() == CHARGE_CONTROL_NORMAL); - ccprintf("Pass.\n"); - - ccprintf("Test disable sustainer.\n"); - charge_control(CHARGE_CONTROL_NORMAL); - display_soc = 810; - wait_charging_state(); - TEST_ASSERT(get_chg_ctrl_mode() == CHARGE_CONTROL_NORMAL); - ccprintf("Pass.\n"); - - ccprintf("Test enable sustainer when battery is full.\n"); - display_soc = 1000; - is_full = 1; - wait_charging_state(); - /* Enable sustainer. */ - p.cmd = EC_CHARGE_CONTROL_CMD_SET; - p.mode = CHARGE_CONTROL_NORMAL; - p.sustain_soc.lower = 79; - p.sustain_soc.upper = 80; - rv = test_send_host_command(EC_CMD_CHARGE_CONTROL, 2, - &p, sizeof(p), NULL, 0); - TEST_ASSERT(rv == EC_RES_SUCCESS); - wait_charging_state(); - TEST_ASSERT(get_chg_ctrl_mode() == CHARGE_CONTROL_DISCHARGE); - ccprintf("Pass.\n"); - - /* Disable sustainer, unplug AC, upper < SoC < 100. */ - charge_control(CHARGE_CONTROL_NORMAL); - display_soc = 810; - is_full = 0; - gpio_set_level(GPIO_AC_PRESENT, 0); - wait_charging_state(); - - ccprintf("Test enable sustainer when AC is present.\n"); - gpio_set_level(GPIO_AC_PRESENT, 1); - wait_charging_state(); - /* Enable sustainer. */ - p.cmd = EC_CHARGE_CONTROL_CMD_SET; - p.mode = CHARGE_CONTROL_NORMAL; - p.sustain_soc.lower = 79; - p.sustain_soc.upper = 80; - rv = test_send_host_command(EC_CMD_CHARGE_CONTROL, 2, - &p, sizeof(p), NULL, 0); - TEST_ASSERT(rv == EC_RES_SUCCESS); - wait_charging_state(); - TEST_ASSERT(get_chg_ctrl_mode() == CHARGE_CONTROL_DISCHARGE); - ccprintf("Pass.\n"); - - return EC_SUCCESS; -} - -static int test_battery_sustainer_discharge_idle(void) -{ - struct ec_params_charge_control p; - int rv; - - test_setup(1); - - /* Enable sustainer */ - p.cmd = EC_CHARGE_CONTROL_CMD_SET; - p.mode = CHARGE_CONTROL_NORMAL; - p.sustain_soc.lower = 80; - p.sustain_soc.upper = 80; - rv = test_send_host_command(EC_CMD_CHARGE_CONTROL, 2, - &p, sizeof(p), NULL, 0); - TEST_ASSERT(rv == EC_RES_SUCCESS); - - /* Check mode transition as the SoC changes. */ - - /* SoC < lower (= upper) */ - display_soc = 780; - wait_charging_state(); - TEST_ASSERT(get_chg_ctrl_mode() == CHARGE_CONTROL_NORMAL); - - /* (lower =) upper < SoC */ - display_soc = 810; - wait_charging_state(); - TEST_ASSERT(get_chg_ctrl_mode() == CHARGE_CONTROL_IDLE); - - /* Unplug AC. Sustainer gets deactivated. */ - gpio_set_level(GPIO_AC_PRESENT, 0); - wait_charging_state(); - TEST_ASSERT(get_chg_ctrl_mode() == CHARGE_CONTROL_NORMAL); - - /* Replug AC. Sustainer gets re-activated. */ - gpio_set_level(GPIO_AC_PRESENT, 1); - wait_charging_state(); - TEST_ASSERT(get_chg_ctrl_mode() == CHARGE_CONTROL_IDLE); - - /* lower = SoC = upper */ - display_soc = 800; - wait_charging_state(); - TEST_ASSERT(get_chg_ctrl_mode() == CHARGE_CONTROL_IDLE); - - /* SoC < lower (= upper) */ - display_soc = 789; - wait_charging_state(); - TEST_ASSERT(get_chg_ctrl_mode() == CHARGE_CONTROL_NORMAL); - - /* Disable sustainer */ - p.cmd = EC_CHARGE_CONTROL_CMD_SET; - p.mode = CHARGE_CONTROL_NORMAL; - p.sustain_soc.lower = -1; - p.sustain_soc.upper = -1; - rv = test_send_host_command(EC_CMD_CHARGE_CONTROL, 2, - &p, sizeof(p), NULL, 0); - TEST_ASSERT(rv == EC_RES_SUCCESS); - - /* This time, mode will stay in NORMAL even when upper < SoC. */ - display_soc = 810; - wait_charging_state(); - TEST_ASSERT(get_chg_ctrl_mode() == CHARGE_CONTROL_NORMAL); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - RUN_TEST(test_charge_state); - RUN_TEST(test_low_battery); - RUN_TEST(test_high_temp_battery); - RUN_TEST(test_cold_battery_with_ac); - RUN_TEST(test_cold_battery_no_ac); - RUN_TEST(test_external_funcs); - RUN_TEST(test_hc_charge_state); - RUN_TEST(test_hc_current_limit); - RUN_TEST(test_low_battery_hostevents); - RUN_TEST(test_battery_sustainer); - RUN_TEST(test_battery_sustainer_discharge_idle); - - test_print_result(); -} diff --git a/test/sbs_charging_v2.tasklist b/test/sbs_charging_v2.tasklist deleted file mode 100644 index 3895762986..0000000000 --- a/test/sbs_charging_v2.tasklist +++ /dev/null @@ -1,11 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \ - TASK_TEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) diff --git a/test/scratchpad.c b/test/scratchpad.c deleted file mode 100644 index 1bea76f7a1..0000000000 --- a/test/scratchpad.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright 2020 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 "system.h" -#include "test_util.h" - -/** - * The first time this test runs, it should pass. After rebooting, the test - * should fail because the scratchpad register is set to 1. - */ -test_static int test_scratchpad(void) -{ - int rv; - uint32_t scratch; - - TEST_EQ(system_get_scratchpad(&scratch), EC_SUCCESS, "%d"); - TEST_EQ(scratch, 0, "%d"); - - rv = system_set_scratchpad(1); - TEST_EQ(rv, EC_SUCCESS, "%d"); - - TEST_EQ(system_get_scratchpad(&scratch), EC_SUCCESS, "%d"); - TEST_EQ(scratch, 1, "%d"); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - RUN_TEST(test_scratchpad); - test_print_result(); -} diff --git a/test/scratchpad.tasklist b/test/scratchpad.tasklist deleted file mode 100644 index 51734f058d..0000000000 --- a/test/scratchpad.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2020 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* no tasks */ diff --git a/test/sha256.c b/test/sha256.c deleted file mode 100644 index 105ae8fec5..0000000000 --- a/test/sha256.c +++ /dev/null @@ -1,220 +0,0 @@ -/* Copyright 2017 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. - * - * Tests SHA256 implementation. - */ - -#include "console.h" -#include "common.h" -#include "sha256.h" -#include "test_util.h" -#include "util.h" - -/* Short Msg from NIST FIPS 180-4 (Len = 8) */ -static const uint8_t sha256_8_input[] = { - 0xd3 -}; -static const uint8_t sha256_8_output[SHA256_DIGEST_SIZE] = { - 0x28, 0x96, 0x9c, 0xdf, 0xa7, 0x4a, 0x12, 0xc8, 0x2f, 0x3b, 0xad, 0x96, - 0x0b, 0x0b, 0x00, 0x0a, 0xca, 0x2a, 0xc3, 0x29, 0xde, 0xea, 0x5c, 0x23, - 0x28, 0xeb, 0xc6, 0xf2, 0xba, 0x98, 0x02, 0xc1 -}; - -/* Short Msg from NIST FIPS 180-4 (Len = 72) */ -static const uint8_t sha256_72_input[] = { - 0x33, 0x34, 0xc5, 0x80, 0x75, 0xd3, 0xf4, 0x13, 0x9e -}; -static const uint8_t sha256_72_output[SHA256_DIGEST_SIZE] = { - 0x07, 0x8d, 0xa3, 0xd7, 0x7e, 0xd4, 0x3b, 0xd3, 0x03, 0x7a, 0x43, 0x3f, - 0xd0, 0x34, 0x18, 0x55, 0x02, 0x37, 0x93, 0xf9, 0xaf, 0xd0, 0x8b, 0x4b, - 0x08, 0xea, 0x1e, 0x55, 0x97, 0xce, 0xef, 0x20 -}; - -/* Long Msg from NIST FIPS 180-4 (Len = 2888) */ -static const uint8_t sha256_2888_input[] = { - 0x82, 0x82, 0x96, 0x90, 0xaa, 0x37, 0x33, 0xc6, 0x2b, 0x90, 0xd3, 0x29, - 0x78, 0x86, 0x95, 0x2f, 0xc1, 0xdc, 0x47, 0x3d, 0x67, 0xbb, 0x7d, 0x6b, - 0xb2, 0x99, 0xe0, 0x88, 0xc6, 0x5f, 0xc9, 0x5e, 0xd3, 0xca, 0x0f, 0x36, - 0x8d, 0x11, 0x1d, 0x9f, 0xdc, 0xc9, 0x47, 0x6c, 0xd4, 0x06, 0x5e, 0xfc, - 0xe7, 0xc4, 0x81, 0xbe, 0x59, 0x85, 0x37, 0xf3, 0xf5, 0x3b, 0xbb, 0xb6, - 0xff, 0x67, 0x97, 0x3a, 0x69, 0x83, 0x74, 0x54, 0x49, 0x9e, 0x31, 0x39, - 0x8b, 0x46, 0x32, 0x88, 0xe3, 0xaa, 0xfb, 0x8b, 0x06, 0x00, 0xfd, 0xba, - 0x1a, 0x25, 0xaf, 0x80, 0x6b, 0x83, 0xe1, 0x42, 0x5f, 0x38, 0x4e, 0x9e, - 0xac, 0x75, 0x70, 0xf0, 0xc8, 0x23, 0x98, 0x1b, 0xa2, 0xcd, 0x3d, 0x86, - 0x8f, 0xba, 0x94, 0x64, 0x87, 0x59, 0x62, 0x39, 0x91, 0xe3, 0x0f, 0x99, - 0x7c, 0x3b, 0xfb, 0x33, 0xd0, 0x19, 0x15, 0x0f, 0x04, 0x67, 0xa9, 0x14, - 0xf1, 0xeb, 0x79, 0xcd, 0x87, 0x27, 0x10, 0x6d, 0xbf, 0x7d, 0x53, 0x10, - 0xd0, 0x97, 0x59, 0x43, 0xa6, 0x06, 0x7c, 0xc7, 0x90, 0x29, 0xb0, 0x92, - 0x39, 0x51, 0x14, 0x17, 0xd9, 0x22, 0xc7, 0xc7, 0xac, 0x3d, 0xfd, 0xd8, - 0xa4, 0x1c, 0x52, 0x45, 0x5b, 0x3c, 0x5e, 0x16, 0x4b, 0x82, 0x89, 0xe1, - 0x41, 0xd8, 0x20, 0x91, 0x0f, 0x17, 0xa9, 0x66, 0x81, 0x29, 0x74, 0x3d, - 0x93, 0x6f, 0x73, 0x12, 0xe1, 0x60, 0x4b, 0xc3, 0x5f, 0x73, 0xab, 0x16, - 0x4a, 0x3f, 0xdd, 0xfe, 0x5f, 0xe1, 0x9b, 0x1a, 0x4a, 0x9f, 0x23, 0x7f, - 0x61, 0xcb, 0x8e, 0xb7, 0x92, 0xe9, 0x5d, 0x09, 0x9a, 0x14, 0x55, 0xfb, - 0x78, 0x9d, 0x8d, 0x16, 0x22, 0xf6, 0xc5, 0xe9, 0x76, 0xce, 0xf9, 0x51, - 0x73, 0x7e, 0x36, 0xf7, 0xa9, 0xa4, 0xad, 0x19, 0xee, 0x0d, 0x06, 0x8e, - 0x53, 0xd9, 0xf6, 0x04, 0x57, 0xd9, 0x14, 0x8d, 0x5a, 0x3c, 0xe8, 0x5a, - 0x54, 0x6b, 0x45, 0xc5, 0xc6, 0x31, 0xd9, 0x95, 0xf1, 0x1f, 0x03, 0x7e, - 0x47, 0x2f, 0xe4, 0xe8, 0x1f, 0xa7, 0xb9, 0xf2, 0xac, 0x40, 0x68, 0xb5, - 0x30, 0x88, 0x58, 0xcd, 0x6d, 0x85, 0x86, 0x16, 0x5c, 0x9b, 0xd6, 0xb3, - 0x22, 0xaf, 0xa7, 0x55, 0x40, 0x8d, 0xa9, 0xb9, 0x0a, 0x87, 0xf3, 0x73, - 0x5a, 0x5f, 0x50, 0xeb, 0x85, 0x68, 0xda, 0xa5, 0x8e, 0xe7, 0xcb, 0xc5, - 0x9a, 0xbf, 0x8f, 0xd2, 0xa4, 0x4e, 0x1e, 0xba, 0x72, 0x92, 0x88, 0x16, - 0xc8, 0x90, 0xd1, 0xb0, 0xdb, 0xf6, 0x00, 0x42, 0x08, 0xff, 0x73, 0x81, - 0xc6, 0x97, 0x75, 0x5a, 0xda, 0xc0, 0x13, 0x7c, 0xca, 0x34, 0x2b, 0x16, - 0x93 -}; -static const uint8_t sha256_2888_output[SHA256_DIGEST_SIZE] = { - 0x5f, 0x4e, 0x16, 0xa7, 0x2d, 0x6c, 0x98, 0x57, 0xda, 0x0b, 0xa0, 0x09, - 0xcc, 0xac, 0xd4, 0xf2, 0x6d, 0x7f, 0x6b, 0xf6, 0xc1, 0xb7, 0x8a, 0x2e, - 0xd3, 0x5e, 0x68, 0xfc, 0xb1, 0x5b, 0x8e, 0x40 -}; - -/* HMAC short key (40 bytes) from NIST FIPS 198-1 (Count = 34) */ -static const uint8_t hmac_short_msg[] = { - 0x49, 0x53, 0x40, 0x8b, 0xe3, 0xdd, 0xde, 0x42, 0x52, 0x1e, 0xb6, 0x25, - 0xa3, 0x7a, 0xf0, 0xd2, 0xcf, 0x9e, 0xd1, 0x84, 0xf5, 0xb6, 0x27, 0xe5, - 0xe7, 0xe0, 0xe8, 0x24, 0xe8, 0xe1, 0x16, 0x48, 0xb4, 0x18, 0xe5, 0xc4, - 0xc1, 0xb0, 0x20, 0x4b, 0xc5, 0x19, 0xc9, 0xe5, 0x78, 0xb8, 0x00, 0x43, - 0x9b, 0xdd, 0x25, 0x4f, 0x39, 0xf6, 0x41, 0x08, 0x2d, 0x03, 0xa2, 0x8d, - 0xe4, 0x4a, 0xc6, 0x77, 0x64, 0x4c, 0x7b, 0x6c, 0x8d, 0xf7, 0x43, 0xf2, - 0x9f, 0x1d, 0xfd, 0x80, 0xfd, 0x25, 0xc2, 0xdb, 0x31, 0x01, 0x0e, 0xa0, - 0x2f, 0x60, 0x20, 0x1c, 0xde, 0x24, 0xa3, 0x64, 0xd4, 0x16, 0x8d, 0xa2, - 0x61, 0xd8, 0x48, 0xae, 0xd0, 0x1c, 0x10, 0xde, 0xe9, 0x14, 0x9c, 0x1e, - 0xbb, 0x29, 0x00, 0x43, 0x98, 0xf0, 0xd2, 0x9c, 0x60, 0x5a, 0x8b, 0xca, - 0x03, 0x2b, 0x31, 0xd2, 0x41, 0xad, 0x33, 0x71 -}; -static const uint8_t hmac_short_key[] = { - 0x9d, 0xa0, 0xc1, 0x14, 0x68, 0x2f, 0x82, 0xc1, 0xd1, 0xe9, 0xb5, 0x44, - 0x30, 0x58, 0x0b, 0x9c, 0x56, 0x94, 0x89, 0xca, 0x16, 0xb9, 0x2e, 0xe1, - 0x04, 0x98, 0xd5, 0x5d, 0x7c, 0xad, 0x5d, 0xb5, 0xe6, 0x52, 0x06, 0x34, - 0x39, 0x31, 0x1e, 0x04 -}; -static const uint8_t hmac_short_output[] = { - 0xcd, 0xea, 0xcf, 0xce, 0xbf, 0x46, 0xcc, 0x9d, 0x7e, 0x4d, 0x41, 0x75, - 0xe5, 0xd8, 0xd2, 0x67, 0xc2, 0x3a, 0x64, 0xcd, 0xe8, 0x3e, 0x86, 0x7e, - 0x50, 0x01, 0xec, 0xf2, 0x6f, 0xbd, 0x30, 0xd2 -}; - -/* HMAC medium key (64 bytes) from NIST FIPS 198-1 (Count = 120) */ -static const uint8_t hmac_medium_msg[] = { - 0xed, 0x4f, 0x26, 0x9a, 0x88, 0x51, 0xeb, 0x31, 0x54, 0x77, 0x15, 0x16, - 0xb2, 0x72, 0x28, 0x15, 0x52, 0x00, 0x77, 0x80, 0x49, 0xb2, 0xdc, 0x19, - 0x63, 0xf3, 0xac, 0x32, 0xba, 0x46, 0xea, 0x13, 0x87, 0xcf, 0xbb, 0x9c, - 0x39, 0x15, 0x1a, 0x2c, 0xc4, 0x06, 0xcd, 0xc1, 0x3c, 0x3c, 0x98, 0x60, - 0xa2, 0x7e, 0xb0, 0xb7, 0xfe, 0x8a, 0x72, 0x01, 0xad, 0x11, 0x55, 0x2a, - 0xfd, 0x04, 0x1e, 0x33, 0xf7, 0x0e, 0x53, 0xd9, 0x7c, 0x62, 0xf1, 0x71, - 0x94, 0xb6, 0x61, 0x17, 0x02, 0x8f, 0xa9, 0x07, 0x1c, 0xc0, 0xe0, 0x4b, - 0xd9, 0x2d, 0xe4, 0x97, 0x2c, 0xd5, 0x4f, 0x71, 0x90, 0x10, 0xa6, 0x94, - 0xe4, 0x14, 0xd4, 0x97, 0x7a, 0xbe, 0xd7, 0xca, 0x6b, 0x90, 0xba, 0x61, - 0x2d, 0xf6, 0xc3, 0xd4, 0x67, 0xcd, 0xed, 0x85, 0x03, 0x25, 0x98, 0xa4, - 0x85, 0x46, 0x80, 0x4f, 0x9c, 0xf2, 0xec, 0xfe -}; -static const uint8_t hmac_medium_key[] = { - 0x99, 0x28, 0x68, 0x50, 0x4d, 0x25, 0x64, 0xc4, 0xfb, 0x47, 0xbc, 0xbd, - 0x4a, 0xe4, 0x82, 0xd8, 0xfb, 0x0e, 0x8e, 0x56, 0xd7, 0xb8, 0x18, 0x64, - 0xe6, 0x19, 0x86, 0xa0, 0xe2, 0x56, 0x82, 0xda, 0xeb, 0x5b, 0x50, 0x17, - 0x7c, 0x09, 0x5e, 0xdc, 0x9e, 0x97, 0x1d, 0xa9, 0x5c, 0x32, 0x10, 0xc3, - 0x76, 0xe7, 0x23, 0x36, 0x5a, 0xc3, 0x3d, 0x1b, 0x4f, 0x39, 0x18, 0x17, - 0xf4, 0xc3, 0x51, 0x24 -}; -static const uint8_t hmac_medium_output[] = { - 0x2f, 0x83, 0x21, 0xf4, 0x16, 0xb9, 0xbb, 0x24, 0x9f, 0x11, 0x3b, 0x13, - 0xfc, 0x12, 0xd7, 0x0e, 0x16, 0x68, 0xdc, 0x33, 0x28, 0x39, 0xc1, 0x0d, - 0xaa, 0x57, 0x17, 0x89, 0x6c, 0xb7, 0x0d, 0xdf -}; - -static int test_sha256(const uint8_t *input, int input_len, - const uint8_t *output) -{ - struct sha256_ctx ctx; - uint8_t *tmp; - int i; - - /* Basic test */ - SHA256_init(&ctx); - SHA256_update(&ctx, input, input_len); - tmp = SHA256_final(&ctx); - - if (memcmp(tmp, output, SHA256_DIGEST_SIZE) != 0) { - ccprintf("SHA256 test failed\n"); - return 0; - } - - /* Splitting the input string in chunks of 1 byte also works. */ - SHA256_init(&ctx); - for (i = 0; i < input_len; i++) - SHA256_update(&ctx, &input[i], 1); - tmp = SHA256_final(&ctx); - - if (memcmp(tmp, output, SHA256_DIGEST_SIZE) != 0) { - ccprintf("SHA256 test failed (1-byte chunks)\n"); - return 0; - } - - return 1; -} - -static int test_hmac(const uint8_t *key, int key_len, - const uint8_t *input, int input_len, - const uint8_t *output) -{ - uint8_t tmp[SHA256_DIGEST_SIZE]; - - hmac_SHA256(tmp, key, key_len, input, input_len); - - if (memcmp(tmp, output, SHA256_DIGEST_SIZE) != 0) { - ccprintf("hmac_SHA256 test failed\n"); - return 0; - } - - return 1; -} - -void run_test(int argc, char **argv) -{ - ccprintf("Testing short message (8 bytes)\n"); - if (!test_sha256(sha256_8_input, sizeof(sha256_8_input), - sha256_8_output)) { - test_fail(); - return; - } - - ccprintf("Testing short message (72 bytes)\n"); - if (!test_sha256(sha256_72_input, sizeof(sha256_72_input), - sha256_72_output)) { - test_fail(); - return; - } - - ccprintf("Testing long message (2888 bytes)\n"); - if (!test_sha256(sha256_2888_input, sizeof(sha256_2888_input), - sha256_2888_output)) { - test_fail(); - return; - } - - ccprintf("HMAC: Testing short key\n"); - if (!test_hmac(hmac_short_key, sizeof(hmac_short_key), - hmac_short_msg, sizeof(hmac_short_msg), - hmac_short_output)) { - test_fail(); - return; - } - - ccprintf("HMAC: Testing medium key\n"); - if (!test_hmac(hmac_medium_key, sizeof(hmac_medium_key), - hmac_medium_msg, sizeof(hmac_medium_msg), - hmac_medium_output)) { - test_fail(); - return; - } - - /* - * Note: Our HMAC implementation does not support longer than - * 64 bytes keys. - */ - - test_pass(); -} diff --git a/test/sha256.tasklist b/test/sha256.tasklist deleted file mode 100644 index 80072bb620..0000000000 --- a/test/sha256.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2017 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST diff --git a/test/sha256_unrolled.tasklist b/test/sha256_unrolled.tasklist deleted file mode 120000 index 06d8620957..0000000000 --- a/test/sha256_unrolled.tasklist +++ /dev/null @@ -1 +0,0 @@ -sha256.tasklist
\ No newline at end of file diff --git a/test/shmalloc.c b/test/shmalloc.c deleted file mode 100644 index a596d173e7..0000000000 --- a/test/shmalloc.c +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Copyright 2016 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 <stddef.h> -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> - -#include "common.h" -#include "compile_time_macros.h" -#include "console.h" -#include "link_defs.h" -#include "shared_mem.h" -#include "test_util.h" - -/* - * Total size of memory in the malloc pool (shared between free and allocated - * buffers. - */ -static int total_size; - -/* - * Number of randomized allocation/free attempts, large enough to execute all - * branches in the malloc/free module. - */ -static int counter = 500000; - -/* - * A good random number generator approximation. Guaranteed to generate the - * same sequence on all test runs. - */ -static uint32_t next = 127; -static uint32_t myrand(void) -{ - next = next * 1103515245 + 12345; - return ((uint32_t)(next/65536) % 32768); -} - -/* Keep track of buffers allocated by the test function. */ -static struct { - void *buf; - size_t buffer_size; -} allocations[12]; /* Up to 12 buffers could be allocated concurrently. */ - -/* - * Verify that allocated and free buffers do not overlap, and that our and - * malloc's ideas of the number of allocated buffers match. - */ - -static int check_for_overlaps(void) -{ - int i; - int allocation_match; - int allocations_count, allocated_count; - - allocations_count = allocated_count = 0; - for (i = 0; i < ARRAY_SIZE(allocations); i++) { - struct shm_buffer *allocced_buf; - - if (!allocations[i].buf) - continue; - - /* - * Indication of finding the allocated buffer in internal - * malloc structures. - */ - allocation_match = 0; - - /* number of buffers allocated by the test program. */ - allocations_count++; - - /* - * Number of allocated buffers malloc knows about, calculated - * multiple times to keep things simple. - */ - allocated_count = 0; - for (allocced_buf = allocced_buf_chain; - allocced_buf; - allocced_buf = allocced_buf->next_buffer) { - int allocated_size, allocation_size; - - allocated_count++; - if (allocations[i].buf != (allocced_buf + 1)) - continue; - - allocated_size = allocced_buf->buffer_size; - allocation_size = allocations[i].buffer_size; - - /* - * Verify that size requested by the allocator matches - * the value used by malloc, i.e. does not exceed the - * allocated size and is no less than two buffer - * structures lower (which can happen when the - * requested size was rounded up to cover gaps smaller - * than the buffer header structure size). - */ - if ((allocation_size > allocated_size) || - ((allocated_size - allocation_size) >= - (2 * sizeof(struct shm_buffer) + sizeof(int)))) { - ccprintf("inconsistency: allocated (size %d)" - " allocation %d(size %d)\n", - allocated_size, i, allocation_size); - return 0; - } - - if (allocation_match++) { - ccprintf("inconsistency: duplicated match\n"); - return 0; - } - } - if (!allocation_match) { - ccprintf("missing match %pP!\n", allocations[i].buf); - return 0; - } - } - if (allocations_count != allocated_count) { - ccprintf("count mismatch (%d != %d)!\n", - allocations_count, allocated_count); - return 0; - } - return 1; -} - -/* - * Verify that shared memory is in a consistent state, i.e. that there is no - * overlaps between allocated and free buffers, and that all memory is - * accounted for (is either allocated or available). - */ - -static int shmem_is_ok(int line) -{ - int count = 0; - int running_size = 0; - struct shm_buffer *pbuf = free_buf_chain; - - if (pbuf && pbuf->prev_buffer) { - ccprintf("Bad free buffer list start %pP\n", pbuf); - goto bailout; - } - - while (pbuf) { - struct shm_buffer *top; - - running_size += pbuf->buffer_size; - if (count++ > 100) - goto bailout; /* Is there a loop? */ - - top = (struct shm_buffer *)((uintptr_t)pbuf + - pbuf->buffer_size); - if (pbuf->next_buffer) { - if (top >= pbuf->next_buffer) { - ccprintf("%s:%d" - " - inconsistent buffer size at %pP\n", - __func__, __LINE__, pbuf); - goto bailout; - } - if (pbuf->next_buffer->prev_buffer != pbuf) { - ccprintf("%s:%d" - " - inconsistent next buffer at %pP\n", - __func__, __LINE__, pbuf); - goto bailout; - } - } - pbuf = pbuf->next_buffer; - } - - if (pbuf) { /* Must be a loop. */ - ccprintf("Too many buffers in the chain\n"); - goto bailout; - } - - /* Make sure there were at least 5 buffers allocated at one point. */ - if (count > 5) - set_map_bit(1 << 24); - - /* Add allocated sizes. */ - for (pbuf = allocced_buf_chain; pbuf; pbuf = pbuf->next_buffer) - running_size += pbuf->buffer_size; - - if (total_size) { - if (total_size != running_size) - goto bailout; - } else { - /* Remember total size for future reference. */ - total_size = running_size; - } - - if (!check_for_overlaps()) - goto bailout; - - return 1; - - bailout: - ccprintf("Line %d, counter %d. The list has been corrupted, " - "total size %d, running size %d\n", - line, counter, total_size, running_size); - return 0; -} - -/* - * Bitmap used to keep track of branches taken by malloc/free routines. Once - * all bits in the 0..(MAX_MASK_BIT - 1) range are set, consider the test - * completed. - */ -static uint32_t test_map; - -void run_test(int argc, char **argv) -{ - int index; - const int shmem_size = shared_mem_size(); - - while (counter--) { - char *shptr; - uint32_t r_data; - - r_data = myrand(); - - if (!(counter % 50000)) - ccprintf("%d\n", counter); - - /* - * If all bits we care about are set in the map - the test is - * over. - */ - if ((test_map & ALL_PATHS_MASK) == ALL_PATHS_MASK) { - if (test_map & ~ALL_PATHS_MASK) { - ccprintf("Unexpected mask bits set: %x" - ", counter %d\n", - test_map & ~ALL_PATHS_MASK, - counter); - test_fail(); - return; - } - ccprintf("Done testing, counter at %d\n", counter); - test_pass(); - return; - } - - /* Pick a random allocation entry. */ - index = r_data % ARRAY_SIZE(allocations); - if (allocations[index].buf) { - /* - * If there is a buffer associated with the entry - - * release it. - */ - shared_mem_release(allocations[index].buf); - allocations[index].buf = 0; - if (!shmem_is_ok(__LINE__)) { - test_fail(); - return; - } - } else { - size_t alloc_size = r_data % (shmem_size / 2); - - /* - * If the allocation entry is empty - allocate a - * buffer of a random size up to max shared memory. - */ - if (shared_mem_acquire(alloc_size, &shptr) == - EC_SUCCESS) { - allocations[index].buf = (void *) shptr; - allocations[index].buffer_size = alloc_size; - - /* - * Make sure every allocated byte is - * modified. - */ - while (alloc_size--) - shptr[alloc_size] = - shptr[alloc_size] ^ 0xff; - - if (!shmem_is_ok(__LINE__)) { - test_fail(); - return; - } - } - } - } - - /* - * The test is over, free all still allcated buffers, if any. Keep - * verifying memory consistency after each free() invocation. - */ - for (index = 0; index < ARRAY_SIZE(allocations); index++) - if (allocations[index].buf) { - shared_mem_release(allocations[index].buf); - allocations[index].buf = NULL; - if (!shmem_is_ok(__LINE__)) { - test_fail(); - return; - } - } - - ccprintf("Did not pass all paths, map %x != %x\n", - test_map, ALL_PATHS_MASK); - test_fail(); -} - -void set_map_bit(uint32_t mask) -{ - test_map |= mask; -} diff --git a/test/shmalloc.tasklist b/test/shmalloc.tasklist deleted file mode 100644 index a8ef01a489..0000000000 --- a/test/shmalloc.tasklist +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright 2016 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST - diff --git a/test/static_if.c b/test/static_if.c deleted file mode 100644 index f70f7d30c3..0000000000 --- a/test/static_if.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright 2019 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. - */ - -/* Test the STATIC_IF and STATIC_IF_NOT macros. */ - -#include "common.h" -#include "test_util.h" - -#undef CONFIG_UNDEFINED -#define CONFIG_BLANK - -STATIC_IF(CONFIG_UNDEFINED) int this_var_is_extern; -STATIC_IF_NOT(CONFIG_BLANK) int this_var_is_extern_too; -STATIC_IF(CONFIG_BLANK) int this_var_is_static; -STATIC_IF_NOT(CONFIG_UNDEFINED) int this_var_is_static_too; - -static int test_static_if_blank(void) -{ - TEST_ASSERT(this_var_is_static == 0); - TEST_ASSERT(this_var_is_static_too == 0); - - return EC_SUCCESS; -} - -static int test_static_if_unused_no_fail(void) -{ - /* - * This should not cause linker errors because the variables - * go unused (usage is optimized away). - */ - if (IS_ENABLED(CONFIG_UNDEFINED)) - this_var_is_extern = 1; - - if (!IS_ENABLED(CONFIG_BLANK)) - this_var_is_extern_too = 1; - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_static_if_blank); - RUN_TEST(test_static_if_unused_no_fail); - - test_print_result(); -} diff --git a/test/static_if.tasklist b/test/static_if.tasklist deleted file mode 100644 index 5ffe662d01..0000000000 --- a/test/static_if.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/static_if_error.c b/test/static_if_error.c deleted file mode 100644 index 65882b3bbd..0000000000 --- a/test/static_if_error.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright 2019 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. - */ - -/* - * Test the STATIC_IF and STATIC_IF_NOT macros fail on unexpected - * input. - */ - -#include "common.h" -#include "test_util.h" - -#define CONFIG_FOO TEST_VALUE - -/* - * At compiler invocation, define TEST_MACRO to STATIC_IF or - * STATIC_IF_NOT. - */ -#ifndef TEST_MACRO -#error "This error should not be seen in the compiler output!" -#endif - -/* This is intended to cause a compilation error. */ -TEST_MACRO(CONFIG_FOO) __maybe_unused int foo; - -void run_test(int argc, char **argv) -{ - test_reset(); - - /* Nothing to do, observe compilation error */ - - test_print_result(); -} diff --git a/test/static_if_error.sh b/test/static_if_error.sh deleted file mode 100644 index efc7cd3e1e..0000000000 --- a/test/static_if_error.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -e -# Copyright 2019 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. - -# This file is implemented similar to is_enabled_error.sh - -TEST_DIR="$(dirname "${BASH_SOURCE[0]}")" -TEST_CMD="$(cat "${TEST_DIR}/RO/test/static_if_error.o.cmd")" -TEST_ERROR_COUNT=0 -BAD_ERROR_MSG="This error should not be seen in the compiler output!" - -fail() { - echo "Fail" - echo "$1" - echo "$BUILD_OUTPUT" - TEST_ERROR_COUNT=$((TEST_ERROR_COUNT+1)) -} - -for test_macro in STATIC_IF STATIC_IF_NOT; do - for test_value in 0 1 2 A "5 + 5"; do - echo -n "Running TEST_MACRO=${test_macro} TEST_VALUE=${test_value}..." - TEST_CMD_COMPLETE=" - ${TEST_CMD} \"-DTEST_MACRO=${test_macro}\" \"-DTEST_VALUE=${test_value}\"" - echo "$TEST_CMD_COMPLETE" - if BUILD_OUTPUT="$(sh -c "$TEST_CMD_COMPLETE" 2>&1)"; then - fail "Compilation should not have succeeded." - continue - fi - - if grep -q "$BAD_ERROR_MSG" <<<"$BUILD_OUTPUT"; then - fail "TEST_MACRO was not defined." - continue - fi - done -done - -if [[ $TEST_ERROR_COUNT -eq 0 ]]; then - echo "Pass!" -else - echo "Fail! (${TEST_ERROR_COUNT} tests)" -fi diff --git a/test/static_if_error.tasklist b/test/static_if_error.tasklist deleted file mode 100644 index 5ffe662d01..0000000000 --- a/test/static_if_error.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/stillness_detector.c b/test/stillness_detector.c deleted file mode 100644 index e881525491..0000000000 --- a/test/stillness_detector.c +++ /dev/null @@ -1,139 +0,0 @@ -/* Copyright 2019 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 "stillness_detector.h" -#include "motion_sense.h" -#include "test_util.h" -#include "timer.h" -#include <stdio.h> - -/*****************************************************************************/ -/* - * Need to define motion sensor globals just to compile. - * We include motion task to force the inclusion of math_util.c - */ -struct motion_sensor_t motion_sensors[] = {}; -const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); - -static int test_build_still_det_struct(void) -{ - struct still_det det = STILL_DET(0.00025f, 800 * MSEC, 1200 * MSEC, 5); - - TEST_NEAR(det.var_threshold, 0.00025f, 0.000001f, "%f"); - TEST_EQ(det.min_batch_window, 800 * MSEC, "%u"); - TEST_EQ(det.max_batch_window, 1200 * MSEC, "%u"); - TEST_EQ(det.min_batch_size, 5, "%u"); - - return EC_SUCCESS; -} - -static int test_not_still_short_window(void) -{ - struct still_det det = STILL_DET(0.00025f, 800 * MSEC, 1200 * MSEC, 5); - int i; - - for (i = 0; i < 6; ++i) - TEST_ASSERT(!still_det_update(&det, i * 100 * MSEC, - 0.0f, 0.0f, 0.0f)); - - return EC_SUCCESS; -} - -static int test_not_still_long_window(void) -{ - struct still_det det = STILL_DET(0.00025f, 800 * MSEC, 1200 * MSEC, 5); - int i; - - for (i = 0; i < 5; ++i) - TEST_ASSERT(!still_det_update(&det, i * 300 * MSEC, - 0.0f, 0.0f, 0.0f)); - - return EC_SUCCESS; -} - -static int test_not_still_not_enough_samples(void) -{ - struct still_det det = STILL_DET(0.00025f, 800 * MSEC, 1200 * MSEC, 5); - int i; - - for (i = 0; i < 4; ++i) - TEST_ASSERT(!still_det_update(&det, i * 200 * MSEC, - 0.0f, 0.0f, 0.0f)); - - return EC_SUCCESS; -} - -static int test_is_still_all_axes(void) -{ - struct still_det det = STILL_DET(0.00025f, 800 * MSEC, 1200 * MSEC, 5); - int i; - - for (i = 0; i < 9; ++i) { - int result = still_det_update(&det, i * 100 * MSEC, - i * 0.001f, i * 0.001f, - i * 0.001f); - - TEST_EQ(result, i == 8 ? 1 : 0, "%d"); - } - TEST_NEAR(det.mean_x, 0.004f, 0.0001f, "%f"); - TEST_NEAR(det.mean_y, 0.004f, 0.0001f, "%f"); - TEST_NEAR(det.mean_z, 0.004f, 0.0001f, "%f"); - - return EC_SUCCESS; -} - -static int test_not_still_one_axis(void) -{ - struct still_det det = STILL_DET(0.00025f, 800 * MSEC, 1200 * MSEC, 5); - int i; - - for (i = 0; i < 9; ++i) { - TEST_ASSERT(!still_det_update(&det, i * 100 * MSEC, - i * 0.001f, i * 0.001f, - i * 0.01f)); - } - - return EC_SUCCESS; -} - -static int test_resets(void) -{ - struct still_det det = STILL_DET(0.00025f, 800 * MSEC, 1200 * MSEC, 5); - int i; - - for (i = 0; i < 9; ++i) { - TEST_ASSERT(!still_det_update(&det, i * 100 * MSEC, - i * 0.001f, i * 0.001f, - i * 0.01f)); - } - - for (i = 0; i < 9; ++i) { - int result = still_det_update(&det, i * 100 * MSEC, - i * 0.001f, i * 0.001f, - i * 0.001f); - - TEST_EQ(result, i == 8 ? 1 : 0, "%d"); - } - TEST_NEAR(det.mean_x, 0.004f, 0.0001f, "%f"); - TEST_NEAR(det.mean_y, 0.004f, 0.0001f, "%f"); - TEST_NEAR(det.mean_z, 0.004f, 0.0001f, "%f"); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_build_still_det_struct); - RUN_TEST(test_not_still_short_window); - RUN_TEST(test_not_still_long_window); - RUN_TEST(test_not_still_not_enough_samples); - RUN_TEST(test_is_still_all_axes); - RUN_TEST(test_not_still_one_axis); - RUN_TEST(test_resets); - - test_print_result(); -} diff --git a/test/stillness_detector.tasklist b/test/stillness_detector.tasklist deleted file mode 100644 index 5ffe662d01..0000000000 --- a/test/stillness_detector.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/stm32f_rtc.c b/test/stm32f_rtc.c deleted file mode 100644 index 0e60fcb73f..0000000000 --- a/test/stm32f_rtc.c +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright 2020 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 "clock-f.h" -#include "test_util.h" - -static uint32_t rtc_fired; -static struct rtc_time_reg rtc_irq; -static const int rtc_delay_ms = 500; - -/* - * We will be testing that the RTC interrupt timestamp occurs - * within +/- delay_tol_us (tolerance) of the above rtc_delay_ms. - */ -static const int delay_tol_us = MSEC / 2; - -/* Override default RTC interrupt handler */ -void __rtc_alarm_irq(void) -{ - atomic_add(&rtc_fired, 1); - reset_rtc_alarm(&rtc_irq); -} - -test_static int test_rtc_alarm(void) -{ - struct rtc_time_reg rtc; - uint32_t rtc_diff_us; - const int delay_us = rtc_delay_ms * MSEC; - - set_rtc_alarm(0, delay_us, &rtc, 0); - - msleep(2 * rtc_delay_ms); - - /* Make sure the interrupt fired exactly once. */ - TEST_EQ(1, atomic_clear(&rtc_fired), "%d"); - - rtc_diff_us = get_rtc_diff(&rtc, &rtc_irq); - - ccprintf("Target delay was %dus\n", delay_us); - ccprintf("Actual delay was %dus\n", rtc_diff_us); - ccprintf("The delays are expected to be within +/- %dus\n", MSEC / 2); - - /* Assume we'll always fire within 500us. May need to be adjusted if - * this doesn't hold. - * - * delay_us-delay_tol_us < rtc_diff_us < delay_us+delay_tol_us - */ - TEST_LT(delay_us - delay_tol_us, rtc_diff_us, "%dus"); - TEST_LT(rtc_diff_us, delay_us + delay_tol_us, "%dus"); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_rtc_alarm); - - test_print_result(); -} diff --git a/test/stm32f_rtc.tasklist b/test/stm32f_rtc.tasklist deleted file mode 100644 index 51734f058d..0000000000 --- a/test/stm32f_rtc.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2020 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* no tasks */ diff --git a/test/stress.c b/test/stress.c deleted file mode 100644 index 91a65197f8..0000000000 --- a/test/stress.c +++ /dev/null @@ -1,143 +0,0 @@ -/* Copyright 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. - */ - -/* Peripheral stress tests */ - -#include "console.h" -#include "ec_commands.h" -#include "i2c.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -#ifdef CONFIG_ADC -#include "adc.h" -#endif - -static int error_count; - -/*****************************************************************************/ -/* Test parameters */ - -/* I2C test */ -#define I2C_TEST_ITERATION 2000 - -struct i2c_test_param_t { - int width; /* 8 or 16 bits */ - int port; - int addr; - int offset; - int data; /* Non-negative represents data to write. -1 to read. */ -} i2c_test_params[]; - -/* Disable I2C test for boards without test configuration */ -#if defined(BOARD_BDS) || defined(BOARD_AURON) -#undef CONFIG_I2C -#endif - -/* ADC test */ -#define ADC_TEST_ITERATION 2000 - -/*****************************************************************************/ -/* Test utilities */ - -/* period between 500us and 32ms */ -#define RAND_US() (((prng_no_seed() % 64) + 1) * 500) - -static int stress(const char *name, - int (*test_routine)(void), - const int iteration) -{ - int i; - - for (i = 0; i < iteration; ++i) { - if (i % 10 == 0) { - ccprintf("\r%s...%d/%d", name, i, iteration); - usleep(RAND_US()); - } - if (test_routine() != EC_SUCCESS) - return EC_ERROR_UNKNOWN; - } - - ccprintf("\r%s...%d/%d\n", name, iteration, iteration); - return EC_SUCCESS; -} - -#define RUN_STRESS_TEST(n, r, iter) \ - do { \ - if (stress(n, r, iter) != EC_SUCCESS) { \ - ccputs("Fail\n"); \ - error_count++; \ - } \ - } while (0) - -/*****************************************************************************/ -/* Tests */ -#ifdef CONFIG_I2C_CONTROLLER -static int test_i2c(void) -{ - int res = EC_ERROR_UNKNOWN; - int mock_data; - struct i2c_test_param_t *param; - param = i2c_test_params + (prng_no_seed() % (sizeof(i2c_test_params) / - sizeof(struct i2c_test_param_t))); - if (param->width == 8 && param->data == -1) - res = i2c_read8(param->port, param->addr, - param->offset, &mock_data); - else if (param->width == 8 && param->data >= 0) - res = i2c_write8(param->port, param->addr, - param->offset, param->data); - else if (param->width == 16 && param->data == -1) - res = i2c_read16(param->port, param->addr, - param->offset, &mock_data); - else if (param->width == 16 && param->data >= 0) - res = i2c_write16(param->port, param->addr, - param->offset, param->data); - else if (param->width == 32 && param->data == -1) - res = i2c_read32(param->port, param->addr, - param->offset, &mock_data); - else if (param->width == 32 && param->data >= 0) - res = i2c_write32(param->port, param->addr, - param->offset, param->data); - - return res; -} -#endif - -#ifdef CONFIG_ADC -__attribute__((weak)) int adc_read_all_channels(int *data) -{ - int i; - int rv = EC_SUCCESS; - - for (i = 0; i < ADC_CH_COUNT; ++i) { - data[i] = adc_read_channel(i); - if (data[i] == ADC_READ_ERROR) - rv = EC_ERROR_UNKNOWN; - } - - return rv; -} - -static int test_adc(void) -{ - int data[ADC_CH_COUNT]; - return adc_read_all_channels(data); -} -#endif - -void run_test(int argc, char **argv) -{ - test_reset(); - -#ifdef CONFIG_I2C_CONTROLLER - RUN_STRESS_TEST("I2C Stress Test", test_i2c, I2C_TEST_ITERATION); -#endif -#ifdef CONFIG_ADC - RUN_STRESS_TEST("ADC Stress Test", test_adc, ADC_TEST_ITERATION); -#endif - - test_print_result(); -} diff --git a/test/stress.tasklist b/test/stress.tasklist deleted file mode 100644 index da0ab6211a..0000000000 --- a/test/stress.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/system.c b/test/system.c deleted file mode 100644 index 79383b82d9..0000000000 --- a/test/system.c +++ /dev/null @@ -1,114 +0,0 @@ -/* Copyright 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. - * - * Test system_common. - */ - -#include "common.h" -#include "console.h" -#include "host_command.h" -#include "system.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -#define TEST_STATE_STEP_2 (1 << 0) -#define TEST_STATE_FAIL (1 << 1) - -static int test_reboot_on_shutdown(void) -{ - struct ec_params_reboot_ec params; - - /* Fails if the system reboots unexpectedly */ - system_set_scratchpad(TEST_STATE_FAIL); - - test_chipset_on(); - msleep(30); - - params.cmd = EC_REBOOT_COLD; - params.flags = EC_REBOOT_FLAG_ON_AP_SHUTDOWN; - - TEST_EQ(test_send_host_command(EC_CMD_REBOOT_EC, 0, ¶ms, - sizeof(params), NULL, 0), - EC_SUCCESS, "%d"); - - system_set_scratchpad(TEST_STATE_STEP_2); - test_chipset_off(); - msleep(30); - - /* Shouldn't reach here */ - return EC_ERROR_UNKNOWN; -} - -static int test_cancel_reboot(void) -{ - struct ec_params_reboot_ec params; - - /* Fails if the system reboots unexpectedly */ - system_set_scratchpad(TEST_STATE_FAIL); - - test_chipset_on(); - msleep(30); - - params.cmd = EC_REBOOT_COLD; - params.flags = EC_REBOOT_FLAG_ON_AP_SHUTDOWN; - - TEST_EQ(test_send_host_command(EC_CMD_REBOOT_EC, 0, ¶ms, - sizeof(params), NULL, 0), - EC_SUCCESS, "%d"); - - params.cmd = EC_REBOOT_CANCEL; - params.flags = 0; - - TEST_EQ(test_send_host_command(EC_CMD_REBOOT_EC, 0, ¶ms, - sizeof(params), NULL, 0), - EC_SUCCESS, "%d"); - - test_chipset_off(); - msleep(30); - - return EC_SUCCESS; -} - -static void run_test_step1(void) -{ - if (test_reboot_on_shutdown() != EC_SUCCESS) - test_fail(); -} - -static void run_test_step2(void) -{ - if (test_cancel_reboot() != EC_SUCCESS) - test_fail(); - - system_set_scratchpad(0); - test_pass(); -} - -static void fail_and_clean_up(void) -{ - system_set_scratchpad(0); - test_fail(); -} - -void run_test(int argc, char **argv) -{ - uint32_t state = 0; - - /* The return value isn't checked here on purpose. The scratchpad file - * may exist from a previous run or it may be in a clean state. A - * previous run of this test should reset the scratchpad value to 0 - * regardless of the final result. - */ - system_get_scratchpad(&state); - - test_reset(); - - if (state == 0) - run_test_step1(); - else if (state & TEST_STATE_STEP_2) - run_test_step2(); - else if (state & TEST_STATE_FAIL) - fail_and_clean_up(); -} diff --git a/test/system.tasklist b/test/system.tasklist deleted file mode 100644 index 4e455a7ea3..0000000000 --- a/test/system.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) diff --git a/test/test-matrix.bin b/test/test-matrix.bin Binary files differdeleted file mode 100644 index e48c761f77..0000000000 --- a/test/test-matrix.bin +++ /dev/null diff --git a/test/test_config.h b/test/test_config.h deleted file mode 100644 index 5afc5d1282..0000000000 --- a/test/test_config.h +++ /dev/null @@ -1,622 +0,0 @@ -/* Copyright 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. - */ - -/* Per-test config flags */ - -#ifndef __TEST_TEST_CONFIG_H -#define __TEST_TEST_CONFIG_H - -/* Test config flags only apply for test builds */ -#ifdef TEST_BUILD - -#ifndef __ASSEMBLER__ -#include <stdint.h> -#endif - -/* Host commands are sorted. */ -#define CONFIG_HOSTCMD_SECTION_SORTED - -/* Don't compile features unless specifically testing for them */ -#undef CONFIG_VBOOT_HASH -#undef CONFIG_USB_PD_LOGGING - -#ifdef TEST_AES -#define CONFIG_AES -#define CONFIG_AES_GCM -#endif - -#ifdef TEST_BASE32 -#define CONFIG_BASE32 -#endif - -#ifdef TEST_BKLIGHT_LID -#define CONFIG_BACKLIGHT_LID -#endif - -#ifdef TEST_BKLIGHT_PASSTHRU -#define CONFIG_BACKLIGHT_LID -#define CONFIG_BACKLIGHT_REQ_GPIO GPIO_PCH_BKLTEN -#endif - -#ifdef TEST_CBI_WP -#define CONFIG_EEPROM_CBI_WP -#endif - -#ifdef TEST_FLASH_LOG -#define CONFIG_CRC8 -#define CONFIG_FLASH_ERASED_VALUE32 (-1U) -#define CONFIG_FLASH_LOG -#define CONFIG_FLASH_LOG_BASE (CONFIG_PROGRAM_MEMORY_BASE + 0x800) -#define CONFIG_FLASH_LOG_SPACE 0x800 -#define CONFIG_MALLOC -#endif - -#ifdef TEST_KB_8042 -#define CONFIG_KEYBOARD_PROTOCOL_8042 -#endif - -#ifdef TEST_KB_MKBP -#define CONFIG_KEYBOARD_PROTOCOL_MKBP -#define CONFIG_MKBP_EVENT -#define CONFIG_MKBP_USE_GPIO -#endif - -#if defined(TEST_KB_SCAN) || defined(TEST_KB_SCAN_STRICT) -#define CONFIG_KEYBOARD_PROTOCOL_MKBP -#define CONFIG_MKBP_EVENT -#define CONFIG_MKBP_USE_GPIO -#ifdef TEST_KB_SCAN_STRICT -#define CONFIG_KEYBOARD_STRICT_DEBOUNCE -#endif -#endif - -#ifdef TEST_MATH_UTIL -#define CONFIG_MATH_UTIL -#endif - -#ifdef TEST_MAG_CAL -#define CONFIG_MAG_CALIBRATE -#endif - -#ifdef TEST_STILLNESS_DETECTOR -#define CONFIG_FPU -#define CONFIG_ONLINE_CALIB -#define CONFIG_TEMP_CACHE_STALE_THRES (5 * SECOND) -#define CONFIG_MKBP_EVENT -#define CONFIG_MKBP_USE_GPIO -#endif - -#ifdef TEST_FLOAT -#define CONFIG_FPU -#define CONFIG_MAG_CALIBRATE -#endif - -#ifdef TEST_FP -#undef CONFIG_FPU -#define CONFIG_MAG_CALIBRATE -#endif - -#if defined(TEST_FPSENSOR) || defined(TEST_FPSENSOR_STATE) || \ - defined(TEST_FPSENSOR_CRYPTO) -#define CONFIG_AES -#define CONFIG_AES_GCM -#define CONFIG_ROLLBACK_SECRET_SIZE 32 -#define CONFIG_SHA256 -#endif - -#ifdef TEST_MOTION_SENSE_FIFO -#define CONFIG_ACCEL_FIFO -#define CONFIG_ACCEL_FIFO_SIZE 256 -#define CONFIG_ACCEL_FIFO_THRES 10 -#endif - -#ifdef TEST_KASA -#define CONFIG_FPU -#define CONFIG_ONLINE_CALIB -#define CONFIG_MKBP_EVENT -#define CONFIG_MKBP_USE_GPIO -#endif - -#ifdef TEST_ACCEL_CAL -#define CONFIG_FPU -#define CONFIG_ONLINE_CALIB -#define CONFIG_ACCEL_CAL_MIN_TEMP 20.0f -#define CONFIG_ACCEL_CAL_MAX_TEMP 40.0f -#define CONFIG_ACCEL_CAL_KASA_RADIUS_THRES 0.1f -#define CONFIG_ACCEL_CAL_NEWTON_RADIUS_THRES 0.1f -#define CONFIG_MKBP_EVENT -#define CONFIG_MKBP_USE_GPIO -#endif - -#ifdef TEST_NEWTON_FIT -#define CONFIG_FPU -#define CONFIG_ONLINE_CALIB -#define CONFIG_MKBP_EVENT -#define CONFIG_MKBP_USE_GPIO -#endif - -#ifdef TEST_STILLNESS_DETECTOR -#define CONFIG_MKBP_EVENT -#define CONFIG_MKBP_USE_GPIO -#endif - -#ifdef TEST_ONLINE_CALIBRATION -#define CONFIG_FPU -#define CONFIG_ONLINE_CALIB -#define CONFIG_MKBP_EVENT -#define CONFIG_MKBP_USE_GPIO -#endif - -#ifdef TEST_ONLINE_CALIBRATION_SPOOF -#define CONFIG_FPU -#define CONFIG_ONLINE_CALIB -#define CONFIG_MKBP_EVENT -#define CONFIG_MKBP_USE_GPIO -#define CONFIG_ONLINE_CALIB_SPOOF_MODE -#endif /* TEST_ONLINE_CALIBRATION_SPOOF */ - -#ifdef TEST_GYRO_CAL -#define CONFIG_FPU -#define CONFIG_ONLINE_CALIB -#define CONFIG_MKBP_EVENT -#define CONFIG_MKBP_USE_GPIO -#endif - -#if defined(CONFIG_ONLINE_CALIB) && \ - !defined(CONFIG_TEMP_CACHE_STALE_THRES) -#define CONFIG_TEMP_CACHE_STALE_THRES (1 * SECOND) -#endif /* CONFIG_ONLINE_CALIB && !CONFIG_TEMP_CACHE_STALE_THRES */ - -#if defined(CONFIG_ONLINE_CALIB) || \ - defined(TEST_BODY_DETECTION) || \ - defined(TEST_MOTION_ANGLE) || \ - defined(TEST_MOTION_ANGLE_TABLET) || \ - defined(TEST_MOTION_LID) || \ - defined(TEST_MOTION_SENSE_FIFO) -enum sensor_id { - BASE, - LID, - SENSOR_COUNT, -}; - -#define CONFIG_LID_ANGLE -#define CONFIG_LID_ANGLE_SENSOR_BASE BASE -#define CONFIG_LID_ANGLE_SENSOR_LID LID -#define CONFIG_TABLET_MODE -#define CONFIG_MOTION_FILL_LPC_SENSE_DATA - -#endif - -#if defined(TEST_MOTION_ANGLE) -#define CONFIG_ACCEL_FORCE_MODE_MASK \ - ((1 << CONFIG_LID_ANGLE_SENSOR_BASE) | \ - (1 << CONFIG_LID_ANGLE_SENSOR_LID)) -#define CONFIG_ACCEL_STD_REF_FRAME_OLD -#endif - -#if defined(TEST_MOTION_ANGLE_TABLET) || \ - defined(TEST_MOTION_LID) -#define CONFIG_ACCEL_FORCE_MODE_MASK \ - ((1 << CONFIG_LID_ANGLE_SENSOR_BASE) | \ - (1 << CONFIG_LID_ANGLE_SENSOR_LID)) -#endif - -#if defined(TEST_BODY_DETECTION) -#define CONFIG_BODY_DETECTION -#define CONFIG_BODY_DETECTION_SENSOR BASE -#endif - -#ifdef TEST_RMA_AUTH - -/* Test server public and private keys */ -#define RMA_KEY_BLOB { \ - 0x03, 0xae, 0x2d, 0x2c, 0x06, 0x23, 0xe0, 0x73, \ - 0x0d, 0xd3, 0xb7, 0x92, 0xac, 0x54, 0xc5, 0xfd, \ - 0x7e, 0x9c, 0xf0, 0xa8, 0xeb, 0x7e, 0x2a, 0xb5, \ - 0xdb, 0xf4, 0x79, 0x5f, 0x8a, 0x0f, 0x28, 0x3f, \ - 0x10 \ - } - -#define RMA_TEST_SERVER_PRIVATE_KEY { \ - 0x47, 0x3b, 0xa5, 0xdb, 0xc4, 0xbb, 0xd6, 0x77, \ - 0x20, 0xbd, 0xd8, 0xbd, 0xc8, 0x7a, 0xbb, 0x07, \ - 0x03, 0x79, 0xba, 0x7b, 0x52, 0x8c, 0xec, 0xb3, \ - 0x4d, 0xaa, 0x69, 0xf5, 0x65, 0xb4, 0x31, 0xad} -#define RMA_TEST_SERVER_KEY_ID 0x10 - -#define CONFIG_BASE32 -#define CONFIG_CURVE25519 -#define CONFIG_RMA_AUTH -#define CONFIG_RNG -#define CONFIG_SHA256 -#define CC_EXTENSION CC_COMMAND - -#endif - -#ifdef TEST_CRC -#define CONFIG_CRC8 -#define CONFIG_SW_CRC -#endif - -#ifdef TEST_RSA -#define CONFIG_RSA -#ifdef CONFIG_RSA_EXPONENT_3 -#error Your board uses RSA exponent 3, please build rsa3 test instead! -#endif -#define CONFIG_RWSIG_TYPE_RWSIG -#endif - -#ifdef TEST_RSA3 -#define CONFIG_RSA -#define CONFIG_RSA_EXPONENT_3 -#define CONFIG_RWSIG_TYPE_RWSIG -#endif - -#ifdef TEST_SHA256 -#define CONFIG_SHA256 -#endif - -#ifdef TEST_SHA256_UNROLLED -#define CONFIG_SHA256 -#define CONFIG_SHA256_UNROLLED -#endif - -#ifdef TEST_SHMALLOC -#define CONFIG_MALLOC -#endif - -#ifdef TEST_SBS_CHARGING_V2 -#define CONFIG_BATTERY -#define CONFIG_BATTERY_MOCK -#define CONFIG_BATTERY_SMART -#define CONFIG_CHARGER -#define CONFIG_CHARGER_PROFILE_OVERRIDE -#define CONFIG_CHARGER_INPUT_CURRENT 4032 -#define CONFIG_CHARGER_DISCHARGE_ON_AC -#define CONFIG_CHARGER_DISCHARGE_ON_AC_CUSTOM -#define CONFIG_I2C -#define CONFIG_I2C_CONTROLLER -int board_discharge_on_ac(int enabled); -#define I2C_PORT_MASTER 0 -#define I2C_PORT_BATTERY 0 -#define I2C_PORT_CHARGER 0 -#endif - -#ifdef TEST_THERMAL -#define CONFIG_CHIPSET_CAN_THROTTLE -#define CONFIG_FANS 1 -#define CONFIG_I2C -#define CONFIG_I2C_CONTROLLER -#define CONFIG_TEMP_SENSOR -#define CONFIG_THROTTLE_AP -#define CONFIG_THERMISTOR -#define CONFIG_THERMISTOR_NCP15WB -#define I2C_PORT_THERMAL 0 -int ncp15wb_calculate_temp(uint16_t adc); -#endif - -#ifdef TEST_FAN -#define CONFIG_FANS 1 -#endif - -#ifdef TEST_BUTTON -#define CONFIG_KEYBOARD_PROTOCOL_8042 -#undef CONFIG_KEYBOARD_VIVALDI -#define CONFIG_VOLUME_BUTTONS -#define CONFIG_HOSTCMD_BUTTON -#endif - -#ifdef TEST_BATTERY_GET_PARAMS_SMART -#define CONFIG_BATTERY_MOCK -#define CONFIG_BATTERY_SMART -#define CONFIG_CHARGER_INPUT_CURRENT 4032 -#define CONFIG_I2C -#define CONFIG_I2C_CONTROLLER -#define I2C_PORT_MASTER 0 -#define I2C_PORT_BATTERY 0 -#define I2C_PORT_CHARGER 0 -#endif - -#ifdef TEST_CEC -#define CONFIG_CEC -#endif - -#ifdef TEST_LIGHTBAR -#define CONFIG_I2C -#define CONFIG_I2C_CONTROLLER -#define I2C_PORT_LIGHTBAR 0 -#define CONFIG_ALS_LIGHTBAR_DIMMING 0 -#endif - -#ifdef TEST_USB_COMMON -#define CONFIG_USB_POWER_DELIVERY -#define CONFIG_USB_PD_TCPMV1 -#define CONFIG_USB_PD_PORT_MAX_COUNT 1 -#define CONFIG_USB_PD_TCPC -#define CONFIG_USB_PD_TCPM_STUB -#define CONFIG_SHA256 -#define CONFIG_SW_CRC -#endif - -#ifdef TEST_USB_PD_PDO_FIXED -#define CONFIG_USB_POWER_DELIVERY -#define CONFIG_USB_PD_TCPMV1 -#define CONFIG_USB_PD_PORT_MAX_COUNT 1 -#define CONFIG_USB_PD_TCPC -#define CONFIG_USB_PD_TCPM_STUB -#define CONFIG_SHA256 -#define CONFIG_SW_CRC -#define CONFIG_USB_PD_ONLY_FIXED_PDOS -#endif - -#if defined(TEST_USB_SM_FRAMEWORK_H3) || \ - defined(TEST_USB_SM_FRAMEWORK_H2) || \ - defined(TEST_USB_SM_FRAMEWORK_H1) || \ - defined(TEST_USB_SM_FRAMEWORK_H0) -#define CONFIG_TEST_SM -#endif - -#if defined(TEST_USB_PRL_OLD) || defined(TEST_USB_PRL_NOEXTENDED) -#define CONFIG_USB_PD_PORT_MAX_COUNT 1 -#define CONFIG_USB_PD_REV30 - -#if defined(TEST_USB_PRL_OLD) -#define CONFIG_USB_PD_EXTENDED_MESSAGES -#endif - -#define CONFIG_USB_PD_TCPMV2 -#undef CONFIG_USB_PE_SM -#undef CONFIG_USB_TYPEC_SM -#undef CONFIG_USB_PD_HOST_CMD -#define CONFIG_USB_PRL_SM -#define CONFIG_USB_PD_TCPC -#define CONFIG_USB_PD_TCPM_STUB -#define CONFIG_USB_POWER_DELIVERY -#define CONFIG_SHA256 -#define CONFIG_SW_CRC -#endif - -#if defined(TEST_USB_PRL) -#define CONFIG_USB_PD_PORT_MAX_COUNT 1 -#define CONFIG_USB_PD_REV30 -#define CONFIG_USB_PD_EXTENDED_MESSAGES -#define CONFIG_USB_PD_TCPMV2 -#undef CONFIG_USB_PE_SM -#undef CONFIG_USB_TYPEC_SM -#undef CONFIG_USB_PD_HOST_CMD -#define CONFIG_USB_PRL_SM -#define CONFIG_USB_POWER_DELIVERY -#endif - -#if defined(TEST_USB_PE_DRP_OLD) || defined(TEST_USB_PE_DRP_OLD_NOEXTENDED) -#define CONFIG_TEST_USB_PE_SM -#define CONFIG_USB_PD_PORT_MAX_COUNT 1 -#define CONFIG_USB_PE_SM -#define CONFIG_USB_PID 0x5036 -#define CONFIG_USB_POWER_DELIVERY -#undef CONFIG_USB_PRL_SM -#define CONFIG_USB_PD_REV30 - -#if defined(TEST_USB_PE_DRP_OLD) -#define CONFIG_USB_PD_EXTENDED_MESSAGES -#endif - -#define CONFIG_USB_PD_TCPMV2 -#define CONFIG_USB_PD_DECODE_SOP -#undef CONFIG_USB_TYPEC_SM -#define CONFIG_USBC_VCONN -#define CONFIG_USB_PD_DISCHARGE_GPIO -#undef CONFIG_USB_PD_HOST_CMD -#define CONFIG_USB_PD_ALT_MODE_DFP -#define CONFIG_USBC_SS_MUX -#define CONFIG_USB_PD_3A_PORTS 0 /* Host does not define a 3.0 A PDO */ -#endif - -#if defined(TEST_USB_PE_DRP) || defined(TEST_USB_PE_DRP_NOEXTENDED) -#define CONFIG_TEST_USB_PE_SM -#define CONFIG_USB_PD_PORT_MAX_COUNT 1 -#define CONFIG_USB_PE_SM -#define CONFIG_USB_PID 0x5036 -#define CONFIG_USB_POWER_DELIVERY -#undef CONFIG_USB_PRL_SM -#define CONFIG_USB_PD_REV30 - -#if defined(TEST_USB_PE_DRP) -#define CONFIG_USB_PD_EXTENDED_MESSAGES -#endif - -#define CONFIG_USB_PD_TCPMV2 -#define CONFIG_USB_PD_DECODE_SOP -#undef CONFIG_USB_TYPEC_SM -#define CONFIG_USBC_VCONN -#define CONFIG_USB_PD_DISCHARGE_GPIO -#undef CONFIG_USB_PD_HOST_CMD -#define CONFIG_USB_PD_ALT_MODE_DFP -#define CONFIG_USBC_SS_MUX -#define I2C_PORT_HOST_TCPC 0 -#define CONFIG_CHARGE_MANAGER -#define CONFIG_USB_PD_3A_PORTS 0 /* Host does not define a 3.0 A PDO */ -#endif /* TEST_USB_PE_DRP || TEST_USB_PE_DRP_NOEXTENDED */ - -/* Common TypeC tests defines */ -#if defined(TEST_USB_TYPEC_VPD) || \ - defined(TEST_USB_TYPEC_CTVPD) -#define CONFIG_USB_PID 0x5036 -#define VPD_HW_VERSION 0x0001 -#define VPD_FW_VERSION 0x0001 -#define USB_BCD_DEVICE 0 -#define VPD_CT_CURRENT VPD_CT_CURRENT_3A -/* Vbus impedance in milliohms */ -#define VPD_VBUS_IMPEDANCE 65 - -/* GND impedance in milliohms */ -#define VPD_GND_IMPEDANCE 33 - -#define CONFIG_USB_PD_PORT_MAX_COUNT 1 -#define CONFIG_USB_PD_REV30 -#define CONFIG_USB_PD_EXTENDED_MESSAGES -#define CONFIG_USB_PD_TCPMV2 -#define CONFIG_USB_PE_SM -#define CONFIG_USB_PRL_SM -#define CONFIG_USB_TYPEC_SM -#define CONFIG_USB_PD_TCPC -#define CONFIG_USB_PD_TCPM_STUB -#define CONFIG_USB_POWER_DELIVERY -#define CONFIG_SW_CRC -#undef CONFIG_USB_PD_HOST_CMD -#endif /* Common TypeC test defines */ - -#ifdef TEST_USB_TYPEC_VPD -#define CONFIG_USB_VPD -#endif - -#ifdef TEST_USB_TYPEC_CTVPD -#define CONFIG_USB_CTVPD -#endif - -#ifdef TEST_USB_TYPEC_DRP_ACC_TRYSRC -#define CONFIG_USB_DRP_ACC_TRYSRC -#define CONFIG_USB_PD_DUAL_ROLE -#define CONFIG_USB_PD_TRY_SRC -#define CONFIG_USB_TYPEC_SM -#define CONFIG_USB_PD_TCPMV2 -#define CONFIG_USB_PD_PORT_MAX_COUNT 1 -#define CONFIG_USBC_SS_MUX -#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE -#define CONFIG_USB_PD_VBUS_DETECT_TCPC -#define CONFIG_USB_POWER_DELIVERY -#undef CONFIG_USB_PRL_SM -#undef CONFIG_USB_PE_SM -#undef CONFIG_USB_PD_HOST_CMD -#endif - -#ifdef TEST_USB_TCPMV2_COMPLIANCE -#define CONFIG_USB_DRP_ACC_TRYSRC -#define CONFIG_USB_PD_DUAL_ROLE -#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE -#define CONFIG_USB_PD_REV30 -#define CONFIG_USB_PD_TCPC_LOW_POWER -#define CONFIG_USB_PD_TRY_SRC -#define CONFIG_USB_PD_TCPMV2 -#define CONFIG_USB_PD_PORT_MAX_COUNT 1 -#define CONFIG_USBC_SS_MUX -#define CONFIG_USB_PD_VBUS_DETECT_TCPC -#define CONFIG_USB_POWER_DELIVERY -#define CONFIG_TEST_USB_PE_SM -#define CONFIG_USB_PD_ALT_MODE_DFP -#define CONFIG_USBC_VCONN -#define CONFIG_USBC_VCONN_SWAP -#define CONFIG_USB_PID 0x5036 -#define CONFIG_USB_PD_TCPM_TCPCI -#define CONFIG_I2C -#define CONFIG_I2C_CONTROLLER -#define CONFIG_BATTERY -#define CONFIG_NUM_FIXED_BATTERIES 1 -#define I2C_PORT_HOST_TCPC 0 -#define CONFIG_USB_PD_DEBUG_LEVEL 3 -#define CONFIG_USB_PD_EXTENDED_MESSAGES -#define CONFIG_USB_PD_DECODE_SOP -#define CONFIG_USB_PD_3A_PORTS 0 /* Host does not define a 3.0 A PDO */ -#endif - -#ifdef TEST_USB_PD_INT -#define CONFIG_USB_POWER_DELIVERY -#define CONFIG_USB_PD_TCPMV1 -#define CONFIG_USB_PD_DUAL_ROLE -#define CONFIG_USB_PD_PORT_MAX_COUNT 1 -#define CONFIG_USB_PD_TCPC -#define CONFIG_USB_PD_TCPM_STUB -#define CONFIG_SHA256 -#define CONFIG_SW_CRC -#endif - -#if defined(TEST_USB_PD) || defined(TEST_USB_PD_GIVEBACK) || \ - defined(TEST_USB_PD_REV30) -#define CONFIG_USB_POWER_DELIVERY -#define CONFIG_USB_PD_TCPMV1 -#define CONFIG_USB_PD_DUAL_ROLE -#define CONFIG_USB_PD_PORT_MAX_COUNT 2 -#define CONFIG_USB_PD_TCPC -#define CONFIG_USB_PD_TCPM_STUB -#define CONFIG_SHA256 -#define CONFIG_SW_CRC -#ifdef TEST_USB_PD_REV30 -#define CONFIG_USB_PD_REV30 -#define CONFIG_USB_PD_EXTENDED_MESSAGES -#define CONFIG_USB_PID 0x5000 -#endif -#ifdef TEST_USB_PD_GIVEBACK -#define CONFIG_USB_PD_GIVE_BACK -#endif -#endif /* TEST_USB_PD || TEST_USB_PD_GIVEBACK || TEST_USB_PD_REV30 */ - -#ifdef TEST_USB_PPC -#define CONFIG_USB_PD_PORT_MAX_COUNT 1 -#define CONFIG_USB_PD_VBUS_DETECT_PPC -#define CONFIG_USBC_PPC -#define CONFIG_USBC_PPC_POLARITY -#define CONFIG_USBC_PPC_SBU -#define CONFIG_USBC_PPC_VCONN -#endif - -#if defined(TEST_CHARGE_MANAGER) || defined(TEST_CHARGE_MANAGER_DRP_CHARGING) -#define CONFIG_CHARGE_MANAGER -#define CONFIG_USB_PD_DUAL_ROLE -#define CONFIG_USB_PD_PORT_MAX_COUNT 2 -#define CONFIG_BATTERY -#define CONFIG_BATTERY_SMART -#define CONFIG_I2C -#define CONFIG_I2C_CONTROLLER -#define I2C_PORT_BATTERY 0 -#endif /* TEST_CHARGE_MANAGER_* */ - -#ifdef TEST_CHARGE_MANAGER_DRP_CHARGING -#define CONFIG_CHARGE_MANAGER_DRP_CHARGING -#else -#undef CONFIG_CHARGE_MANAGER_DRP_CHARGING -#endif /* TEST_CHARGE_MANAGER_DRP_CHARGING */ - -#ifdef TEST_CHARGE_RAMP -#define CONFIG_CHARGE_RAMP_SW -#define CONFIG_USB_PD_PORT_MAX_COUNT 2 -#endif - -#ifdef TEST_RTC -#define CONFIG_HOSTCMD_RTC -#endif - -#ifdef TEST_VBOOT -#define CONFIG_RWSIG -#define CONFIG_SHA256 -#define CONFIG_RSA -#define CONFIG_RWSIG_TYPE_RWSIG -#define CONFIG_RW_B -#define CONFIG_RW_B_MEM_OFF CONFIG_RO_MEM_OFF -#undef CONFIG_RO_SIZE -#define CONFIG_RO_SIZE (CONFIG_FLASH_SIZE_BYTES / 4) -#undef CONFIG_RW_SIZE -#define CONFIG_RW_SIZE CONFIG_RO_SIZE -#define CONFIG_RW_A_STORAGE_OFF CONFIG_RW_STORAGE_OFF -#define CONFIG_RW_B_STORAGE_OFF (CONFIG_RW_A_STORAGE_OFF + \ - CONFIG_RW_SIZE) -#define CONFIG_RW_A_SIGN_STORAGE_OFF (CONFIG_RW_A_STORAGE_OFF + \ - CONFIG_RW_SIZE - CONFIG_RW_SIG_SIZE) -#define CONFIG_RW_B_SIGN_STORAGE_OFF (CONFIG_RW_B_STORAGE_OFF + \ - CONFIG_RW_SIZE - CONFIG_RW_SIG_SIZE) -#endif - -#ifdef TEST_X25519 -#define CONFIG_CURVE25519 -#endif /* TEST_X25519 */ - -#ifdef TEST_I2C_BITBANG -#define CONFIG_I2C -#define CONFIG_I2C_CONTROLLER -#define CONFIG_I2C_BITBANG -#define I2C_BITBANG_PORT_COUNT 1 -#endif - -#endif /* TEST_BUILD */ -#endif /* __TEST_TEST_CONFIG_H */ diff --git a/test/thermal.c b/test/thermal.c deleted file mode 100644 index 1161ecbf1b..0000000000 --- a/test/thermal.c +++ /dev/null @@ -1,659 +0,0 @@ -/* Copyright 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. - * - * Test thermal engine. - */ - -#include "common.h" -#include "console.h" -#include "driver/temp_sensor/thermistor.h" -#include "fan.h" -#include "hooks.h" -#include "host_command.h" -#include "printf.h" -#include "temp_sensor.h" -#include "test_util.h" -#include "thermal.h" -#include "timer.h" -#include "util.h" - - -/*****************************************************************************/ -/* Exported data */ - -struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; - -/* The tests below make some assumptions. */ -BUILD_ASSERT(TEMP_SENSOR_COUNT == 4); -BUILD_ASSERT(EC_TEMP_THRESH_COUNT == 3); - -/*****************************************************************************/ -/* Mock functions */ - -static int mock_temp[TEMP_SENSOR_COUNT]; -static int host_throttled; -static int cpu_throttled; -static int cpu_shutdown; -static int fan_pct; -static int no_temps_read; - -int mock_temp_get_val(int idx, int *temp_ptr) -{ - if (mock_temp[idx] >= 0) { - *temp_ptr = mock_temp[idx]; - return EC_SUCCESS; - } - - return EC_ERROR_NOT_POWERED; -} - -void chipset_force_shutdown(void) -{ - cpu_shutdown = 1; -} - -void chipset_throttle_cpu(int throttled) -{ - cpu_throttled = throttled; -} - -void host_throttle_cpu(int throttled) -{ - host_throttled = throttled; -} - -void fan_set_percent_needed(int fan, int pct) -{ - fan_pct = pct; -} - -void smi_sensor_failure_warning(void) -{ - no_temps_read = 1; -} - -/*****************************************************************************/ -/* Test utilities */ - -static void set_temps(int t0, int t1, int t2, int t3) -{ - mock_temp[0] = t0; - mock_temp[1] = t1; - mock_temp[2] = t2; - mock_temp[3] = t3; -} - -static void all_temps(int t) -{ - set_temps(t, t, t, t); -} - -static void reset_mocks(void) -{ - /* Ignore all sensors */ - memset(thermal_params, 0, sizeof(thermal_params)); - - /* All sensors report error anyway */ - set_temps(-1, -1 , -1, -1); - - /* Reset expectations */ - host_throttled = 0; - cpu_throttled = 0; - cpu_shutdown = 0; - fan_pct = 0; - no_temps_read = 0; -} - - -/*****************************************************************************/ -/* Tests */ - -static int test_init_val(void) -{ - reset_mocks(); - sleep(2); - - TEST_ASSERT(host_throttled == 0); - TEST_ASSERT(cpu_throttled == 0); - TEST_ASSERT(cpu_shutdown == 0); - TEST_ASSERT(fan_pct == 0); - TEST_ASSERT(no_temps_read); - - sleep(2); - - TEST_ASSERT(host_throttled == 0); - TEST_ASSERT(cpu_throttled == 0); - TEST_ASSERT(cpu_shutdown == 0); - TEST_ASSERT(fan_pct == 0); - TEST_ASSERT(no_temps_read); - - return EC_SUCCESS; -} - -static int test_sensors_can_be_read(void) -{ - reset_mocks(); - mock_temp[2] = 100; - - sleep(2); - - TEST_ASSERT(host_throttled == 0); - TEST_ASSERT(cpu_throttled == 0); - TEST_ASSERT(cpu_shutdown == 0); - TEST_ASSERT(fan_pct == 0); - TEST_ASSERT(no_temps_read == 0); - - return EC_SUCCESS; -} - - -static int test_one_fan(void) -{ - reset_mocks(); - thermal_params[2].temp_fan_off = 100; - thermal_params[2].temp_fan_max = 200; - - all_temps(50); - sleep(2); - TEST_ASSERT(fan_pct == 0); - - all_temps(100); - sleep(2); - TEST_ASSERT(fan_pct == 0); - - all_temps(101); - sleep(2); - TEST_ASSERT(fan_pct == 1); - - all_temps(130); - sleep(2); - TEST_ASSERT(fan_pct == 30); - - all_temps(150); - sleep(2); - TEST_ASSERT(fan_pct == 50); - - all_temps(170); - sleep(2); - TEST_ASSERT(fan_pct == 70); - - all_temps(200); - sleep(2); - TEST_ASSERT(fan_pct == 100); - - all_temps(300); - sleep(2); - TEST_ASSERT(fan_pct == 100); - - return EC_SUCCESS; -} - -static int test_two_fans(void) -{ - reset_mocks(); - - thermal_params[1].temp_fan_off = 120; - thermal_params[1].temp_fan_max = 160; - thermal_params[2].temp_fan_off = 100; - thermal_params[2].temp_fan_max = 200; - - all_temps(50); - sleep(2); - TEST_ASSERT(fan_pct == 0); - - all_temps(100); - sleep(2); - TEST_ASSERT(fan_pct == 0); - - all_temps(101); - sleep(2); - TEST_ASSERT(fan_pct == 1); - - all_temps(130); - sleep(2); - /* fan 2 is still higher */ - TEST_ASSERT(fan_pct == 30); - - all_temps(150); - sleep(2); - /* now fan 1 is higher: 150 = 75% of [120-160] */ - TEST_ASSERT(fan_pct == 75); - - all_temps(170); - sleep(2); - /* fan 1 is maxed now */ - TEST_ASSERT(fan_pct == 100); - - all_temps(200); - sleep(2); - TEST_ASSERT(fan_pct == 100); - - all_temps(300); - sleep(2); - TEST_ASSERT(fan_pct == 100); - - return EC_SUCCESS; -} - -static int test_all_fans(void) -{ - reset_mocks(); - - thermal_params[0].temp_fan_off = 20; - thermal_params[0].temp_fan_max = 60; - thermal_params[1].temp_fan_off = 120; - thermal_params[1].temp_fan_max = 160; - thermal_params[2].temp_fan_off = 100; - thermal_params[2].temp_fan_max = 200; - thermal_params[3].temp_fan_off = 300; - thermal_params[3].temp_fan_max = 500; - - set_temps(1, 1, 1, 1); - sleep(2); - TEST_ASSERT(fan_pct == 0); - - /* Each sensor has its own range */ - set_temps(40, 0, 0, 0); - sleep(2); - TEST_ASSERT(fan_pct == 50); - - set_temps(0, 140, 0, 0); - sleep(2); - TEST_ASSERT(fan_pct == 50); - - set_temps(0, 0, 150, 0); - sleep(2); - TEST_ASSERT(fan_pct == 50); - - set_temps(0, 0, 0, 400); - sleep(2); - TEST_ASSERT(fan_pct == 50); - - set_temps(60, 0, 0, 0); - sleep(2); - TEST_ASSERT(fan_pct == 100); - - set_temps(0, 160, 0, 0); - sleep(2); - TEST_ASSERT(fan_pct == 100); - - set_temps(0, 0, 200, 0); - sleep(2); - TEST_ASSERT(fan_pct == 100); - - set_temps(0, 0, 0, 500); - sleep(2); - TEST_ASSERT(fan_pct == 100); - - /* But sensor 0 needs the most cooling */ - all_temps(20); - sleep(2); - TEST_ASSERT(fan_pct == 0); - - all_temps(21); - sleep(2); - TEST_ASSERT(fan_pct == 2); - - all_temps(30); - sleep(2); - TEST_ASSERT(fan_pct == 25); - - all_temps(40); - sleep(2); - TEST_ASSERT(fan_pct == 50); - - all_temps(50); - sleep(2); - TEST_ASSERT(fan_pct == 75); - - all_temps(60); - sleep(2); - TEST_ASSERT(fan_pct == 100); - - all_temps(65); - sleep(2); - TEST_ASSERT(fan_pct == 100); - - return EC_SUCCESS; -} - -static int test_one_limit(void) -{ - reset_mocks(); - thermal_params[2].temp_host[EC_TEMP_THRESH_WARN] = 100; - thermal_params[2].temp_host[EC_TEMP_THRESH_HIGH] = 200; - thermal_params[2].temp_host[EC_TEMP_THRESH_HALT] = 300; - - all_temps(50); - sleep(2); - TEST_ASSERT(host_throttled == 0); - TEST_ASSERT(cpu_throttled == 0); - TEST_ASSERT(cpu_shutdown == 0); - - all_temps(100); - sleep(2); - TEST_ASSERT(host_throttled == 0); - TEST_ASSERT(cpu_throttled == 0); - TEST_ASSERT(cpu_shutdown == 0); - - all_temps(101); - sleep(2); - TEST_ASSERT(host_throttled == 1); - TEST_ASSERT(cpu_throttled == 0); - TEST_ASSERT(cpu_shutdown == 0); - - all_temps(100); - sleep(2); - TEST_ASSERT(host_throttled == 1); - TEST_ASSERT(cpu_throttled == 0); - TEST_ASSERT(cpu_shutdown == 0); - - all_temps(99); - sleep(2); - TEST_ASSERT(host_throttled == 0); - TEST_ASSERT(cpu_throttled == 0); - TEST_ASSERT(cpu_shutdown == 0); - - all_temps(199); - sleep(2); - TEST_ASSERT(host_throttled == 1); - TEST_ASSERT(cpu_throttled == 0); - TEST_ASSERT(cpu_shutdown == 0); - - all_temps(200); - sleep(2); - TEST_ASSERT(host_throttled == 1); - TEST_ASSERT(cpu_throttled == 0); - TEST_ASSERT(cpu_shutdown == 0); - - all_temps(201); - sleep(2); - TEST_ASSERT(host_throttled == 1); - TEST_ASSERT(cpu_throttled == 1); - TEST_ASSERT(cpu_shutdown == 0); - - all_temps(200); - sleep(2); - TEST_ASSERT(host_throttled == 1); - TEST_ASSERT(cpu_throttled == 1); - TEST_ASSERT(cpu_shutdown == 0); - - all_temps(199); - sleep(2); - TEST_ASSERT(host_throttled == 1); - TEST_ASSERT(cpu_throttled == 0); - TEST_ASSERT(cpu_shutdown == 0); - - all_temps(99); - sleep(2); - TEST_ASSERT(host_throttled == 0); - TEST_ASSERT(cpu_throttled == 0); - TEST_ASSERT(cpu_shutdown == 0); - - all_temps(201); - sleep(2); - TEST_ASSERT(host_throttled == 1); - TEST_ASSERT(cpu_throttled == 1); - TEST_ASSERT(cpu_shutdown == 0); - - all_temps(99); - sleep(2); - TEST_ASSERT(host_throttled == 0); - TEST_ASSERT(cpu_throttled == 0); - TEST_ASSERT(cpu_shutdown == 0); - - all_temps(301); - sleep(2); - TEST_ASSERT(host_throttled == 1); - TEST_ASSERT(cpu_throttled == 1); - TEST_ASSERT(cpu_shutdown == 1); - - /* We probably won't be able to read the CPU temp while shutdown, - * so nothing will change. */ - all_temps(-1); - sleep(2); - TEST_ASSERT(host_throttled == 1); - TEST_ASSERT(cpu_throttled == 1); - /* cpu_shutdown is only set for testing purposes. The thermal task - * doesn't do anything that could clear it. */ - - all_temps(50); - sleep(2); - TEST_ASSERT(host_throttled == 0); - TEST_ASSERT(cpu_throttled == 0); - - return EC_SUCCESS; -} - -static int test_several_limits(void) -{ - reset_mocks(); - - thermal_params[1].temp_host[EC_TEMP_THRESH_WARN] = 150; - thermal_params[1].temp_host[EC_TEMP_THRESH_HIGH] = 200; - thermal_params[1].temp_host[EC_TEMP_THRESH_HALT] = 250; - - thermal_params[2].temp_host[EC_TEMP_THRESH_WARN] = 100; - thermal_params[2].temp_host[EC_TEMP_THRESH_HIGH] = 200; - thermal_params[2].temp_host[EC_TEMP_THRESH_HALT] = 300; - - thermal_params[3].temp_host[EC_TEMP_THRESH_WARN] = 20; - thermal_params[3].temp_host[EC_TEMP_THRESH_HIGH] = 30; - thermal_params[3].temp_host[EC_TEMP_THRESH_HALT] = 40; - - set_temps(500, 100, 150, 10); - sleep(2); - TEST_ASSERT(host_throttled == 1); /* 1=low, 2=warn, 3=low */ - TEST_ASSERT(cpu_throttled == 0); - TEST_ASSERT(cpu_shutdown == 0); - - set_temps(500, 50, -1, 10); /* 1=low, 2=X, 3=low */ - sleep(2); - TEST_ASSERT(host_throttled == 0); - TEST_ASSERT(cpu_throttled == 0); - TEST_ASSERT(cpu_shutdown == 0); - - set_temps(500, 170, 210, 10); /* 1=warn, 2=high, 3=low */ - sleep(2); - TEST_ASSERT(host_throttled == 1); - TEST_ASSERT(cpu_throttled == 1); - TEST_ASSERT(cpu_shutdown == 0); - - set_temps(500, 100, 50, 40); /* 1=low, 2=low, 3=high */ - sleep(2); - TEST_ASSERT(host_throttled == 1); - TEST_ASSERT(cpu_throttled == 1); - TEST_ASSERT(cpu_shutdown == 0); - - set_temps(500, 100, 50, 41); /* 1=low, 2=low, 3=shutdown */ - sleep(2); - TEST_ASSERT(host_throttled == 1); - TEST_ASSERT(cpu_throttled == 1); - TEST_ASSERT(cpu_shutdown == 1); - - all_temps(0); /* reset from shutdown */ - sleep(2); - TEST_ASSERT(host_throttled == 0); - TEST_ASSERT(cpu_throttled == 0); - - - return EC_SUCCESS; -} - -/* Tests for ncp15wb thermistor ADC-to-temp calculation */ -#define LOW_ADC_TEST_VALUE 887 /* 0 C */ -#define HIGH_ADC_TEST_VALUE 100 /* > 100C */ - -static int test_ncp15wb_adc_to_temp(void) -{ - int i; - uint8_t temp; - uint8_t new_temp; - - /* ADC value to temperature table, data from datasheet */ - struct { - int adc; - int temp; - } adc_temp_datapoints[] = { - { 615, 30 }, - { 561, 35 }, - { 508, 40 }, - { 407, 50 }, - { 315, 60 }, - { 243, 70 }, - { 186, 80 }, - { 140, 90 }, - { 107, 100 }, - }; - - - /* - * Verify that calculated temp is decreasing for entire ADC range, - * and that a tick down in ADC value results in no more than 1C - * decrease. - */ - i = LOW_ADC_TEST_VALUE; - temp = ncp15wb_calculate_temp(i); - - while (--i > HIGH_ADC_TEST_VALUE) { - new_temp = ncp15wb_calculate_temp(i); - TEST_ASSERT(new_temp == temp || - new_temp == temp + 1); - temp = new_temp; - } - - /* Verify several datapoints are within 1C accuracy */ - for (i = 0; i < ARRAY_SIZE(adc_temp_datapoints); ++i) { - temp = ncp15wb_calculate_temp(adc_temp_datapoints[i].adc); - ASSERT(temp >= adc_temp_datapoints[i].temp - 1 && - temp <= adc_temp_datapoints[i].temp + 1); - } - - return EC_SUCCESS; -} - -#define THERMISTOR_SCALING_FACTOR 13 -static int test_thermistor_linear_interpolate(void) -{ - int i, t, t0; - uint16_t mv; - /* Simple test case - a straight line. */ - struct thermistor_data_pair line_data[] = { - { 100, 0 }, { 0, 100 } - }; - struct thermistor_info line_info = { - .scaling_factor = 1, - .num_pairs = ARRAY_SIZE(line_data), - .data = line_data, - }; - /* - * Modelled test case - Data derived from Seinhart-Hart equation in a - * resistor divider circuit with Vdd=3300mV, R = 51.1Kohm, and Murata - * NCP15WB-series thermistor (B = 4050, T0 = 298.15, nominal - * resistance (R0) = 47Kohm). - */ - struct thermistor_data_pair data[] = { - { 2512 / THERMISTOR_SCALING_FACTOR, 0 }, - { 2158 / THERMISTOR_SCALING_FACTOR, 10 }, - { 1772 / THERMISTOR_SCALING_FACTOR, 20 }, - { 1398 / THERMISTOR_SCALING_FACTOR, 30 }, - { 1070 / THERMISTOR_SCALING_FACTOR, 40 }, - { 803 / THERMISTOR_SCALING_FACTOR, 50 }, - { 597 / THERMISTOR_SCALING_FACTOR, 60 }, - { 443 / THERMISTOR_SCALING_FACTOR, 70 }, - { 329 / THERMISTOR_SCALING_FACTOR, 80 }, - { 247 / THERMISTOR_SCALING_FACTOR, 90 }, - { 188 / THERMISTOR_SCALING_FACTOR, 100 }, - }; - struct thermistor_info info = { - .scaling_factor = THERMISTOR_SCALING_FACTOR, - .num_pairs = ARRAY_SIZE(data), - .data = data, - }; - /* - * Reference data points to compare accuracy, taken from same set - * of derived values but at temp - 1, temp + 1, and in between. - */ - struct { - uint16_t mv; /* not scaled */ - int temp; - } cmp[] = { - { 3030, 1 }, { 2341, 5 }, { 2195, 9 }, - { 2120, 11 }, { 1966, 15 }, { 1811, 19 }, - { 1733, 21 }, { 1581, 25 }, { 1434, 29 }, - { 1363, 31 }, { 1227, 35 }, { 1100, 39 }, - { 1040, 41 }, { 929, 45 }, { 827, 49 }, - { 780, 51 }, { 693, 55 }, { 615, 59 }, - { 579, 61 }, { 514, 65 }, { 460, 69 }, - { 430, 71 }, { 382, 75 }, { 339, 79 }, - { 320, 81 }, { 285, 85 }, { 254, 89 }, - { 240, 91 }, { 214, 95 }, { 192, 99 }, - }; - - /* Return lowest temperature in data set if voltage is too high. */ - mv = (data[0].mv * info.scaling_factor) + 1; - t = thermistor_linear_interpolate(mv, &info); - TEST_ASSERT(t == data[0].temp); - - /* Return highest temperature in data set if voltage is too low. */ - mv = (data[info.num_pairs - 1].mv * info.scaling_factor) - 1; - t = thermistor_linear_interpolate(mv, &info); - TEST_ASSERT(t == data[info.num_pairs - 1].temp); - - /* Simple line test */ - for (mv = line_data[0].mv; - mv > line_data[line_info.num_pairs - 1].mv; - mv--) { - t = thermistor_linear_interpolate(mv, &line_info); - TEST_ASSERT(mv == line_data[line_info.num_pairs - 1].temp - t); - } - - /* - * Verify that calculated temperature monotonically - * decreases with increase in voltage (0-5V, 10mV steps). - */ - for (mv = data[0].mv * info.scaling_factor, t0 = data[0].temp; - mv > data[info.num_pairs - 1].mv; - mv -= 10) { - int t1 = thermistor_linear_interpolate(mv, &info); - - TEST_ASSERT(t1 >= t0); - t0 = t1; - } - - /* Verify against modelled data, +/- 1C due to scaling. */ - for (i = 0; i < info.num_pairs; i++) { - mv = data[i].mv * info.scaling_factor; - - t = thermistor_linear_interpolate(mv, &info); - TEST_ASSERT(t >= data[i].temp - 1 && t <= data[i].temp + 1); - } - - /* - * Verify data points that are interpolated by algorithm, allowing - * 1C of inaccuracy. - */ - for (i = 0; i < ARRAY_SIZE(cmp); i++) { - t = thermistor_linear_interpolate(cmp[i].mv, &info); - TEST_ASSERT(t >= cmp[i].temp - 1 && t <= cmp[i].temp + 1); - } - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - RUN_TEST(test_init_val); - RUN_TEST(test_sensors_can_be_read); - RUN_TEST(test_one_fan); - RUN_TEST(test_two_fans); - RUN_TEST(test_all_fans); - - RUN_TEST(test_one_limit); - RUN_TEST(test_several_limits); - - RUN_TEST(test_ncp15wb_adc_to_temp); - RUN_TEST(test_thermistor_linear_interpolate); - test_print_result(); -} diff --git a/test/thermal.tasklist b/test/thermal.tasklist deleted file mode 100644 index d22719d1fb..0000000000 --- a/test/thermal.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) diff --git a/test/timer_calib.c b/test/timer_calib.c deleted file mode 100644 index 68603762fe..0000000000 --- a/test/timer_calib.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright 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. - * - * Tasks for scheduling test. - */ - -#include "common.h" -#include "console.h" -#include "task.h" -#include "timer.h" -#include "util.h" - -uint32_t difftime(timestamp_t t0, timestamp_t t1) -{ - return (uint32_t)(t1.val-t0.val); -} - -int timer_calib_task(void *data) -{ - timestamp_t t0, t1; - unsigned d; - - while (1) { - task_wait_event(-1); - - ccprintf("\n=== Timer calibration ===\n"); - - t0 = get_time(); - t1 = get_time(); - ccprintf("- back-to-back get_time : %d us\n", difftime(t0, t1)); - - /* Sleep for 5 seconds */ - ccprintf("- sleep 1s :\n "); - cflush(); - ccprintf("Go..."); - t0 = get_time(); - usleep(1000000); - t1 = get_time(); - ccprintf("done. delay = %d us\n", difftime(t0, t1)); - - /* try small usleep */ - ccprintf("- short sleep :\n"); - cflush(); - for (d = 128; d > 0; d = d / 2) { - t0 = get_time(); - usleep(d); - t1 = get_time(); - ccprintf(" %d us => %d us\n", d, difftime(t0, t1)); - cflush(); - } - - ccprintf("Done.\n"); - } - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - task_wake(TASK_ID_TESTTMR); -} diff --git a/test/timer_calib.py b/test/timer_calib.py deleted file mode 100644 index 2a625d80c7..0000000000 --- a/test/timer_calib.py +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright 2011 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. -# -# Check timers behavior -# - -import time - -def one_pass(helper): - helper.wait_output("=== Timer calibration ===") - res = helper.wait_output("back-to-back get_time : (?P<lat>[0-9]+) us", - use_re=True)["lat"] - minlat = int(res) - helper.trace("get_time latency %d us\n" % minlat) - - helper.wait_output("sleep 1s") - t0 = time.time() - second = helper.wait_output("done. delay = (?P<second>[0-9]+) us", - use_re=True)["second"] - t1 = time.time() - secondreal = t1 - t0 - secondlat = int(second) - 1000000 - helper.trace("1s timer latency %d us / real time %f s\n" % (secondlat, - secondreal)) - - - us = {} - for pow2 in range(7): - delay = 1 << (7-pow2) - us[delay] = helper.wait_output("%d us => (?P<us>[0-9]+) us" % delay, - use_re=True)["us"] - helper.wait_output("Done.") - - return minlat, secondlat, secondreal - - -def test(helper): - one_pass(helper) - - helper.ec_command("reboot") - helper.wait_output("--- UART initialized") - - # get the timing results on the second pass - # to avoid binary translation overhead - minlat, secondlat, secondreal = one_pass(helper) - - # check that the timings somewhat make sense - if minlat > 220 or secondlat > 500 or abs(secondreal-1.0) > 0.200: - helper.fail("imprecise timings " + - "(get_time %d us sleep %d us / real time %.3f s)" % - (minlat, secondlat, secondreal)) - - return True # PASS ! diff --git a/test/timer_calib.tasklist b/test/timer_calib.tasklist deleted file mode 100644 index 51f5beb6c1..0000000000 --- a/test/timer_calib.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(TESTTMR, timer_calib_task, NULL, TASK_STACK_SIZE) diff --git a/test/timer_dos.c b/test/timer_dos.c deleted file mode 100644 index c681300102..0000000000 --- a/test/timer_dos.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright 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. - * - * Tasks for timer test. - */ - -#include "common.h" -#include "console.h" -#include "task.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -/* period between 500us and 128ms */ -#define PERIOD_US(num) (((num % 256) + 1) * 500) - -#define TEST_TIME (3 * SECOND) - -#define ERROR_MARGIN 5 - -static int calculate_golden(uint32_t seed) -{ - int golden = 0; - uint32_t elapsed = 0; - while (1) { - elapsed += PERIOD_US(seed); - ++golden; - if (elapsed >= TEST_TIME) - return golden; - seed = prng(seed); - } -} - -int task_timer(void *seed) -{ - uint32_t num = (uint32_t)(uintptr_t)seed; - int golden_cnt = calculate_golden(num); - task_id_t id = task_get_current(); - timestamp_t start; - int cnt = 0; - - while (1) { - task_wait_event(-1); - - ccprintf("\n[Timer task %d]\n", id); - start = get_time(); - - while (get_time().val - start.val < TEST_TIME) { - /* Wait for a "random" period */ - task_wait_event(PERIOD_US(num)); - ccprintf("%01d\n", id); - cnt++; - /* next pseudo random delay */ - num = prng(num); - } - ccprintf("Task %d: Count=%d Golden=%d\n", id, cnt, golden_cnt); - cnt -= golden_cnt; - if (cnt < 0) - cnt = -cnt; - if (cnt > ERROR_MARGIN) { - ccprintf("Count differs from Golden by more than %d!\n", - ERROR_MARGIN); - test_fail(); - } - } - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - wait_for_task_started(); - task_wake(TASK_ID_TMRD); - task_wake(TASK_ID_TMRC); - task_wake(TASK_ID_TMRB); - task_wake(TASK_ID_TMRA); - usleep(TEST_TIME + SECOND); - test_pass(); -} diff --git a/test/timer_dos.tasklist b/test/timer_dos.tasklist deleted file mode 100644 index 4da3419f77..0000000000 --- a/test/timer_dos.tasklist +++ /dev/null @@ -1,13 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(TMRA, task_timer, (void *)1234, TASK_STACK_SIZE) \ - TASK_TEST(TMRB, task_timer, (void *)5678, TASK_STACK_SIZE) \ - TASK_TEST(TMRC, task_timer, (void *)8462, TASK_STACK_SIZE) \ - TASK_TEST(TMRD, task_timer, (void *)3719, TASK_STACK_SIZE) diff --git a/test/timer_jump.py b/test/timer_jump.py deleted file mode 100644 index f506a69fcf..0000000000 --- a/test/timer_jump.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 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. -# -# Timer test: check time consistency when jumping between images -# - -import time - -DELAY = 5 -ERROR_MARGIN = 0.5 - -def test(helper): - helper.wait_output("idle task started") - helper.ec_command("sysinfo") - copy = helper.wait_output("Copy:\s+(?P<c>\S+)", use_re=True)["c"] - if copy != "RO": - helper.ec_command("sysjump ro") - helper.wait_output("idle task started") - helper.ec_command("gettime") - ec_start_time = helper.wait_output("Time: 0x[0-9a-f]* = (?P<t>[\d\.]+) s", - use_re=True)["t"] - time.sleep(DELAY) - helper.ec_command("sysjump a") - helper.wait_output("idle task started") - helper.ec_command("gettime") - ec_end_time = helper.wait_output("Time: 0x[0-9a-f]* = (?P<t>[\d\.]+) s", - use_re=True)["t"] - - time_diff = float(ec_end_time) - float(ec_start_time) - return time_diff >= DELAY and time_diff <= DELAY + ERROR_MARGIN diff --git a/test/timer_jump.tasklist b/test/timer_jump.tasklist deleted file mode 100644 index da0ab6211a..0000000000 --- a/test/timer_jump.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/uptime.c b/test/uptime.c deleted file mode 100644 index 651628ab7b..0000000000 --- a/test/uptime.c +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright 2019 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 <stdbool.h> - -#include "common.h" -#include "ec_commands.h" -#include "host_command.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -static bool get_ap_reset_stats_should_succeed = true; - -/* Mocks */ - -enum ec_error_list -get_ap_reset_stats(struct ap_reset_log_entry *reset_log_entries, - size_t num_reset_log_entries, uint32_t *resets_since_ec_boot) -{ - return get_ap_reset_stats_should_succeed ? EC_SUCCESS : EC_ERROR_INVAL; -} - -timestamp_t get_time(void) -{ - timestamp_t fake_time = { .val = 42 * MSEC }; - return fake_time; -} - -/* Tests */ - -test_static int test_host_uptime_info_command_success(void) -{ - int rv; - struct ec_response_uptime_info resp = { 0 }; - - get_ap_reset_stats_should_succeed = true; - - rv = test_send_host_command(EC_CMD_GET_UPTIME_INFO, 0, NULL, 0, &resp, - sizeof(resp)); - - TEST_ASSERT(rv == EC_RES_SUCCESS); - TEST_ASSERT(resp.time_since_ec_boot_ms == 42); - - return EC_RES_SUCCESS; -} - -test_static int test_host_uptime_info_command_failure(void) -{ - int rv; - struct ec_response_uptime_info resp = { 0 }; - - get_ap_reset_stats_should_succeed = false; - - rv = test_send_host_command(EC_CMD_GET_UPTIME_INFO, 0, NULL, 0, &resp, - sizeof(resp)); - - TEST_ASSERT(rv == EC_RES_ERROR); - - return EC_RES_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_host_uptime_info_command_success); - RUN_TEST(test_host_uptime_info_command_failure); - - test_print_result(); -} diff --git a/test/uptime.tasklist b/test/uptime.tasklist deleted file mode 100644 index 9bf1c80c20..0000000000 --- a/test/uptime.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST - diff --git a/test/usb_common.tasklist b/test/usb_common.tasklist deleted file mode 100644 index 9bf1c80c20..0000000000 --- a/test/usb_common.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST - diff --git a/test/usb_common_test.c b/test/usb_common_test.c deleted file mode 100644 index 620e061f74..0000000000 --- a/test/usb_common_test.c +++ /dev/null @@ -1,203 +0,0 @@ -/* Copyright 2019 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. - * - * Test USB common module. - */ -#include "test_util.h" -#include "usb_common.h" - -int test_pd_get_cc_state(void) -{ - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_RP_3_0, TYPEC_CC_VOLT_RP_3_0), - PD_CC_DFP_DEBUG_ACC, "%d"); - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_RP_3_0, TYPEC_CC_VOLT_RP_1_5), - PD_CC_DFP_DEBUG_ACC, "%d"); - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_RP_3_0, TYPEC_CC_VOLT_RP_DEF), - PD_CC_DFP_DEBUG_ACC, "%d"); - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_RP_1_5, TYPEC_CC_VOLT_RP_3_0), - PD_CC_DFP_DEBUG_ACC, "%d"); - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_RP_1_5, TYPEC_CC_VOLT_RP_1_5), - PD_CC_DFP_DEBUG_ACC, "%d"); - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_RP_1_5, TYPEC_CC_VOLT_RP_DEF), - PD_CC_DFP_DEBUG_ACC, "%d"); - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_RP_DEF, TYPEC_CC_VOLT_RP_3_0), - PD_CC_DFP_DEBUG_ACC, "%d"); - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_RP_DEF, TYPEC_CC_VOLT_RP_1_5), - PD_CC_DFP_DEBUG_ACC, "%d"); - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_RP_DEF, TYPEC_CC_VOLT_RP_DEF), - PD_CC_DFP_DEBUG_ACC, "%d"); - - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_RP_3_0, TYPEC_CC_VOLT_OPEN), - PD_CC_DFP_ATTACHED, "%d"); - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_RP_1_5, TYPEC_CC_VOLT_OPEN), - PD_CC_DFP_ATTACHED, "%d"); - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_RP_DEF, TYPEC_CC_VOLT_OPEN), - PD_CC_DFP_ATTACHED, "%d"); - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_OPEN, TYPEC_CC_VOLT_RP_3_0), - PD_CC_DFP_ATTACHED, "%d"); - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_OPEN, TYPEC_CC_VOLT_RP_1_5), - PD_CC_DFP_ATTACHED, "%d"); - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_OPEN, TYPEC_CC_VOLT_RP_DEF), - PD_CC_DFP_ATTACHED, "%d"); - - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_RD, TYPEC_CC_VOLT_RD), - PD_CC_UFP_DEBUG_ACC, "%d"); - - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_RD, TYPEC_CC_VOLT_RA), - PD_CC_UFP_ATTACHED, "%d"); - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_RD, TYPEC_CC_VOLT_OPEN), - PD_CC_UFP_ATTACHED, "%d"); - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_RA, TYPEC_CC_VOLT_RD), - PD_CC_UFP_ATTACHED, "%d"); - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_OPEN, TYPEC_CC_VOLT_RD), - PD_CC_UFP_ATTACHED, "%d"); - - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_RA, TYPEC_CC_VOLT_RA), - PD_CC_UFP_AUDIO_ACC, "%d"); - - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_OPEN, TYPEC_CC_VOLT_OPEN), - PD_CC_NONE, "%d"); - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_OPEN, TYPEC_CC_VOLT_RA), - PD_CC_NONE, "%d"); - TEST_EQ(pd_get_cc_state(TYPEC_CC_VOLT_RA, TYPEC_CC_VOLT_OPEN), - PD_CC_NONE, "%d"); - - return EC_SUCCESS; -} - -/* - * From USB Power Delivery Specification Revision 3.0, Version 2.0 - * Table 6-7 Power Data Object - */ -#define MAKE_FIXED(v, c) (0 << 30 | (v / 50) << 10 | (c / 10)) -#define MAKE_BATT(v_max, v_min, p) \ - (1 << 30 | (v_max / 50) << 20 | (v_min / 50) << 10 | (p / 250)) -#define MAKE_VAR(v_max, v_min, c) \ - (2 << 30 | (v_max / 50) << 20 | (v_min / 50) << 10 | (c / 10)) -#define MAKE_AUG(v_max, v_min, c) \ - (3 << 30 | (v_max / 100) << 17 | (v_min / 100) << 8 | (c / 50)) - -/* - * Tests various cases for pd_extract_pdo_power. It takes a very high voltage to - * exceed PD_MAX_POWER_MW without also exceeding PD_MAX_CURRENT_MA, so those - * tests are not particularly realistic. - */ -int test_pd_extract_pdo_power(void) -{ - uint32_t ma; - uint32_t max_mv; - uint32_t min_mv; - - pd_extract_pdo_power(MAKE_FIXED(/*v=*/5000, /*c=*/3000), &ma, &max_mv, - &min_mv); - TEST_EQ(max_mv, 5000, "%d"); - TEST_EQ(min_mv, 5000, "%d"); - TEST_EQ(ma, 3000, "%d"); - pd_extract_pdo_power(MAKE_FIXED(/*v=*/20000, /*c=*/2600), &ma, &max_mv, - &min_mv); - TEST_EQ(max_mv, 20000, "%d"); - TEST_EQ(min_mv, 20000, "%d"); - TEST_EQ(ma, 2600, "%d"); - pd_extract_pdo_power(MAKE_FIXED(/*v=*/20000, /*c=*/4000), &ma, &max_mv, - &min_mv); - TEST_EQ(max_mv, 20000, "%d"); - TEST_EQ(min_mv, 20000, "%d"); - TEST_EQ(ma, 3000, "%d"); /* Capped at PD_MAX_CURRENT_MA */ - pd_extract_pdo_power(MAKE_FIXED(/*v=*/10000, /*c=*/4000), &ma, &max_mv, - &min_mv); - TEST_EQ(max_mv, 10000, "%d"); - TEST_EQ(min_mv, 10000, "%d"); - TEST_EQ(ma, 3000, "%d"); /* Capped at PD_MAX_CURRENT_MA */ - pd_extract_pdo_power(MAKE_FIXED(/*v=*/21000, /*c=*/4000), &ma, &max_mv, - &min_mv); - TEST_EQ(max_mv, 21000, "%d"); - TEST_EQ(min_mv, 21000, "%d"); - TEST_EQ(ma, 2857, "%d"); /* Capped at PD_MAX_POWER_MW */ - - pd_extract_pdo_power(MAKE_BATT(/*v_max=*/5700, /*v_min=*/3300, - /*p=*/7000), - &ma, &max_mv, &min_mv); - TEST_EQ(max_mv, 5700, "%d"); - TEST_EQ(min_mv, 3300, "%d"); - TEST_EQ(ma, 2121, "%d"); /* 3300mV * 2121mA ~= 7000mW */ - pd_extract_pdo_power(MAKE_BATT(/*v_max=*/3300, /*v_min=*/2700, - /*p=*/12000), - &ma, &max_mv, &min_mv); - TEST_EQ(max_mv, 3300, "%d"); - TEST_EQ(min_mv, 2700, "%d"); - TEST_EQ(ma, 3000, "%d"); /* Capped at PD_MAX_CURRENT_MA */ - - pd_extract_pdo_power(MAKE_BATT(/*v_max=*/25000, /*v_min=*/21000, - /*p=*/61000), - &ma, &max_mv, &min_mv); - TEST_EQ(max_mv, 25000, "%d"); - TEST_EQ(min_mv, 21000, "%d"); - TEST_EQ(ma, 2857, "%d"); /* Capped at PD_MAX_POWER_MW */ - - pd_extract_pdo_power(MAKE_VAR(/*v_max=*/5000, /*v_min=*/3300, - /*c=*/3000), - &ma, &max_mv, &min_mv); - TEST_EQ(max_mv, 5000, "%d"); - TEST_EQ(min_mv, 3300, "%d"); - TEST_EQ(ma, 3000, "%d"); - pd_extract_pdo_power(MAKE_VAR(/*v_max=*/20000, /*v_min=*/5000, - /*c=*/2600), - &ma, &max_mv, &min_mv); - TEST_EQ(max_mv, 20000, "%d"); - TEST_EQ(min_mv, 5000, "%d"); - TEST_EQ(ma, 2600, "%d"); - pd_extract_pdo_power(MAKE_VAR(/*v_max=*/20000, /*v_min=*/5000, - /*c=*/4000), - &ma, &max_mv, &min_mv); - TEST_EQ(max_mv, 20000, "%d"); - TEST_EQ(min_mv, 5000, "%d"); - TEST_EQ(ma, 3000, "%d"); /* Capped at PD_MAX_CURRENT_MA */ - pd_extract_pdo_power(MAKE_VAR(/*v_max=*/10000, /*v_min=*/3300, - /*c=*/4000), - &ma, &max_mv, &min_mv); - TEST_EQ(max_mv, 10000, "%d"); - TEST_EQ(min_mv, 3300, "%d"); - TEST_EQ(ma, 3000, "%d"); /* Capped at PD_MAX_CURRENT_MA */ - pd_extract_pdo_power(MAKE_VAR(/*v_max=*/22000, /*v_min=*/21000, - /*c=*/4000), - &ma, &max_mv, &min_mv); - TEST_EQ(max_mv, 22000, "%d"); - TEST_EQ(min_mv, 21000, "%d"); - TEST_EQ(ma, 2857, "%d"); /* Capped at PD_MAX_POWER_MW */ - - pd_extract_pdo_power(MAKE_AUG(/*v_max=*/5000, /*v_min=*/3300, - /*c=*/3000), - &ma, &max_mv, &min_mv); - TEST_EQ(max_mv, 5000, "%d"); - TEST_EQ(min_mv, 3300, "%d"); - TEST_EQ(ma, 3000, "%d"); - pd_extract_pdo_power(MAKE_AUG(/*v_max=*/20000, /*v_min=*/3300, - /*c=*/2600), - &ma, &max_mv, &min_mv); - TEST_EQ(max_mv, 20000, "%d"); - TEST_EQ(min_mv, 3300, "%d"); - TEST_EQ(ma, 2600, "%d"); - pd_extract_pdo_power(MAKE_AUG(/*v_max=*/10000, /*v_min=*/3300, - /*c=*/4000), - &ma, &max_mv, &min_mv); - TEST_EQ(max_mv, 10000, "%d"); - TEST_EQ(min_mv, 3300, "%d"); - TEST_EQ(ma, 3000, "%d"); /* Capped at PD_MAX_CURRENT_MA */ - pd_extract_pdo_power(MAKE_AUG(/*v_max=*/22000, /*v_min=*/21000, - /*c=*/4000), - &ma, &max_mv, &min_mv); - TEST_EQ(max_mv, 22000, "%d"); - TEST_EQ(min_mv, 21000, "%d"); - TEST_EQ(ma, 2857, "%d"); /* Capped at PD_MAX_POWER_MW */ - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - RUN_TEST(test_pd_get_cc_state); - RUN_TEST(test_pd_extract_pdo_power); - - test_print_result(); -} diff --git a/test/usb_pd.c b/test/usb_pd.c deleted file mode 100644 index 9fdb439b49..0000000000 --- a/test/usb_pd.c +++ /dev/null @@ -1,918 +0,0 @@ -/* Copyright 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. - * - * Test USB PD module. - */ -#include "battery.h" -#include "common.h" -#include "crc.h" -#include "task.h" -#include "test_util.h" -#include "timer.h" -#include "usb_pd.h" -#include "usb_pd_test_util.h" -#include "util.h" - -#define PORT0 0 -#define PORT1 1 - -#define BATTERY_DESIGN_VOLTAGE 7600 -#define BATTERY_DESIGN_CAPACITY 5131 -#define BATTERY_FULL_CHARGE_CAPACITY 5131 -#define BATTERY_REMAINING_CAPACITY 2566 - -struct pd_port_t { - int host_mode; - int has_vbus; - int msg_tx_id; - int msg_rx_id; - int polarity; - int partner_role; /* -1 for none */ - int partner_polarity; - int rev; -} pd_port[CONFIG_USB_PD_PORT_MAX_COUNT]; - -static int give_back_called; - -/* Mock functions */ -#ifdef CONFIG_USB_PD_REV30 - -uint16_t pd_get_identity_vid(int port) -{ - return 0; -} - -uint16_t pd_get_identity_pid(int port) -{ - return 0; -} - -int battery_status(int *status) -{ - *status = 1; - return 0; -} - -int battery_remaining_capacity(int *capacity) -{ - *capacity = BATTERY_REMAINING_CAPACITY; - return 0; -} - -int battery_full_charge_capacity(int *capacity) -{ - *capacity = BATTERY_FULL_CHARGE_CAPACITY; - return 0; -} - -int battery_design_capacity(int *capacity) -{ - *capacity = BATTERY_DESIGN_CAPACITY; - return 0; -} - -int battery_design_voltage(int *voltage) -{ - *voltage = BATTERY_DESIGN_VOLTAGE; - return 0; -} - -#endif - -int pd_adc_read(int port, int cc) -{ - if (pd_port[port].host_mode && - pd_port[port].partner_role == PD_ROLE_SINK) - /* we are source connected to sink, return Rd/Open */ - return (pd_port[port].partner_polarity == cc) ? 400 : 3000; - else if (!pd_port[port].host_mode && - pd_port[port].partner_role == PD_ROLE_SOURCE) - /* we are sink connected to source, return Rp/Open */ - return (pd_port[port].partner_polarity == cc) ? 1700 : 0; - else if (pd_port[port].host_mode) - /* no sink on the other side, both CC are opened */ - return 3000; - else if (!pd_port[port].host_mode) - /* no source on the other side, both CC are opened */ - return 0; - - /* should never get here */ - return 0; -} - -int pd_snk_is_vbus_provided(int port) -{ - return pd_port[port].has_vbus; -} - -void pd_set_host_mode(int port, int enable) -{ - pd_port[port].host_mode = enable; -} - -void pd_select_polarity(int port, int polarity) -{ - pd_port[port].polarity = polarity; -} - -int pd_vdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload) -{ - return 0; -} - -int board_select_rp_value(int port, int rp) -{ - return 0; -} - -/* Tests */ - -void inc_tx_id(int port) -{ - pd_port[port].msg_tx_id = (pd_port[port].msg_tx_id + 1) % 7; -} - -void inc_rx_id(int port) -{ - pd_port[port].msg_rx_id = (pd_port[port].msg_rx_id + 1) % 7; -} - -static void init_ports(void) -{ - int i; - - for (i = 0; i < board_get_usb_pd_port_count(); ++i) { - pd_port[i].host_mode = 0; - pd_port[i].partner_role = -1; - pd_port[i].has_vbus = 0; -#ifdef CONFIG_USB_PD_REV30 - pd_port[i].rev = PD_REV30; -#else - pd_port[i].rev = PD_REV20; -#endif - } -} - -static void simulate_rx_msg(int port, uint16_t header, int cnt, - const uint32_t *data) -{ - int i; - - pd_test_rx_set_preamble(port, 1); - pd_test_rx_msg_append_sop(port); - pd_test_rx_msg_append_short(port, header); - - crc32_init(); - crc32_hash16(header); - for (i = 0; i < cnt; ++i) { - pd_test_rx_msg_append_word(port, data[i]); - crc32_hash32(data[i]); - } - pd_test_rx_msg_append_word(port, crc32_result()); - - pd_test_rx_msg_append_eop(port); - pd_test_rx_msg_append_last_edge(port); - - pd_simulate_rx(port); -} - -static void simulate_wait(int port) -{ - uint16_t header = PD_HEADER(PD_CTRL_WAIT, PD_ROLE_SOURCE, - PD_ROLE_DFP, pd_port[port].msg_rx_id, - 0, pd_port[port].rev, 0); - - simulate_rx_msg(port, header, 0, NULL); -} - -static void simulate_accept(int port) -{ - uint16_t header = PD_HEADER(PD_CTRL_ACCEPT, PD_ROLE_SOURCE, - PD_ROLE_DFP, pd_port[port].msg_rx_id, - 0, pd_port[port].rev, 0); - - simulate_rx_msg(port, header, 0, NULL); -} - -static void simulate_reject(int port) -{ - uint16_t header = PD_HEADER(PD_CTRL_REJECT, PD_ROLE_SOURCE, - PD_ROLE_DFP, pd_port[port].msg_rx_id, - 0, pd_port[port].rev, 0); - - simulate_rx_msg(port, header, 0, NULL); -} - - -#ifdef CONFIG_USB_PD_REV30 -static void simulate_get_bat_cap(int port) -{ - uint16_t msg[2]; - uint16_t header = PD_HEADER(PD_EXT_GET_BATTERY_CAP, PD_ROLE_SOURCE, - PD_ROLE_DFP, pd_port[port].msg_rx_id, - 1, pd_port[port].rev, 1); - - /* set extended header */ - msg[0] = PD_EXT_HEADER(0, 0, 1); - - /* set battery status ref */ - msg[1] = 0; - - simulate_rx_msg(port, header, 1, (const uint32_t *)msg); -} - -static void simulate_get_bat_status(int port) -{ - uint16_t msg[2]; - uint16_t header = PD_HEADER(PD_EXT_GET_BATTERY_STATUS, PD_ROLE_SOURCE, - PD_ROLE_DFP, pd_port[port].msg_rx_id, - 1, pd_port[port].rev, 1); - - /* set extended header */ - msg[0] = PD_EXT_HEADER(0, 0, 1); - - /* set battery status ref */ - msg[1] = 0; - - simulate_rx_msg(port, header, 1, (const uint32_t *)msg); -} -#endif - -static void simulate_source_cap(int port, uint32_t cnt) -{ - uint32_t src_pdo_cnt = (cnt == 0) ? 1 : pd_src_pdo_cnt; - - uint16_t header = PD_HEADER(PD_DATA_SOURCE_CAP, PD_ROLE_SOURCE, - PD_ROLE_DFP, pd_port[port].msg_rx_id, - src_pdo_cnt, pd_port[port].rev, 0); - - simulate_rx_msg(port, header, src_pdo_cnt, pd_src_pdo); -} - -static void simulate_goodcrc(int port, int role, int id) -{ - simulate_rx_msg(port, PD_HEADER(PD_CTRL_GOOD_CRC, role, role, id, 0, - pd_port[port].rev, 0), 0, NULL); -} - -static int verify_goodcrc(int port, int role, int id) -{ - - return pd_test_tx_msg_verify_sop(port) && - pd_test_tx_msg_verify_short(port, PD_HEADER(PD_CTRL_GOOD_CRC, - role, role, id, 0, 0, 0)) && - pd_test_tx_msg_verify_crc(port) && - pd_test_tx_msg_verify_eop(port); -} - -static void plug_in_source(int port, int polarity) -{ - pd_port[port].has_vbus = 1; - pd_port[port].partner_role = PD_ROLE_SOURCE; - pd_port[port].partner_polarity = polarity; - /* Indicate that the CC lines have changed. */ - task_set_event(PD_PORT_TO_TASK_ID(port), PD_EVENT_CC); -} - -static void plug_in_sink(int port, int polarity) -{ - pd_port[port].has_vbus = 0; - pd_port[port].partner_role = PD_ROLE_SINK; - pd_port[port].partner_polarity = polarity; - /* Indicate that the CC lines have changed. */ - task_set_event(PD_PORT_TO_TASK_ID(port), PD_EVENT_CC); -} - -static void unplug(int port) -{ - pd_port[port].msg_tx_id = 0; - pd_port[port].msg_rx_id = 0; - pd_port[port].has_vbus = 0; - pd_port[port].partner_role = -1; - /* Indicate that the CC lines have changed. */ - task_set_event(PD_PORT_TO_TASK_ID(port), PD_EVENT_CC); - task_wake(PD_PORT_TO_TASK_ID(port)); - usleep(30 * MSEC); -} - -void pd_snk_give_back(int port, uint32_t * const ma, uint32_t * const mv) -{ - if (*ma == 3000) - give_back_called = 1; -} - -static void simulate_ps_rdy(int port) -{ - uint16_t header = PD_HEADER(PD_CTRL_PS_RDY, PD_ROLE_SOURCE, - PD_ROLE_DFP, pd_port[port].msg_rx_id, - 0, pd_port[port].rev, 0); - - simulate_rx_msg(port, header, 0, NULL); -} - -static void simulate_goto_min(int port) -{ - uint16_t header = PD_HEADER(PD_CTRL_GOTO_MIN, PD_ROLE_SOURCE, - PD_ROLE_DFP, pd_port[port].msg_rx_id, 0, pd_port[port].rev, 0); - - simulate_rx_msg(port, header, 0, NULL); -} - -static int test_request_with_wait_and_contract(void) -{ -#ifdef CONFIG_USB_PD_REV30 - uint32_t expected_status_bsdo = - BSDO_CAP(DIV_ROUND_NEAREST(BATTERY_REMAINING_CAPACITY * - BATTERY_DESIGN_VOLTAGE, 100000)) | - BSDO_PRESENT; - uint16_t expected_cap_hdr = PD_EXT_HEADER(0, 0, 9); - uint16_t expected_cap_vid = USB_VID_GOOGLE; -#ifdef CONFIG_USB_PID - uint16_t expected_cap_pid = CONFIG_USB_PID; -#else - uint16_t expected_cap_pid = 0; -#endif - uint16_t expected_cap_des = - DIV_ROUND_NEAREST(BATTERY_DESIGN_CAPACITY * - BATTERY_DESIGN_VOLTAGE, 100000); - uint16_t expected_cap_ful = - DIV_ROUND_NEAREST(BATTERY_FULL_CHARGE_CAPACITY * - BATTERY_DESIGN_VOLTAGE, 100000); - uint16_t expected_cap_type = 0; -#endif - -#ifdef CONFIG_USB_PD_GIVE_BACK - uint32_t expected_rdo = - RDO_FIXED(2, 3000, PD_MIN_CURRENT_MA, RDO_GIVE_BACK); -#else - uint32_t expected_rdo = RDO_FIXED(2, 3000, 3000, 0); -#endif - uint8_t port = PORT0; - - plug_in_source(port, 0); - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(2 * PD_T_CC_DEBOUNCE + 100 * MSEC); - TEST_ASSERT(pd_port[port].polarity == 0); - - /* We're in SNK_DISCOVERY now. Let's send the source cap. */ - simulate_source_cap(port, 1); - task_wait_event(30 * MSEC); - TEST_ASSERT(verify_goodcrc(port, PD_ROLE_SINK, - pd_port[port].msg_rx_id)); - - /* Wait for the power request */ - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(35 * MSEC); /* tSenderResponse: 24~30 ms */ - inc_rx_id(port); - - /* Process the request */ - TEST_ASSERT(pd_test_tx_msg_verify_sop(port)); - TEST_ASSERT(pd_test_tx_msg_verify_short(port, - PD_HEADER(PD_DATA_REQUEST, PD_ROLE_SINK, PD_ROLE_UFP, - pd_port[port].msg_tx_id, 1, pd_port[port].rev, 0))); - TEST_ASSERT(pd_test_tx_msg_verify_word(port, expected_rdo)); - TEST_ASSERT(pd_test_tx_msg_verify_crc(port)); - TEST_ASSERT(pd_test_tx_msg_verify_eop(port)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - - /* Request was good. Send GoodCRC */ - simulate_goodcrc(port, PD_ROLE_SOURCE, pd_port[port].msg_tx_id); - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - inc_tx_id(port); - - /* We're in SNK_REQUESTED. Send accept */ - simulate_accept(port); - task_wait_event(30 * MSEC); - TEST_ASSERT(verify_goodcrc(0, PD_ROLE_SINK, pd_port[port].msg_rx_id)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - inc_rx_id(port); - - /* - * We're in SNK_TRANSITION. - * And we have an explicit power contract. - */ - simulate_source_cap(port, 1); - task_wait_event(30 * MSEC); - TEST_ASSERT(verify_goodcrc(port, PD_ROLE_SINK, - pd_port[port].msg_rx_id)); - - /* Wait for the power request */ - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(35 * MSEC); /* tSenderResponse: 24~30 ms */ - inc_rx_id(port); - - /* Process the request */ - TEST_ASSERT(pd_test_tx_msg_verify_sop(port)); - TEST_ASSERT(pd_test_tx_msg_verify_short(port, - PD_HEADER(PD_DATA_REQUEST, PD_ROLE_SINK, PD_ROLE_UFP, - pd_port[port].msg_tx_id, 1, pd_port[port].rev, 0))); - TEST_ASSERT(pd_test_tx_msg_verify_word(port, expected_rdo)); - TEST_ASSERT(pd_test_tx_msg_verify_crc(port)); - TEST_ASSERT(pd_test_tx_msg_verify_eop(port)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - - /* Request was good. Send GoodCRC */ - simulate_goodcrc(port, PD_ROLE_SOURCE, pd_port[port].msg_tx_id); - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - inc_tx_id(port); - - /* We're in SNK_REQUESTED. Send wait */ - simulate_wait(port); - task_wait_event(30 * MSEC); - TEST_ASSERT(verify_goodcrc(0, PD_ROLE_SINK, pd_port[port].msg_rx_id)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - /* PD_T_SINK_REQUEST. Request is sent again after 100 ms */ - task_wait_event(100 * MSEC); - inc_rx_id(port); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - - /* We had an explicit contract. So request should have been resent. */ - /* Process the request */ - TEST_ASSERT(pd_test_tx_msg_verify_sop(port)); - TEST_ASSERT(pd_test_tx_msg_verify_short(port, - PD_HEADER(PD_DATA_REQUEST, PD_ROLE_SINK, PD_ROLE_UFP, - pd_port[port].msg_tx_id, 1, - pd_port[port].rev, 0 - ))); - TEST_ASSERT(pd_test_tx_msg_verify_word(port, expected_rdo)); - TEST_ASSERT(pd_test_tx_msg_verify_crc(port)); - TEST_ASSERT(pd_test_tx_msg_verify_eop(port)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - - /* Request was good. Send GoodCRC */ - simulate_goodcrc(port, PD_ROLE_SOURCE, pd_port[port].msg_tx_id); - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - inc_tx_id(port); - - /* We're in SNK_REQUESTED. Send accept */ - simulate_accept(port); - task_wait_event(30 * MSEC); - TEST_ASSERT(verify_goodcrc(0, PD_ROLE_SINK, pd_port[port].msg_rx_id)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - inc_rx_id(port); - - /* We're in SNK_TRANSITION. Send ps_rdy */ - simulate_ps_rdy(port); - task_wait_event(30 * MSEC); - TEST_ASSERT(verify_goodcrc(0, PD_ROLE_SINK, pd_port[port].msg_rx_id)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - inc_rx_id(port); - - /* - * Test Extended Get_Battery_Cap and Get_Battery_Status messages. - */ -#ifdef CONFIG_USB_PD_REV30 - /* We're in SNK_READY. Send get battery cap. */ - simulate_get_bat_cap(port); - task_wait_event(30 * MSEC); - TEST_ASSERT(verify_goodcrc(0, PD_ROLE_SINK, pd_port[port].msg_rx_id)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - inc_rx_id(port); - - /* Process the request */ - TEST_ASSERT(pd_test_tx_msg_verify_sop(port)); - TEST_ASSERT(pd_test_tx_msg_verify_short(port, - PD_HEADER(PD_EXT_BATTERY_CAP, PD_ROLE_SINK, PD_ROLE_UFP, - pd_port[port].msg_tx_id, 3, pd_port[port].rev, 1))); - TEST_ASSERT(pd_test_tx_msg_verify_short(port, expected_cap_hdr)); - TEST_ASSERT(pd_test_tx_msg_verify_short(port, expected_cap_vid)); - TEST_ASSERT(pd_test_tx_msg_verify_short(port, expected_cap_pid)); - TEST_ASSERT(pd_test_tx_msg_verify_short(port, expected_cap_des)); - TEST_ASSERT(pd_test_tx_msg_verify_short(port, expected_cap_ful)); - TEST_ASSERT(pd_test_tx_msg_verify_short(port, expected_cap_type)); - TEST_ASSERT(pd_test_tx_msg_verify_crc(port)); - TEST_ASSERT(pd_test_tx_msg_verify_eop(port)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - - /* Request was good. Send GoodCRC */ - simulate_goodcrc(port, PD_ROLE_SOURCE, pd_port[port].msg_tx_id); - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - inc_tx_id(port); - - /* Send get battery status. */ - simulate_get_bat_status(port); - task_wait_event(30 * MSEC); - TEST_ASSERT(verify_goodcrc(0, PD_ROLE_SINK, pd_port[port].msg_rx_id)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - inc_rx_id(port); - - /* Process the request */ - TEST_ASSERT(pd_test_tx_msg_verify_sop(port)); - TEST_ASSERT(pd_test_tx_msg_verify_short(port, - PD_HEADER(PD_DATA_BATTERY_STATUS, PD_ROLE_SINK, PD_ROLE_UFP, - pd_port[port].msg_tx_id, 1, pd_port[port].rev, 0))); - TEST_ASSERT(pd_test_tx_msg_verify_word(port, expected_status_bsdo)); - TEST_ASSERT(pd_test_tx_msg_verify_crc(port)); - TEST_ASSERT(pd_test_tx_msg_verify_eop(port)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - - /* Request was good. Send GoodCRC */ - simulate_goodcrc(port, PD_ROLE_SOURCE, pd_port[port].msg_tx_id); - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - inc_tx_id(port); -#endif - /* We're in SNK_READY. Send goto_min */ - simulate_goto_min(port); - task_wait_event(30 * MSEC); - TEST_ASSERT(verify_goodcrc(0, PD_ROLE_SINK, pd_port[port].msg_rx_id)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - inc_rx_id(port); - -#ifdef CONFIG_USB_PD_GIVE_BACK - TEST_ASSERT(give_back_called); -#else - TEST_ASSERT(!give_back_called); -#endif - /* We're done */ - unplug(port); - - return EC_SUCCESS; -} - -static int test_request_with_wait(void) -{ -#ifdef CONFIG_USB_PD_GIVE_BACK - uint32_t expected_rdo = RDO_FIXED(1, 900, PD_MIN_CURRENT_MA, - RDO_CAP_MISMATCH | RDO_GIVE_BACK); -#else - uint32_t expected_rdo = RDO_FIXED(1, 900, 900, RDO_CAP_MISMATCH); -#endif - uint8_t port = PORT0; - - plug_in_source(port, 0); - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(2 * PD_T_CC_DEBOUNCE + 100 * MSEC); - TEST_ASSERT(pd_port[port].polarity == 0); - - /* We're in SNK_DISCOVERY now. Let's send the source cap. */ - simulate_source_cap(port, 0); - task_wait_event(30 * MSEC); - TEST_ASSERT(verify_goodcrc(port, - PD_ROLE_SINK, pd_port[port].msg_rx_id)); - - /* Wait for the power request */ - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(35 * MSEC); /* tSenderResponse: 24~30 ms */ - inc_rx_id(port); - - /* Process the request */ - TEST_ASSERT(pd_test_tx_msg_verify_sop(port)); - TEST_ASSERT(pd_test_tx_msg_verify_short(port, - PD_HEADER(PD_DATA_REQUEST, PD_ROLE_SINK, PD_ROLE_UFP, - pd_port[port].msg_tx_id, 1, pd_port[port].rev, 0))); - TEST_ASSERT(pd_test_tx_msg_verify_word(port, expected_rdo)); - TEST_ASSERT(pd_test_tx_msg_verify_crc(port)); - TEST_ASSERT(pd_test_tx_msg_verify_eop(port)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - - /* Request is good. Send GoodCRC */ - simulate_goodcrc(port, PD_ROLE_SOURCE, pd_port[port].msg_tx_id); - task_wake(PD_PORT_TO_TASK_ID(0)); - task_wait_event(30 * MSEC); - inc_tx_id(port); - - /* We're in SNK_REQUESTED. Send wait */ - simulate_wait(port); - task_wait_event(30 * MSEC); - TEST_ASSERT(verify_goodcrc(0, PD_ROLE_SINK, pd_port[port].msg_rx_id)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - inc_rx_id(port); - - /* We didn't have an explicit contract. So we're in SNK_DISCOVERY. */ - /* Resend Source Cap. */ - simulate_source_cap(port, 0); - task_wait_event(30 * MSEC); - TEST_ASSERT(verify_goodcrc(port, - PD_ROLE_SINK, pd_port[port].msg_rx_id)); - - /* Wait for the power request */ - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(35 * MSEC); /* tSenderResponse: 24~30 ms */ - inc_rx_id(port); - - /* Process the request */ - TEST_ASSERT(pd_test_tx_msg_verify_sop(port)); - TEST_ASSERT(pd_test_tx_msg_verify_short(port, - PD_HEADER(PD_DATA_REQUEST, PD_ROLE_SINK, PD_ROLE_UFP, - pd_port[port].msg_tx_id, 1, pd_port[port].rev, 0))); - TEST_ASSERT(pd_test_tx_msg_verify_word(port, expected_rdo)); - TEST_ASSERT(pd_test_tx_msg_verify_crc(port)); - TEST_ASSERT(pd_test_tx_msg_verify_eop(port)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - - /* Request was good. Send GoodCRC */ - simulate_goodcrc(port, PD_ROLE_SOURCE, pd_port[port].msg_tx_id); - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - inc_tx_id(port); - - /* We're done */ - unplug(port); - return EC_SUCCESS; -} - -static int test_request_with_wait_no_src_cap(void) -{ -#ifdef CONFIG_USB_PD_GIVE_BACK - uint32_t expected_rdo = RDO_FIXED(1, 900, PD_MIN_CURRENT_MA, - RDO_CAP_MISMATCH | RDO_GIVE_BACK); -#else - uint32_t expected_rdo = RDO_FIXED(1, 900, 900, RDO_CAP_MISMATCH); -#endif - uint8_t port = PORT0; - - plug_in_source(port, 0); - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(2 * PD_T_CC_DEBOUNCE + 100 * MSEC); - TEST_ASSERT(pd_port[port].polarity == 0); - - /* We're in SNK_DISCOVERY now. Let's send the source cap. */ - simulate_source_cap(port, 0); - task_wait_event(30 * MSEC); - TEST_ASSERT(verify_goodcrc(port, - PD_ROLE_SINK, pd_port[port].msg_rx_id)); - - /* Wait for the power request */ - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(35 * MSEC); /* tSenderResponse: 24~30 ms */ - inc_rx_id(port); - - /* Process the request */ - TEST_ASSERT(pd_test_tx_msg_verify_sop(port)); - TEST_ASSERT(pd_test_tx_msg_verify_short(port, - PD_HEADER(PD_DATA_REQUEST, PD_ROLE_SINK, PD_ROLE_UFP, - pd_port[port].msg_tx_id, 1, pd_port[port].rev, 0))); - TEST_ASSERT(pd_test_tx_msg_verify_word(port, expected_rdo)); - TEST_ASSERT(pd_test_tx_msg_verify_crc(port)); - TEST_ASSERT(pd_test_tx_msg_verify_eop(port)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - - /* Request is good. Send GoodCRC */ - simulate_goodcrc(port, PD_ROLE_SOURCE, pd_port[port].msg_tx_id); - task_wake(PD_PORT_TO_TASK_ID(0)); - task_wait_event(30 * MSEC); - inc_tx_id(port); - - /* We're in SNK_REQUESTED. Send wait */ - simulate_wait(port); - task_wait_event(30 * MSEC); - TEST_ASSERT(verify_goodcrc(0, PD_ROLE_SINK, pd_port[port].msg_rx_id)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - inc_rx_id(port); - - /* - * Some port partners do not send another SRC_CAP and expect us to send - * another REQUEST 100ms after the WAIT. - */ - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(100 * MSEC); /* tSinkRequest: 100 ms */ - inc_rx_id(port); - - /* Process the request */ - TEST_ASSERT(pd_test_tx_msg_verify_sop(port)); - TEST_ASSERT(pd_test_tx_msg_verify_short(port, - PD_HEADER(PD_DATA_REQUEST, PD_ROLE_SINK, PD_ROLE_UFP, - pd_port[port].msg_tx_id, 1, pd_port[port].rev, 0))); - TEST_ASSERT(pd_test_tx_msg_verify_word(port, expected_rdo)); - TEST_ASSERT(pd_test_tx_msg_verify_crc(port)); - TEST_ASSERT(pd_test_tx_msg_verify_eop(port)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - - /* Request was good. Send GoodCRC */ - simulate_goodcrc(port, PD_ROLE_SOURCE, pd_port[port].msg_tx_id); - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - inc_tx_id(port); - - /* We're done */ - unplug(port); - return EC_SUCCESS; -} - -static int test_request_with_reject(void) -{ -#ifdef CONFIG_USB_PD_GIVE_BACK - uint32_t expected_rdo = RDO_FIXED(1, 900, PD_MIN_CURRENT_MA, - RDO_CAP_MISMATCH | RDO_GIVE_BACK); -#else - uint32_t expected_rdo = RDO_FIXED(1, 900, 900, RDO_CAP_MISMATCH); -#endif - uint8_t port = PORT0; - - plug_in_source(port, 0); - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(2 * PD_T_CC_DEBOUNCE + 100 * MSEC); - TEST_ASSERT(pd_port[port].polarity == 0); - - /* We're in SNK_DISCOVERY now. Let's send the source cap. */ - simulate_source_cap(port, 0); - task_wait_event(30 * MSEC); - TEST_ASSERT(verify_goodcrc(port, - PD_ROLE_SINK, pd_port[port].msg_rx_id)); - - /* Wait for the power request */ - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(35 * MSEC); /* tSenderResponse: 24~30 ms */ - inc_rx_id(port); - - /* Process the request */ - TEST_ASSERT(pd_test_tx_msg_verify_sop(port)); - TEST_ASSERT(pd_test_tx_msg_verify_short(port, - PD_HEADER(PD_DATA_REQUEST, PD_ROLE_SINK, PD_ROLE_UFP, - pd_port[port].msg_tx_id, 1, pd_port[port].rev, 0))); - TEST_ASSERT(pd_test_tx_msg_verify_word(port, expected_rdo)); - TEST_ASSERT(pd_test_tx_msg_verify_crc(port)); - TEST_ASSERT(pd_test_tx_msg_verify_eop(port)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - - /* Request is good. Send GoodCRC */ - simulate_goodcrc(port, PD_ROLE_SOURCE, pd_port[port].msg_tx_id); - task_wake(PD_PORT_TO_TASK_ID(0)); - task_wait_event(30 * MSEC); - inc_tx_id(port); - - /* We're in SNK_REQUESTED. Send reject */ - simulate_reject(port); - task_wait_event(30 * MSEC); - TEST_ASSERT(verify_goodcrc(0, PD_ROLE_SINK, pd_port[port].msg_rx_id)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - inc_rx_id(port); - - /* We're in SNK_READY. Send source cap. again. */ - simulate_source_cap(port, 0); - task_wait_event(30 * MSEC); - TEST_ASSERT(verify_goodcrc(port, - PD_ROLE_SINK, pd_port[port].msg_rx_id)); - - /* Wait for the power request */ - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(35 * MSEC); /* tSenderResponse: 24~30 ms */ - inc_rx_id(port); - - /* Process the request */ - TEST_ASSERT(pd_test_tx_msg_verify_sop(port)); - TEST_ASSERT(pd_test_tx_msg_verify_short(port, - PD_HEADER(PD_DATA_REQUEST, PD_ROLE_SINK, PD_ROLE_UFP, - pd_port[port].msg_tx_id, 1, pd_port[port].rev, 0))); - TEST_ASSERT(pd_test_tx_msg_verify_word(port, expected_rdo)); - TEST_ASSERT(pd_test_tx_msg_verify_crc(port)); - TEST_ASSERT(pd_test_tx_msg_verify_eop(port)); - - /* We're done */ - unplug(port); - return EC_SUCCESS; -} - -static int test_request(void) -{ -#ifdef CONFIG_USB_PD_GIVE_BACK - uint32_t expected_rdo = RDO_FIXED(1, 900, PD_MIN_CURRENT_MA, - RDO_CAP_MISMATCH | RDO_GIVE_BACK); -#else - uint32_t expected_rdo = RDO_FIXED(1, 900, 900, RDO_CAP_MISMATCH); -#endif - uint8_t port = PORT0; - - plug_in_source(port, 0); - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(2 * PD_T_CC_DEBOUNCE + 100 * MSEC); - TEST_ASSERT(pd_port[port].polarity == 0); - - /* We're in SNK_DISCOVERY now. Let's send the source cap. */ - simulate_source_cap(port, 0); - task_wait_event(30 * MSEC); - TEST_ASSERT(verify_goodcrc(port, - PD_ROLE_SINK, pd_port[port].msg_rx_id)); - - /* Wait for the power request */ - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(35 * MSEC); /* tSenderResponse: 24~30 ms */ - inc_rx_id(port); - - /* Process the request */ - TEST_ASSERT(pd_test_tx_msg_verify_sop(port)); - TEST_ASSERT(pd_test_tx_msg_verify_short(port, - PD_HEADER(PD_DATA_REQUEST, PD_ROLE_SINK, PD_ROLE_UFP, - pd_port[port].msg_tx_id, 1, pd_port[port].rev, 0))); - TEST_ASSERT(pd_test_tx_msg_verify_word(port, expected_rdo)); - TEST_ASSERT(pd_test_tx_msg_verify_crc(port)); - TEST_ASSERT(pd_test_tx_msg_verify_eop(port)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - - /* Request was good. Send GoodCRC */ - simulate_goodcrc(port, PD_ROLE_SOURCE, pd_port[port].msg_tx_id); - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - inc_tx_id(port); - - /* We're done */ - unplug(port); - - return EC_SUCCESS; -} - -static int test_sink(void) -{ - int i; - uint8_t port = PORT1; - - plug_in_sink(port, 1); - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(250 * MSEC); /* tTypeCSinkWaitCap: 210~250 ms */ - TEST_ASSERT(pd_port[port].polarity == 1); - - /* The source cap should be sent */ - TEST_ASSERT(pd_test_tx_msg_verify_sop(port)); - TEST_ASSERT(pd_test_tx_msg_verify_short(port, - PD_HEADER(PD_DATA_SOURCE_CAP, PD_ROLE_SOURCE, - PD_ROLE_DFP, pd_port[port].msg_tx_id, - pd_src_pdo_cnt, pd_port[port].rev, 0))); - - for (i = 0; i < pd_src_pdo_cnt; ++i) - TEST_ASSERT(pd_test_tx_msg_verify_word(port, pd_src_pdo[i])); - - TEST_ASSERT(pd_test_tx_msg_verify_crc(port)); - TEST_ASSERT(pd_test_tx_msg_verify_eop(port)); - - /* Wake from pd_start_tx */ - task_wake(PD_PORT_TO_TASK_ID(port)); - usleep(30 * MSEC); - - /* Looks good. Ack the source cap. */ - simulate_goodcrc(port, PD_ROLE_SINK, pd_port[port].msg_tx_id); - - /* Wake from pd_rx_start */ - task_wake(PD_PORT_TO_TASK_ID(port)); - usleep(30 * MSEC); - inc_tx_id(port); - - /* We're done */ - unplug(port); - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - init_ports(); - pd_set_dual_role(PORT0, PD_DRP_TOGGLE_ON); - pd_set_dual_role(PORT1, PD_DRP_TOGGLE_ON); - - RUN_TEST(test_request); - RUN_TEST(test_sink); - RUN_TEST(test_request_with_wait); - RUN_TEST(test_request_with_wait_no_src_cap); - RUN_TEST(test_request_with_wait_and_contract); - RUN_TEST(test_request_with_reject); - - test_print_result(); -} diff --git a/test/usb_pd.tasklist b/test/usb_pd.tasklist deleted file mode 100644 index fbd319148e..0000000000 --- a/test/usb_pd.tasklist +++ /dev/null @@ -1,11 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_TEST(PD_C1, pd_task, NULL, LARGER_TASK_STACK_SIZE) diff --git a/test/usb_pd_console.c b/test/usb_pd_console.c deleted file mode 100644 index 800eae7b3d..0000000000 --- a/test/usb_pd_console.c +++ /dev/null @@ -1,472 +0,0 @@ -/* Copyright 2020 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. - * - * Test usb_pd_console - */ - -#include "common.h" -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" -#include "usb_pe_sm.h" -#include "usb_pd.h" -#include "usb_tc_sm.h" -#include "util.h" -#include "test_util.h" - -/* Defined in implementation */ -int hex8tou32(char *str, uint32_t *val); -int command_pd(int argc, char **argv); -int remote_flashing(int argc, char **argv); - -static enum try_src_override_t try_src_override; -static int test_port; -static enum pd_dpm_request request; -static int max_volt; -static int comm_enable; -static int dev_info; -static int vdm_cmd; -static int vdm_count; -static int vdm_vid; -static uint32_t vdm_data[10]; -static enum pd_dual_role_states dr_state; - -/* Mock functions */ -void pe_send_vdm(int port, uint32_t vid, int cmd, const uint32_t *data, - int count) -{ - int i; - - test_port = port; - vdm_cmd = cmd; - vdm_count = count; - vdm_vid = vid; - - if (data == NULL) - for (i = 0; i < 10; i++) - vdm_data[i] = -1; - else - for (i = 0; i < count; i++) - vdm_data[i] = data[i]; -} - -void pd_dpm_request(int port, enum pd_dpm_request req) -{ - test_port = port; - request = req; -} - -unsigned int pd_get_max_voltage(void) -{ - return 10000; -} - -void pd_request_source_voltage(int port, int mv) -{ - test_port = port; - max_volt = mv; -} - -void pd_comm_enable(int port, int enable) -{ - test_port = port; - comm_enable = enable; -} - -void tc_print_dev_info(int port) -{ - test_port = port; - dev_info = 1; -} - -void pd_set_dual_role(int port, enum pd_dual_role_states state) -{ - test_port = port; - dr_state = state; -} - -int pd_comm_is_enabled(int port) -{ - test_port = port; - return 0; -} - -int pd_get_polarity(int port) -{ - test_port = port; - return 0; -} - -uint32_t tc_get_flags(int port) -{ - test_port = port; - return 0; -} - -const char *tc_get_current_state(int port) -{ - test_port = port; - return 0; -} - -void tc_try_src_override(enum try_src_override_t ov) -{ - if (IS_ENABLED(CONFIG_USB_PD_TRY_SRC)) { - switch (ov) { - case TRY_SRC_OVERRIDE_OFF: /* 0 */ - try_src_override = TRY_SRC_OVERRIDE_OFF; - break; - case TRY_SRC_OVERRIDE_ON: /* 1 */ - try_src_override = TRY_SRC_OVERRIDE_ON; - break; - default: - try_src_override = TRY_SRC_NO_OVERRIDE; - } - } -} - -enum try_src_override_t tc_get_try_src_override(void) -{ - return try_src_override; -} - -static int test_hex8tou32(void) -{ - char const *tst_str[] = {"01234567", "89abcdef", - "AABBCCDD", "EEFF0011"}; - uint32_t const tst_int[] = {0x01234567, 0x89abcdef, - 0xaabbccdd, 0xeeff0011}; - uint32_t val; - int i; - - for (i = 0; i < 4; i++) { - hex8tou32(tst_str[i], &val); - TEST_ASSERT(val == tst_int[i]); - } - - return EC_SUCCESS; -} - -static int test_command_pd_arg_count(void) -{ - int argc; - char const *argv[] = {"pd", "", 0, 0, 0}; - - for (argc = 0; argc < 3; argc++) - TEST_ASSERT(command_pd(argc, argv) == EC_ERROR_PARAM_COUNT); - - return EC_SUCCESS; -} - -static int test_command_pd_port_num(void) -{ - int argc = 3; - char const *argv[10] = {"pd", "5", 0, 0, 0}; - - TEST_ASSERT(command_pd(argc, argv) == EC_ERROR_PARAM2); - - return EC_SUCCESS; -} - -static int test_command_pd_try_src(void) -{ - int argc = 3; - char const *argv[] = {"pd", "trysrc", "2", 0, 0}; - - try_src_override = 0; - TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); - TEST_ASSERT(try_src_override == TRY_SRC_NO_OVERRIDE); - - argv[2] = "1"; - TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); - TEST_ASSERT(try_src_override == TRY_SRC_OVERRIDE_ON); - - argv[2] = "0"; - TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); - TEST_ASSERT(try_src_override == TRY_SRC_OVERRIDE_OFF); - - return EC_SUCCESS; -} - -static int test_command_pd_tx(void) -{ - int argc = 3; - char const *argv[] = {"pd", "0", "tx", 0, 0}; - - request = 0; - TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); - TEST_ASSERT(test_port == 0); - TEST_ASSERT(request == DPM_REQUEST_SNK_STARTUP); - - return EC_SUCCESS; -} - -static int test_command_pd_charger(void) -{ - int argc = 3; - char const *argv[] = {"pd", "1", "charger", 0, 0}; - - request = 0; - TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); - TEST_ASSERT(test_port == 1); - TEST_ASSERT(request == DPM_REQUEST_SRC_STARTUP); - - return EC_SUCCESS; -} - -static int test_command_pd_dev1(void) -{ - int argc = 4; - char const *argv[] = {"pd", "0", "dev", "20", 0}; - - request = 0; - max_volt = 0; - TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); - TEST_ASSERT(test_port == 0); - TEST_ASSERT(request == DPM_REQUEST_NEW_POWER_LEVEL); - TEST_ASSERT(max_volt == 20000); - - return EC_SUCCESS; -} - -static int test_command_pd_dev2(void) -{ - int argc = 3; - char const *argv[] = {"pd", "1", "dev", 0, 0}; - - request = 0; - TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); - TEST_ASSERT(test_port == 1); - TEST_ASSERT(request == DPM_REQUEST_NEW_POWER_LEVEL); - TEST_ASSERT(max_volt == 10000); - - return EC_SUCCESS; -} - -static int test_command_pd_disable(void) -{ - int argc = 3; - char const *argv[] = {"pd", "0", "disable", 0, 0}; - - comm_enable = 1; - TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); - TEST_ASSERT(test_port == 0); - TEST_ASSERT(comm_enable == 0); - - return EC_SUCCESS; -} - -static int test_command_pd_enable(void) -{ - int argc = 3; - char const *argv[] = {"pd", "1", "enable", 0, 0}; - - comm_enable = 0; - TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); - TEST_ASSERT(test_port == 1); - TEST_ASSERT(comm_enable == 1); - - return EC_SUCCESS; -} - -static int test_command_pd_hard(void) -{ - int argc = 3; - char const *argv[] = {"pd", "0", "hard", 0, 0}; - - request = 0; - TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); - TEST_ASSERT(test_port == 0); - TEST_ASSERT(request == DPM_REQUEST_HARD_RESET_SEND); - - return EC_SUCCESS; -} - -static int test_command_pd_soft(void) -{ - int argc = 3; - char const *argv[] = {"pd", "0", "soft", 0, 0}; - - request = 0; - TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); - TEST_ASSERT(test_port == 0); - TEST_ASSERT(request == DPM_REQUEST_SOFT_RESET_SEND); - - return EC_SUCCESS; -} - -static int test_command_pd_swap1(void) -{ - int argc = 3; - char const *argv[] = {"pd", "0", "swap", 0, 0}; - - TEST_ASSERT(command_pd(argc, argv) == EC_ERROR_PARAM_COUNT); - - return EC_SUCCESS; -} - -static int test_command_pd_swap2(void) -{ - int argc = 4; - char const *argv[] = {"pd", "0", "swap", "power", 0}; - - request = 0; - TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); - TEST_ASSERT(test_port == 0); - TEST_ASSERT(request == DPM_REQUEST_PR_SWAP); - - return EC_SUCCESS; -} - -static int test_command_pd_swap3(void) -{ - int argc = 4; - char const *argv[] = {"pd", "1", "swap", "data", 0}; - - request = 0; - TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); - TEST_ASSERT(test_port == 1); - TEST_ASSERT(request == DPM_REQUEST_DR_SWAP); - - return EC_SUCCESS; -} - -static int test_command_pd_swap4(void) -{ - int argc = 4; - char const *argv[] = {"pd", "0", "swap", "vconn", 0}; - - request = 0; - TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); - TEST_ASSERT(test_port == 0); - TEST_ASSERT(request == DPM_REQUEST_VCONN_SWAP); - - return EC_SUCCESS; -} - -static int test_command_pd_swap5(void) -{ - int argc = 4; - char const *argv[] = {"pd", "0", "swap", "xyz", 0}; - - TEST_ASSERT(command_pd(argc, argv) == EC_ERROR_PARAM3); - - return EC_SUCCESS; -} - -static int test_command_pd_dualrole1(void) -{ - int argc = 4; - char const *argv[] = {"pd", "0", "dualrole", "on", 0}; - - dr_state = 0; - TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); - TEST_ASSERT(test_port == 0); - TEST_ASSERT(dr_state == PD_DRP_TOGGLE_ON); - - return EC_SUCCESS; -} - -static int test_command_pd_dualrole2(void) -{ - int argc = 4; - char const *argv[] = {"pd", "0", "dualrole", "off", 0}; - - dr_state = 0; - TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); - TEST_ASSERT(test_port == 0); - TEST_ASSERT(dr_state == PD_DRP_TOGGLE_OFF); - - return EC_SUCCESS; -} - -static int test_command_pd_dualrole3(void) -{ - int argc = 4; - char const *argv[] = {"pd", "0", "dualrole", "freeze", 0}; - - dr_state = 0; - TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); - TEST_ASSERT(test_port == 0); - TEST_ASSERT(dr_state == PD_DRP_FREEZE); - - return EC_SUCCESS; -} - -static int test_command_pd_dualrole4(void) -{ - int argc = 4; - char const *argv[] = {"pd", "0", "dualrole", "sink", 0}; - - dr_state = 0; - TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); - TEST_ASSERT(test_port == 0); - TEST_ASSERT(dr_state == PD_DRP_FORCE_SINK); - - return EC_SUCCESS; -} - -static int test_command_pd_dualrole5(void) -{ - int argc = 4; - char const *argv[] = {"pd", "0", "dualrole", "source", 0}; - - dr_state = 0; - TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); - TEST_ASSERT(test_port == 0); - TEST_ASSERT(dr_state == PD_DRP_FORCE_SOURCE); - - return EC_SUCCESS; -} - - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_hex8tou32); - RUN_TEST(test_command_pd_arg_count); - RUN_TEST(test_command_pd_port_num); - RUN_TEST(test_command_pd_try_src); - RUN_TEST(test_command_pd_tx); - RUN_TEST(test_command_pd_bist_tx); - RUN_TEST(test_command_pd_bist_rx); - RUN_TEST(test_command_pd_charger); - RUN_TEST(test_command_pd_dev1); - RUN_TEST(test_command_pd_dev2); - RUN_TEST(test_command_pd_disable); - RUN_TEST(test_command_pd_enable); - RUN_TEST(test_command_pd_hard); - RUN_TEST(test_command_pd_info); - RUN_TEST(test_command_pd_soft); - RUN_TEST(test_command_pd_swap1); - RUN_TEST(test_command_pd_swap2); - RUN_TEST(test_command_pd_swap3); - RUN_TEST(test_command_pd_swap4); - RUN_TEST(test_command_pd_swap5); - RUN_TEST(test_command_pd_ping); - RUN_TEST(test_command_pd_vdm1); - RUN_TEST(test_command_pd_vdm2); - RUN_TEST(test_command_pd_vdm3); - RUN_TEST(test_command_pd_vdm4); - RUN_TEST(test_command_pd_vdm5); - RUN_TEST(test_command_pd_vdm6); - RUN_TEST(test_command_pd_flash1); - RUN_TEST(test_command_pd_flash2); - RUN_TEST(test_command_pd_flash3); - RUN_TEST(test_command_pd_flash4); - RUN_TEST(test_command_pd_flash5); - RUN_TEST(test_command_pd_flash6); - RUN_TEST(test_command_pd_flash7); - RUN_TEST(test_command_pd_flash8); - RUN_TEST(test_command_pd_dualrole1); - RUN_TEST(test_command_pd_dualrole2); - RUN_TEST(test_command_pd_dualrole3); - RUN_TEST(test_command_pd_dualrole4); - RUN_TEST(test_command_pd_dualrole5); - - test_print_result(); -} - diff --git a/test/usb_pd_giveback.tasklist b/test/usb_pd_giveback.tasklist deleted file mode 120000 index 45cc6c8aa2..0000000000 --- a/test/usb_pd_giveback.tasklist +++ /dev/null @@ -1 +0,0 @@ -usb_pd.tasklist
\ No newline at end of file diff --git a/test/usb_pd_int.c b/test/usb_pd_int.c deleted file mode 100644 index 5d3cbbf0f2..0000000000 --- a/test/usb_pd_int.c +++ /dev/null @@ -1,112 +0,0 @@ -/* Copyright 2019 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. - * - * Test USB-PD interrupt task. - */ -#include "task.h" -#include "test_util.h" -#include "mock/tcpc_mock.h" -#include "mock/timer_mock.h" -#include "mock/usb_mux_mock.h" - -#define PORT0 0 - -/* Install Mock TCPC and MUX drivers */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { - { - .drv = &mock_tcpc_driver, - }, -}; - -const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { - { - .driver = &mock_usb_mux_driver, - } -}; - -void board_reset_pd_mcu(void) -{ -} - -static int deferred_resume_called; -void pd_deferred_resume(int port) -{ - deferred_resume_called = 1; -} - -static int num_events; -uint16_t tcpc_get_alert_status(void) -{ - if (--num_events > 0) - return PD_STATUS_TCPC_ALERT_0; - else - return 0; -} - -test_static int test_storm_not_triggered(void) -{ - num_events = 100; - deferred_resume_called = 0; - schedule_deferred_pd_interrupt(PORT0); - task_wait_event(SECOND); - TEST_EQ(deferred_resume_called, 0, "%d"); - - return EC_SUCCESS; -} - -test_static int test_storm_triggered(void) -{ - num_events = 1000; - deferred_resume_called = 0; - schedule_deferred_pd_interrupt(PORT0); - task_wait_event(SECOND); - TEST_EQ(deferred_resume_called, 1, "%d"); - - return EC_SUCCESS; -} - -test_static int test_storm_not_triggered_for_32bit_overflow(void) -{ - int i; - timestamp_t time; - - /* - * Ensure the MSB is 1 for overflow comparison tests. - * But make sure not to move time backwards. - */ - time.val = (get_time().val + 0x100000000) | 0xff000000; - force_time(time); - - /* - * 100 events every second for 10 seconds should never trigger - * a shutdown call. - */ - for (i = 0; i < 10; ++i) { - num_events = 100; - deferred_resume_called = 0; - schedule_deferred_pd_interrupt(PORT0); - task_wait_event(SECOND); - - TEST_EQ(deferred_resume_called, 0, "%d"); - } - - return EC_SUCCESS; -} - -void before_test(void) -{ - pd_set_suspend(PORT0, 0); -} - -void run_test(int argc, char **argv) -{ - /* Let tasks settle down */ - task_wait_event(MINUTE); - - RUN_TEST(test_storm_not_triggered); - RUN_TEST(test_storm_triggered); - RUN_TEST(test_storm_not_triggered_for_32bit_overflow); - - test_print_result(); -} diff --git a/test/usb_pd_int.mocklist b/test/usb_pd_int.mocklist deleted file mode 100644 index 71c2e2cee9..0000000000 --- a/test/usb_pd_int.mocklist +++ /dev/null @@ -1,8 +0,0 @@ -/* Copyright 2019 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 CONFIG_TEST_MOCK_LIST \ - MOCK(USB_MUX) \ - MOCK(TCPC) diff --git a/test/usb_pd_int.tasklist b/test/usb_pd_int.tasklist deleted file mode 100644 index 3487d55dc7..0000000000 --- a/test/usb_pd_int.tasklist +++ /dev/null @@ -1,11 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_TEST(PD_INT_C0, pd_interrupt_handler_task, 0, LARGER_TASK_STACK_SIZE) diff --git a/test/usb_pd_pdo_fixed.tasklist b/test/usb_pd_pdo_fixed.tasklist deleted file mode 100644 index 9a1e6b3e08..0000000000 --- a/test/usb_pd_pdo_fixed.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2021 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST - diff --git a/test/usb_pd_pdo_fixed_test.c b/test/usb_pd_pdo_fixed_test.c deleted file mode 100644 index ad247c3ba2..0000000000 --- a/test/usb_pd_pdo_fixed_test.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright 2021 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. - * - * Test USB common module. - */ -#include "test_util.h" -#include "usb_common.h" - -#define PDO_FIXED_FLAGS \ - (PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP | PDO_FIXED_COMM_CAP) - -/* Test that a non-fixed PDO will never be selected by pd_find_pdo_index. */ -test_static int test_pd_find_pdo_index(void) -{ - const uint32_t pd_snk_pdo[] = { - PDO_FIXED(5000, 500, PDO_FIXED_FLAGS), - PDO_VAR(4750, PD_MAX_VOLTAGE_MV, PD_MAX_CURRENT_MA), - PDO_BATT(4750, PD_MAX_VOLTAGE_MV, PD_MAX_POWER_MW), - PDO_FIXED(9000, 3000, PDO_FIXED_FLAGS), - PDO_FIXED(12000, 3000, PDO_FIXED_FLAGS), - PDO_FIXED(20000, 3000, PDO_FIXED_FLAGS), - }; - const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo); - uint32_t pdo; - - TEST_EQ(pd_find_pdo_index(pd_snk_pdo_cnt, pd_snk_pdo, 5000, &pdo), 0, - "%d"); - TEST_EQ(pd_find_pdo_index(pd_snk_pdo_cnt, pd_snk_pdo, 9000, &pdo), 3, - "%d"); - TEST_EQ(pd_find_pdo_index(pd_snk_pdo_cnt, pd_snk_pdo, 10000, &pdo), 3, - "%d"); - TEST_EQ(pd_find_pdo_index(pd_snk_pdo_cnt, pd_snk_pdo, 12000, &pdo), 4, - "%d"); - TEST_EQ(pd_find_pdo_index(pd_snk_pdo_cnt, pd_snk_pdo, 15000, &pdo), 4, - "%d"); - TEST_EQ(pd_find_pdo_index(pd_snk_pdo_cnt, pd_snk_pdo, 20000, &pdo), 5, - "%d"); - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - RUN_TEST(test_pd_find_pdo_index); - - test_print_result(); -} diff --git a/test/usb_pd_rev30.tasklist b/test/usb_pd_rev30.tasklist deleted file mode 120000 index 45cc6c8aa2..0000000000 --- a/test/usb_pd_rev30.tasklist +++ /dev/null @@ -1 +0,0 @@ -usb_pd.tasklist
\ No newline at end of file diff --git a/test/usb_pd_test_util.h b/test/usb_pd_test_util.h deleted file mode 100644 index 02fae22b41..0000000000 --- a/test/usb_pd_test_util.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright 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. - * - * Test utilities for USB PD unit test. - */ - -#ifndef __TEST_USB_PD_TEST_UTIL_H -#define __TEST_USB_PD_TEST_UTIL_H - -/* Simulate Rx message */ -void pd_test_rx_set_preamble(int port, int has_preamble); -void pd_test_rx_msg_append_bits(int port, uint32_t bits, int nb); -void pd_test_rx_msg_append_kcode(int port, uint8_t kcode); -void pd_test_rx_msg_append_sop(int port); -void pd_test_rx_msg_append_sop_prime(int port); -void pd_test_rx_msg_append_eop(int port); -void pd_test_rx_msg_append_last_edge(int port); -void pd_test_rx_msg_append_4b(int port, uint8_t val); -void pd_test_rx_msg_append_short(int port, uint16_t val); -void pd_test_rx_msg_append_word(int port, uint32_t val); -void pd_simulate_rx(int port); - -/* Verify Tx message */ -int pd_test_tx_msg_verify_kcode(int port, uint8_t kcode); -int pd_test_tx_msg_verify_sop(int port); -int pd_test_tx_msg_verify_sop_prime(int port); -int pd_test_tx_msg_verify_eop(int port); -int pd_test_tx_msg_verify_4b5b(int port, uint8_t b4); -int pd_test_tx_msg_verify_short(int port, uint16_t val); -int pd_test_tx_msg_verify_word(int port, uint32_t val); -int pd_test_tx_msg_verify_crc(int port); - -#endif /* __TEST_USB_PD_TEST_UTIL_H */ diff --git a/test/usb_pe.h b/test/usb_pe.h deleted file mode 100644 index a4967d02e5..0000000000 --- a/test/usb_pe.h +++ /dev/null @@ -1,157 +0,0 @@ -/* Copyright 2019 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. - * - * Test USB PE module. - */ -#ifndef __CROS_TEST_USB_PE_H -#define __CROS_TEST_USB_PE_H - -#include "common.h" - -/* - * Test references to port - */ -#define PORT0 0 - -/** - * usb_pe_drp_sm.c locally defined. If it changes there, it must - * be changed here as well. - */ - -/* - * Policy Engine Layer Flags - */ - -/* At least one successful PD communication packet received from port partner */ -#define PE_FLAGS_PD_CONNECTION BIT(0) -/* Accept message received from port partner */ -#define PE_FLAGS_ACCEPT BIT(1) -/* Power Supply Ready message received from port partner */ -#define PE_FLAGS_PS_READY BIT(2) -/* Protocol Error was determined based on error recovery current state */ -#define PE_FLAGS_PROTOCOL_ERROR BIT(3) -/* Set if we are in Modal Operation */ -#define PE_FLAGS_MODAL_OPERATION BIT(4) -/* A message we requested to be sent has been transmitted */ -#define PE_FLAGS_TX_COMPLETE BIT(5) -/* A message sent by a port partner has been received */ -#define PE_FLAGS_MSG_RECEIVED BIT(6) -/* A hard reset has been requested but has not been sent, not currently used */ -#define PE_FLAGS_HARD_RESET_PENDING BIT(7) -/* Port partner sent a Wait message. Wait before we resend our message */ -#define PE_FLAGS_WAIT BIT(8) -/* An explicit contract is in place with our port partner */ -#define PE_FLAGS_EXPLICIT_CONTRACT BIT(9) -/* Waiting for Sink Capabailities timed out. Used for retry error handling */ -#define PE_FLAGS_SNK_WAIT_CAP_TIMEOUT BIT(10) -/* Power Supply voltage/current transition timed out */ -#define PE_FLAGS_PS_TRANSITION_TIMEOUT BIT(11) -/* Flag to note current Atomic Message Sequence is interruptible */ -#define PE_FLAGS_INTERRUPTIBLE_AMS BIT(12) -/* Flag to note Power Supply reset has completed */ -#define PE_FLAGS_PS_RESET_COMPLETE BIT(13) -/* VCONN swap operation has completed */ -#define PE_FLAGS_VCONN_SWAP_COMPLETE BIT(14) -/* Flag to note no more setup VDMs (discovery, etc.) should be sent */ -#define PE_FLAGS_VDM_SETUP_DONE BIT(15) -/* Flag to note Swap Source Start timer should be set at PE_SRC_Startup entry */ -#define PE_FLAGS_RUN_SOURCE_START_TIMER BIT(16) -/* Flag to note Port Discovery port partner replied with BUSY */ -#define PE_FLAGS_VDM_REQUEST_BUSY BIT(17) -/* Flag to note Port Discovery port partner replied with NAK */ -#define PE_FLAGS_VDM_REQUEST_NAKED BIT(18) -/* Flag to note FRS/PRS context in shared state machine path */ -#define PE_FLAGS_FAST_ROLE_SWAP_PATH BIT(19) -/* Flag to note if FRS listening is enabled */ -#define PE_FLAGS_FAST_ROLE_SWAP_ENABLED BIT(20) -/* Flag to note TCPC passed on FRS signal from port partner */ -#define PE_FLAGS_FAST_ROLE_SWAP_SIGNALED BIT(21) - -/* List of all Policy Engine level states */ -enum usb_pe_state { - /* Super States */ - PE_PRS_FRS_SHARED, - PE_VDM_SEND_REQUEST, - - /* Normal States */ - PE_SRC_STARTUP, - PE_SRC_DISCOVERY, - PE_SRC_SEND_CAPABILITIES, - PE_SRC_NEGOTIATE_CAPABILITY, - PE_SRC_TRANSITION_SUPPLY, - PE_SRC_READY, - PE_SRC_DISABLED, - PE_SRC_CAPABILITY_RESPONSE, - PE_SRC_HARD_RESET, - PE_SRC_HARD_RESET_RECEIVED, - PE_SRC_TRANSITION_TO_DEFAULT, - PE_SNK_STARTUP, - PE_SNK_DISCOVERY, - PE_SNK_WAIT_FOR_CAPABILITIES, - PE_SNK_EVALUATE_CAPABILITY, - PE_SNK_SELECT_CAPABILITY, - PE_SNK_READY, - PE_SNK_HARD_RESET, - PE_SNK_TRANSITION_TO_DEFAULT, - PE_SNK_GIVE_SINK_CAP, - PE_SNK_GET_SOURCE_CAP, - PE_SNK_TRANSITION_SINK, - PE_SEND_SOFT_RESET, - PE_SOFT_RESET, - PE_SEND_NOT_SUPPORTED, - PE_SRC_PING, - PE_DRS_EVALUATE_SWAP, - PE_DRS_CHANGE, - PE_DRS_SEND_SWAP, - PE_PRS_SRC_SNK_EVALUATE_SWAP, - PE_PRS_SRC_SNK_TRANSITION_TO_OFF, - PE_PRS_SRC_SNK_ASSERT_RD, - PE_PRS_SRC_SNK_WAIT_SOURCE_ON, - PE_PRS_SRC_SNK_SEND_SWAP, - PE_PRS_SNK_SRC_EVALUATE_SWAP, - PE_PRS_SNK_SRC_TRANSITION_TO_OFF, - PE_PRS_SNK_SRC_ASSERT_RP, - PE_PRS_SNK_SRC_SOURCE_ON, - PE_PRS_SNK_SRC_SEND_SWAP, - PE_VCS_EVALUATE_SWAP, - PE_VCS_SEND_SWAP, - PE_VCS_WAIT_FOR_VCONN_SWAP, - PE_VCS_TURN_ON_VCONN_SWAP, - PE_VCS_TURN_OFF_VCONN_SWAP, - PE_VCS_SEND_PS_RDY_SWAP, - PE_VCS_CBL_SEND_SOFT_RESET, - PE_VDM_IDENTITY_REQUEST_CBL, - PE_INIT_PORT_VDM_IDENTITY_REQUEST, - PE_INIT_VDM_SVIDS_REQUEST, - PE_INIT_VDM_MODES_REQUEST, - PE_VDM_REQUEST_DPM, - PE_VDM_RESPONSE, - PE_HANDLE_CUSTOM_VDM_REQUEST, - PE_WAIT_FOR_ERROR_RECOVERY, - PE_BIST_TX, - PE_DEU_SEND_ENTER_USB, - PE_DR_SNK_GET_SINK_CAP, - PE_DR_SNK_GIVE_SOURCE_CAP, - PE_DR_SRC_GET_SOURCE_CAP, - - /* PD3.0 only states below here*/ - PE_FRS_SNK_SRC_START_AMS, - PE_GIVE_BATTERY_CAP, - PE_GIVE_BATTERY_STATUS, - PE_SEND_ALERT, - PE_SRC_CHUNK_RECEIVED, - PE_SNK_CHUNK_RECEIVED, -}; - -void set_state_pe(const int port, const enum usb_pe_state new_state); -enum usb_pe_state get_state_pe(const int port); - -void pe_set_flag(int port, int flag); -void pe_clr_flag(int port, int flag); -int pe_chk_flag(int port, int flag); -int pe_get_all_flags(int port); -void pe_set_all_flags(int port, int flags); -void pe_clr_dpm_requests(int port); - -#endif /* __CROS_TEST_USB_PE_H */ diff --git a/test/usb_pe_drp.c b/test/usb_pe_drp.c deleted file mode 100644 index 189cb41987..0000000000 --- a/test/usb_pe_drp.c +++ /dev/null @@ -1,326 +0,0 @@ -/* Copyright 2020 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. - * - * Test USB PE module. - */ -#include "common.h" -#include "task.h" -#include "test_util.h" -#include "timer.h" -#include "usb_emsg.h" -#include "usb_mux.h" -#include "usb_pe.h" -#include "usb_pe_sm.h" -#include "usb_sm_checks.h" -#include "mock/charge_manager_mock.h" -#include "mock/usb_tc_sm_mock.h" -#include "mock/tcpc_mock.h" -#include "mock/usb_mux_mock.h" -#include "mock/usb_pd_dpm_mock.h" -#include "mock/dp_alt_mode_mock.h" -#include "mock/usb_prl_mock.h" - -/* Install Mock TCPC and MUX drivers */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { - { - .drv = &mock_tcpc_driver, - }, -}; - -const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { - { - .driver = &mock_usb_mux_driver, - } -}; - -void before_test(void) -{ - mock_tc_port_reset(); - mock_tcpc_reset(); - mock_usb_mux_reset(); - mock_dpm_reset(); - mock_dp_alt_mode_reset(); - mock_prl_reset(); - pe_clear_port_data(PORT0); - - /* Restart the PD task and let it settle */ - task_set_event(TASK_ID_PD_C0, TASK_EVENT_RESET_DONE); - task_wait_event(SECOND); -} - -/* - * This assumes data messages only contain a single data object (uint32_t data). - * TODO: Add support for multiple data objects (when a test is added here that - * needs it). - */ -test_static void rx_message(enum tcpci_msg_type sop, - enum pd_ctrl_msg_type ctrl_msg, - enum pd_data_msg_type data_msg, - enum pd_power_role prole, - enum pd_data_role drole, - uint32_t data) -{ - int type, cnt; - - if (ctrl_msg != 0) { - type = ctrl_msg; - cnt = 0; - } else { - type = data_msg; - cnt = 1; - } - rx_emsg[PORT0].header = (PD_HEADER_SOP(sop) - | PD_HEADER(type, prole, drole, 0, cnt, PD_REV30, 0)); - rx_emsg[PORT0].len = cnt * 4; - *(uint32_t *)rx_emsg[PORT0].buf = data; - mock_prl_message_received(PORT0); -} - -/* - * This sequence is used by multiple tests, so pull out into a function to - * avoid duplication. - * - * Send in how many SOP' DiscoverIdentity requests have been processed so far, - * as this may vary depending on startup sequencing as a source. - */ -test_static int finish_src_discovery(int startup_cable_probes) -{ - int i; - - /* Expect GET_SOURCE_CAP, reply NOT_SUPPORTED. */ - TEST_EQ(mock_prl_wait_for_tx_msg(PORT0, TCPCI_MSG_SOP, - PD_CTRL_GET_SOURCE_CAP, 0, 10 * MSEC), - EC_SUCCESS, "%d"); - mock_prl_message_sent(PORT0); - task_wait_event(10 * MSEC); - rx_message(TCPCI_MSG_SOP, PD_CTRL_NOT_SUPPORTED, 0, - PD_ROLE_SINK, PD_ROLE_UFP, 0); - - /* - * Cable identity discovery is attempted 6 times total. 1 was done - * above, so expect 5 more now. - */ - for (i = startup_cable_probes; i < 6; i++) { - TEST_EQ(mock_prl_wait_for_tx_msg(PORT0, TCPCI_MSG_SOP_PRIME, - 0, PD_DATA_VENDOR_DEF, - 60 * MSEC), - EC_SUCCESS, "%d"); - mock_prl_report_error(PORT0, ERR_TCH_XMIT, TCPCI_MSG_SOP_PRIME); - } - - /* Expect VENDOR_DEF for partner identity, reply NOT_SUPPORTED. */ - TEST_EQ(mock_prl_wait_for_tx_msg(PORT0, TCPCI_MSG_SOP, - 0, PD_DATA_VENDOR_DEF, 10 * MSEC), - EC_SUCCESS, "%d"); - mock_prl_message_sent(PORT0); - task_wait_event(10 * MSEC); - rx_message(TCPCI_MSG_SOP, PD_CTRL_NOT_SUPPORTED, 0, - PD_ROLE_SINK, PD_ROLE_UFP, 0); - - return EC_SUCCESS; -} - -/* - * Verify that, before connection, PE_SRC_Send_Capabilities goes to - * PE_SRC_Discovery on send error, not PE_Send_Soft_Reset. - */ -test_static int test_send_caps_error_before_connected(void) -{ - /* Enable PE as source, expect SOURCE_CAP. */ - mock_tc_port[PORT0].power_role = PD_ROLE_SOURCE; - mock_tc_port[PORT0].pd_enable = 1; - mock_tc_port[PORT0].vconn_src = true; - TEST_EQ(mock_prl_wait_for_tx_msg(PORT0, TCPCI_MSG_SOP, - 0, PD_DATA_SOURCE_CAP, 10 * MSEC), - EC_SUCCESS, "%d"); - - /* - * Simulate error sending SOURCE_CAP, to test that before connection, - * PE_SRC_Send_Capabilities goes to PE_SRC_Discovery on send error (and - * does not send soft reset). - */ - mock_prl_report_error(PORT0, ERR_TCH_XMIT, TCPCI_MSG_SOP); - - /* - * We should have gone to PE_SRC_Discovery on above error, so expect - * VENDOR_DEF for cable identity, simulate no cable. - */ - TEST_EQ(mock_prl_wait_for_tx_msg(PORT0, TCPCI_MSG_SOP_PRIME, - 0, PD_DATA_VENDOR_DEF, 10 * MSEC), - EC_SUCCESS, "%d"); - mock_prl_report_error(PORT0, ERR_TCH_XMIT, TCPCI_MSG_SOP_PRIME); - - /* - * Expect SOURCE_CAP again. This is a retry since the first one above - * got ERR_TCH_XMIT. Now simulate success (ie GoodCRC). - */ - TEST_EQ(mock_prl_wait_for_tx_msg(PORT0, TCPCI_MSG_SOP, - 0, PD_DATA_SOURCE_CAP, 110 * MSEC), - EC_SUCCESS, "%d"); - mock_prl_message_sent(PORT0); - task_wait_event(10 * MSEC); - - /* - * From here, the sequence is very similar between - * test_send_caps_error_before_connected and - * test_send_caps_error_when_connected. We could end the test now, but - * keep going just to check that the slightly different ordering of - * cable identity discovery doesn't cause any issue below. - */ - - /* REQUEST 5V, expect ACCEPT, PS_RDY. */ - rx_message(TCPCI_MSG_SOP, 0, PD_DATA_REQUEST, - PD_ROLE_SINK, PD_ROLE_UFP, RDO_FIXED(1, 500, 500, 0)); - TEST_EQ(mock_prl_wait_for_tx_msg(PORT0, TCPCI_MSG_SOP, - PD_CTRL_ACCEPT, 0, 10 * MSEC), - EC_SUCCESS, "%d"); - mock_prl_message_sent(PORT0); - TEST_EQ(mock_prl_wait_for_tx_msg(PORT0, TCPCI_MSG_SOP, - PD_CTRL_PS_RDY, 0, 35 * MSEC), - EC_SUCCESS, "%d"); - mock_prl_message_sent(PORT0); - - TEST_EQ(finish_src_discovery(1), EC_SUCCESS, "%d"); - - task_wait_event(5 * SECOND); - - return EC_SUCCESS; -} - -/* - * Verify that, after connection, PE_SRC_Send_Capabilities goes to - * PE_Send_Soft_Reset on send error, not PE_SRC_Discovery. - */ -test_static int test_send_caps_error_when_connected(void) -{ - /* Enable PE as source, expect SOURCE_CAP. */ - mock_tc_port[PORT0].power_role = PD_ROLE_SOURCE; - mock_tc_port[PORT0].pd_enable = 1; - mock_tc_port[PORT0].vconn_src = true; - TEST_EQ(mock_prl_wait_for_tx_msg(PORT0, TCPCI_MSG_SOP, - 0, PD_DATA_SOURCE_CAP, 10 * MSEC), - EC_SUCCESS, "%d"); - mock_prl_message_sent(PORT0); - task_wait_event(10 * MSEC); - - /* REQUEST 5V, expect ACCEPT, PS_RDY. */ - rx_message(TCPCI_MSG_SOP, 0, PD_DATA_REQUEST, - PD_ROLE_SINK, PD_ROLE_UFP, RDO_FIXED(1, 500, 500, 0)); - TEST_EQ(mock_prl_wait_for_tx_msg(PORT0, TCPCI_MSG_SOP, - PD_CTRL_ACCEPT, 0, 10 * MSEC), - EC_SUCCESS, "%d"); - mock_prl_message_sent(PORT0); - TEST_EQ(mock_prl_wait_for_tx_msg(PORT0, TCPCI_MSG_SOP, - PD_CTRL_PS_RDY, 0, 35 * MSEC), - EC_SUCCESS, "%d"); - mock_prl_message_sent(PORT0); - - TEST_EQ(finish_src_discovery(0), EC_SUCCESS, "%d"); - - task_wait_event(5 * SECOND); - - /* - * Now connected. Send GET_SOURCE_CAP, to check how error sending - * SOURCE_CAP is handled. - */ - rx_message(TCPCI_MSG_SOP, PD_CTRL_GET_SOURCE_CAP, 0, - PD_ROLE_SINK, PD_ROLE_UFP, 0); - TEST_EQ(mock_prl_wait_for_tx_msg(PORT0, TCPCI_MSG_SOP, - 0, PD_DATA_SOURCE_CAP, 10 * MSEC), - EC_SUCCESS, "%d"); - - /* Simulate error sending SOURCE_CAP. */ - mock_prl_report_error(PORT0, ERR_TCH_XMIT, TCPCI_MSG_SOP); - - /* - * Expect SOFT_RESET. - * See section 8.3.3.4.1.1 PE_SRC_Send_Soft_Reset State and section - * 8.3.3.2.3 PE_SRC_Send_Capabilities State. - * "The PE_SRC_Send_Soft_Reset state Shall be entered from any state - * when ... A Message has not been sent after retries to the Sink" - */ - TEST_EQ(mock_prl_wait_for_tx_msg(PORT0, TCPCI_MSG_SOP, - PD_CTRL_SOFT_RESET, 0, 10 * MSEC), - EC_SUCCESS, "%d"); - mock_prl_message_sent(PORT0); - - task_wait_event(5 * SECOND); - - return EC_SUCCESS; -} - -/* - * Verify that when PR swap is interrupted during power transitiong, hard - * reset is sent - */ -test_static int test_interrupting_pr_swap(void) -{ - /* Enable PE as source, expect SOURCE_CAP. */ - mock_tc_port[PORT0].power_role = PD_ROLE_SOURCE; - mock_tc_port[PORT0].pd_enable = 1; - mock_tc_port[PORT0].vconn_src = true; - TEST_EQ(mock_prl_wait_for_tx_msg(PORT0, TCPCI_MSG_SOP, - 0, PD_DATA_SOURCE_CAP, 10 * MSEC), - EC_SUCCESS, "%d"); - mock_prl_message_sent(PORT0); - task_wait_event(10 * MSEC); - - /* REQUEST 5V, expect ACCEPT, PS_RDY. */ - rx_message(TCPCI_MSG_SOP, 0, PD_DATA_REQUEST, - PD_ROLE_SINK, PD_ROLE_UFP, RDO_FIXED(1, 500, 500, 0)); - TEST_EQ(mock_prl_wait_for_tx_msg(PORT0, TCPCI_MSG_SOP, - PD_CTRL_ACCEPT, 0, 10 * MSEC), - EC_SUCCESS, "%d"); - mock_prl_message_sent(PORT0); - TEST_EQ(mock_prl_wait_for_tx_msg(PORT0, TCPCI_MSG_SOP, - PD_CTRL_PS_RDY, 0, 35 * MSEC), - EC_SUCCESS, "%d"); - mock_prl_message_sent(PORT0); - - TEST_EQ(finish_src_discovery(0), EC_SUCCESS, "%d"); - - task_wait_event(5 * SECOND); - - /* - * Now connected. Initiate a PR swap and then interrupt it after the - * Accept, when power is transitioning to off. - */ - rx_message(TCPCI_MSG_SOP, PD_CTRL_PR_SWAP, 0, - PD_ROLE_SINK, PD_ROLE_UFP, 0); - - TEST_EQ(mock_prl_wait_for_tx_msg(PORT0, TCPCI_MSG_SOP, - PD_CTRL_ACCEPT, 0, 10 * MSEC), - EC_SUCCESS, "%d"); - mock_prl_message_sent(PORT0); - - task_wait_event(5 * SECOND); - - /* Interrupt the non-interruptible AMS */ - rx_message(TCPCI_MSG_SOP, PD_CTRL_PR_SWAP, 0, - PD_ROLE_SINK, PD_ROLE_UFP, 0); - - /* - * Expect a hard reset since power was transitioning during this - * interruption - */ - TEST_EQ(mock_prl_wait_for_tx_msg(PORT0, TCPCI_MSG_TX_HARD_RESET, - 0, 0, 10 * MSEC), - EC_SUCCESS, "%d"); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_send_caps_error_before_connected); - RUN_TEST(test_send_caps_error_when_connected); - RUN_TEST(test_interrupting_pr_swap); - - /* Do basic state machine validity checks last. */ - RUN_TEST(test_pe_no_parent_cycles); - - test_print_result(); -} diff --git a/test/usb_pe_drp.mocklist b/test/usb_pe_drp.mocklist deleted file mode 100644 index b8879415d8..0000000000 --- a/test/usb_pe_drp.mocklist +++ /dev/null @@ -1,13 +0,0 @@ -/* Copyright 2020 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 CONFIG_TEST_MOCK_LIST \ - MOCK(CHARGE_MANAGER) \ - MOCK(USB_TC_SM) \ - MOCK(TCPC) \ - MOCK(USB_MUX) \ - MOCK(USB_PD_DPM) \ - MOCK(DP_ALT_MODE) \ - MOCK(USB_PRL) diff --git a/test/usb_pe_drp.tasklist b/test/usb_pe_drp.tasklist deleted file mode 100644 index eb41326e3e..0000000000 --- a/test/usb_pe_drp.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TEST_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) diff --git a/test/usb_pe_drp_noextended.c b/test/usb_pe_drp_noextended.c deleted file mode 100644 index 68da7426e2..0000000000 --- a/test/usb_pe_drp_noextended.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright 2020 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. - * - * Test USB PE module. - */ -#include "common.h" -#include "task.h" -#include "test_util.h" -#include "timer.h" -#include "usb_emsg.h" -#include "usb_mux.h" -#include "usb_pe.h" -#include "usb_pe_sm.h" -#include "usb_sm_checks.h" -#include "mock/usb_tc_sm_mock.h" -#include "mock/tcpc_mock.h" -#include "mock/usb_mux_mock.h" - -/* Install Mock TCPC and MUX drivers */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { - { - .drv = &mock_tcpc_driver, - }, -}; - -const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { - { - .driver = &mock_usb_mux_driver, - } -}; - -void before_test(void) -{ - mock_tc_port_reset(); -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - /* Do basic state machine validity checks last. */ - RUN_TEST(test_pe_no_parent_cycles); - - test_print_result(); -} diff --git a/test/usb_pe_drp_noextended.mocklist b/test/usb_pe_drp_noextended.mocklist deleted file mode 120000 index c481115571..0000000000 --- a/test/usb_pe_drp_noextended.mocklist +++ /dev/null @@ -1 +0,0 @@ -usb_pe_drp.mocklist
\ No newline at end of file diff --git a/test/usb_pe_drp_noextended.tasklist b/test/usb_pe_drp_noextended.tasklist deleted file mode 100644 index eb41326e3e..0000000000 --- a/test/usb_pe_drp_noextended.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TEST_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) diff --git a/test/usb_pe_drp_old.c b/test/usb_pe_drp_old.c deleted file mode 100644 index e545667432..0000000000 --- a/test/usb_pe_drp_old.c +++ /dev/null @@ -1,431 +0,0 @@ -/* Copyright 2019 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. - * - * Test USB PE module. - */ -#include "battery.h" -#include "common.h" -#include "task.h" -#include "test_util.h" -#include "timer.h" -#include "usb_emsg.h" -#include "usb_mux.h" -#include "usb_pd.h" -#include "usb_pe.h" -#include "usb_pe_sm.h" -#include "usb_prl_sm.h" -#include "usb_sm_checks.h" -#include "usb_tc_sm.h" -#include "mock/usb_prl_mock.h" - -/** - * STUB Section - */ -const struct svdm_response svdm_rsp = { - .identity = NULL, - .svids = NULL, - .modes = NULL, -}; - -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT]; -const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT]; - -static bool prl_is_busy_flag; - -bool prl_is_busy(int port) -{ - return prl_is_busy_flag; -} - -int board_vbus_source_enabled(int port) -{ - return 0; -} -void tc_request_power_swap(int port) -{ - /* Do nothing */ -} - -void pd_set_vbus_discharge(int port, int enable) -{ - gpio_set_level(GPIO_USB_C0_DISCHARGE, enable); -} - -test_static uint8_t tc_enabled = 1; - -uint8_t tc_get_pd_enabled(int port) -{ - return tc_enabled; -} - -void pd_comm_enable(int port, int enable) -{ - tc_enabled = !!enable; -} - -bool pd_alt_mode_capable(int port) -{ - return 1; -} - -void pd_set_suspend(int port, int suspend) -{ - -} - -void pd_set_error_recovery(int port) -{ - -} - -test_static void setup_source(void) -{ - /* Start PE. */ - task_wait_event(10 * MSEC); - pe_set_flag(PORT0, PE_FLAGS_VDM_SETUP_DONE); - pe_set_flag(PORT0, PE_FLAGS_EXPLICIT_CONTRACT); - /* As long as we're hacking our way to ready, clear any DPM requests */ - pe_clr_dpm_requests(PORT0); - set_state_pe(PORT0, PE_SRC_READY); - task_wait_event(10 * MSEC); - /* At this point, the PE should be running in PE_SRC_Ready. */ -} - -test_static void setup_sink(void) -{ - tc_set_power_role(PORT0, PD_ROLE_SINK); - pd_comm_enable(PORT0, 0); - task_wait_event(10 * MSEC); - pd_comm_enable(PORT0, 1); - task_wait_event(10 * MSEC); - pe_set_flag(PORT0, PE_FLAGS_VDM_SETUP_DONE); - pe_set_flag(PORT0, PE_FLAGS_EXPLICIT_CONTRACT); - /* As long as we're hacking our way to ready, clear any DPM requests */ - pe_clr_dpm_requests(PORT0); - set_state_pe(PORT0, PE_SNK_READY); - task_wait_event(10 * MSEC); - /* At this point, the PE should be running in PE_SNK_Ready. */ -} -/** - * Test section - */ -/* PE Fast Role Swap */ -static int test_pe_frs(void) -{ - /* - * TODO(b/173791979): This test should validate PE boundary API - * differences -- not internal state changes. - */ - - task_wait_event(10 * MSEC); - TEST_ASSERT(pe_is_running(PORT0)); - - /* - * FRS will only trigger when we are SNK, with an Explicit - * contract. So set this state up manually. Also ensure any - * background tasks (ex. discovery) aren't running. - */ - tc_prs_src_snk_assert_rd(PORT0); - pe_set_flag(PORT0, PE_FLAGS_VDM_SETUP_DONE); - pe_set_flag(PORT0, PE_FLAGS_EXPLICIT_CONTRACT); - pe_clr_dpm_requests(PORT0); - set_state_pe(PORT0, PE_SNK_READY); - task_wait_event(10 * MSEC); - TEST_ASSERT(get_state_pe(PORT0) == PE_SNK_READY); - - /* - * Trigger the Fast Role Switch from simulated ISR - */ - pd_got_frs_signal(PORT0); - TEST_ASSERT(pe_chk_flag(PORT0, PE_FLAGS_FAST_ROLE_SWAP_SIGNALED)); - - /* - * Verify we detected FRS and ready to start swap - */ - task_wait_event(10 * MSEC); - TEST_ASSERT(get_state_pe(PORT0) == PE_PRS_SNK_SRC_SEND_SWAP); - TEST_ASSERT(pe_chk_flag(PORT0, PE_FLAGS_FAST_ROLE_SWAP_PATH)); - TEST_ASSERT(!pe_chk_flag(PORT0, PE_FLAGS_EXPLICIT_CONTRACT)); - - /* - * Make sure that we sent FR_Swap - */ - task_wait_event(10 * MSEC); - TEST_ASSERT(mock_prl_get_last_sent_ctrl_msg(PORT0) == PD_CTRL_FR_SWAP); - TEST_ASSERT(get_state_pe(PORT0) == PE_PRS_SNK_SRC_SEND_SWAP); - TEST_ASSERT(pe_chk_flag(PORT0, PE_FLAGS_FAST_ROLE_SWAP_PATH)); - pe_set_flag(PORT0, PE_FLAGS_TX_COMPLETE); - - /* - * Accept the partners PS_RDY control message - */ - rx_emsg[PORT0].header = PD_HEADER(PD_CTRL_ACCEPT, 0, 0, 0, 0, 0, 0); - pe_set_flag(PORT0, PE_FLAGS_MSG_RECEIVED); - task_wait_event(10 * MSEC); - TEST_ASSERT(!pe_chk_flag(PORT0, PE_FLAGS_MSG_RECEIVED)); - TEST_ASSERT(get_state_pe(PORT0) == PE_PRS_SNK_SRC_TRANSITION_TO_OFF); - TEST_ASSERT(pe_chk_flag(PORT0, PE_FLAGS_FAST_ROLE_SWAP_PATH)); - - /* - * Send back our PS_RDY - */ - rx_emsg[PORT0].header = PD_HEADER(PD_CTRL_PS_RDY, 0, 0, 0, 0, 0, 0); - pe_set_flag(PORT0, PE_FLAGS_MSG_RECEIVED); - TEST_ASSERT(!tc_is_attached_src(PORT0)); - task_wait_event(10 * MSEC); - TEST_ASSERT(!pe_chk_flag(PORT0, PE_FLAGS_MSG_RECEIVED)); - TEST_ASSERT(tc_is_attached_src(PORT0)); - TEST_ASSERT(get_state_pe(PORT0) == PE_PRS_SNK_SRC_SOURCE_ON); - TEST_ASSERT(pe_chk_flag(PORT0, PE_FLAGS_FAST_ROLE_SWAP_PATH)); - - /* - * After delay we are ready to send our PS_RDY - */ - task_wait_event(PD_POWER_SUPPLY_TURN_ON_DELAY); - TEST_ASSERT(get_state_pe(PORT0) == PE_PRS_SNK_SRC_SOURCE_ON); - TEST_ASSERT(pe_chk_flag(PORT0, PE_FLAGS_FAST_ROLE_SWAP_PATH)); - TEST_ASSERT(mock_prl_get_last_sent_ctrl_msg(PORT0) == PD_CTRL_PS_RDY); - - /* - * Fake the Transmit complete and this will bring us to Source Startup - */ - pe_set_flag(PORT0, PE_FLAGS_TX_COMPLETE); - task_wait_event(10 * MSEC); - TEST_ASSERT(get_state_pe(PORT0) == PE_SRC_STARTUP); - TEST_ASSERT(!pe_chk_flag(PORT0, PE_FLAGS_FAST_ROLE_SWAP_PATH)); - - return EC_SUCCESS; -} - -static int test_snk_give_source_cap(void) -{ - setup_sink(); - - /* - * Receive a Get_Source_Cap message; respond with Source_Capabilities - * and return to PE_SNK_Ready once sent. - */ - rx_emsg[PORT0].header = - PD_HEADER(PD_CTRL_GET_SOURCE_CAP, 0, 0, 0, 0, 0, 0); - pe_set_flag(PORT0, PE_FLAGS_MSG_RECEIVED); - task_wait_event(10 * MSEC); - - TEST_ASSERT(!pe_chk_flag(PORT0, PE_FLAGS_MSG_RECEIVED)); - TEST_ASSERT(!pe_chk_flag(PORT0, PE_FLAGS_TX_COMPLETE)); - TEST_EQ(mock_prl_get_last_sent_data_msg(PORT0), - PD_DATA_SOURCE_CAP, "%d"); - TEST_EQ(get_state_pe(PORT0), PE_DR_SNK_GIVE_SOURCE_CAP, "%d"); - - pe_set_flag(PORT0, PE_FLAGS_TX_COMPLETE); - task_wait_event(10 * MSEC); - TEST_EQ(get_state_pe(PORT0), PE_SNK_READY, "%d"); - - return EC_SUCCESS; -} - -static int test_vbus_gpio_discharge(void) -{ - pd_set_vbus_discharge(PORT0, 1); - TEST_EQ(gpio_get_level(GPIO_USB_C0_DISCHARGE), 1, "%d"); - - pd_set_vbus_discharge(PORT0, 0); - TEST_EQ(gpio_get_level(GPIO_USB_C0_DISCHARGE), 0, "%d"); - - return EC_SUCCESS; -} - -test_static int test_extended_message_not_supported(void) -{ - memset(rx_emsg[PORT0].buf, 0, ARRAY_SIZE(rx_emsg[PORT0].buf)); - - /* - * Receive an extended, non-chunked message; expect a Not Supported - * response. - */ - rx_emsg[PORT0].header = PD_HEADER( - PD_DATA_BATTERY_STATUS, PD_ROLE_SINK, PD_ROLE_UFP, 0, - PDO_MAX_OBJECTS, PD_REV30, 1); - *(uint16_t *)rx_emsg[PORT0].buf = - PD_EXT_HEADER(0, 0, ARRAY_SIZE(rx_emsg[PORT0].buf)) & ~BIT(15); - pe_set_flag(PORT0, PE_FLAGS_MSG_RECEIVED); - mock_prl_clear_last_sent_msg(PORT0); - task_wait_event(10 * MSEC); - - pe_set_flag(PORT0, PE_FLAGS_TX_COMPLETE); - task_wait_event(10 * MSEC); - TEST_EQ(mock_prl_get_last_sent_ctrl_msg(PORT0), PD_CTRL_NOT_SUPPORTED, - "%d"); - /* At this point, the PE should again be running in PE_SRC_Ready. */ - - /* - * Receive an extended, chunked, single-chunk message; expect a Not - * Supported response. - */ - rx_emsg[PORT0].header = PD_HEADER( - PD_DATA_BATTERY_STATUS, PD_ROLE_SINK, PD_ROLE_UFP, 0, - PDO_MAX_OBJECTS, PD_REV30, 1); - *(uint16_t *)rx_emsg[PORT0].buf = - PD_EXT_HEADER(0, 0, PD_MAX_EXTENDED_MSG_CHUNK_LEN); - pe_set_flag(PORT0, PE_FLAGS_MSG_RECEIVED); - mock_prl_clear_last_sent_msg(PORT0); - task_wait_event(10 * MSEC); - - pe_set_flag(PORT0, PE_FLAGS_TX_COMPLETE); - task_wait_event(10 * MSEC); - TEST_EQ(mock_prl_get_last_sent_ctrl_msg(PORT0), PD_CTRL_NOT_SUPPORTED, - "%d"); - /* At this point, the PE should again be running in PE_SRC_Ready. */ - - /* - * Receive an extended, chunked, multi-chunk message; expect a Not - * Supported response after tChunkingNotSupported (not earlier). - */ - rx_emsg[PORT0].header = PD_HEADER( - PD_DATA_BATTERY_STATUS, PD_ROLE_SINK, PD_ROLE_UFP, 0, - PDO_MAX_OBJECTS, PD_REV30, 1); - *(uint16_t *)rx_emsg[PORT0].buf = - PD_EXT_HEADER(0, 0, ARRAY_SIZE(rx_emsg[PORT0].buf)); - pe_set_flag(PORT0, PE_FLAGS_MSG_RECEIVED); - mock_prl_clear_last_sent_msg(PORT0); - task_wait_event(10 * MSEC); - /* - * The PE should stay in PE_SRC_Chunk_Received for - * tChunkingNotSupported. - */ - task_wait_event(10 * MSEC); - TEST_NE(mock_prl_get_last_sent_ctrl_msg(PORT0), PD_CTRL_NOT_SUPPORTED, - "%d"); - - task_wait_event(PD_T_CHUNKING_NOT_SUPPORTED); - pe_set_flag(PORT0, PE_FLAGS_TX_COMPLETE); - task_wait_event(10 * MSEC); - TEST_EQ(mock_prl_get_last_sent_ctrl_msg(PORT0), PD_CTRL_NOT_SUPPORTED, - "%d"); - /* At this point, the PE should again be running in PE_SRC_Ready. */ - - /* - * TODO(b/160374787): Test responding with Not Supported to control - * messages requesting extended messages as responses. - */ - - return EC_SUCCESS; -} - -test_static int test_extended_message_not_supported_src(void) -{ - setup_source(); - return test_extended_message_not_supported(); -} - -test_static int test_extended_message_not_supported_snk(void) -{ - setup_sink(); - return test_extended_message_not_supported(); -} - -test_static int test_prl_is_busy(enum pd_power_role pr) -{ - int ready_state; - - if (pr == PD_ROLE_SOURCE) - ready_state = PE_SRC_READY; - else - ready_state = PE_SNK_READY; - - /* Start in ready state with Protocol Layer busy */ - TEST_ASSERT(get_state_pe(PORT0) == ready_state); - prl_is_busy_flag = true; - - /* Make a request to perform a Port Discovery */ - pd_dpm_request(PORT0, DPM_REQUEST_PORT_DISCOVERY); - task_wait_event(10 * MSEC); - task_wait_event(10 * MSEC); - - /* - * We should still be in ready state because the Protocol - * Layer is busy and can't send our message at this time. - */ - TEST_ASSERT(get_state_pe(PORT0) == ready_state); - - /* Protocol Layer is not busy now */ - prl_is_busy_flag = false; - task_wait_event(10 * MSEC); - task_wait_event(10 * MSEC); - - /* - * The Protocol Layer is no longer busy so we can switch to the - * state that will handle sending the Port Discovery messages. - */ - TEST_ASSERT(get_state_pe(PORT0) != ready_state); - - return EC_SUCCESS; -} - -test_static int test_prl_is_busy_snk(void) -{ - setup_sink(); - return test_prl_is_busy(PD_ROLE_SINK); -} - -test_static int test_prl_is_busy_src(void) -{ - setup_source(); - return test_prl_is_busy(PD_ROLE_SOURCE); -} - -static int test_send_caps_error(void) -{ - /* - * See section 8.3.3.4.1.1 PE_SRC_Send_Soft_Reset State and section - * 8.3.3.2.3 PE_SRC_Send_Capabilities State. - * - * Transition to the PE_SRC_Discovery state when: - * 1) The Protocol Layer indicates that the Message has not been sent - * and we are presently not Connected - */ - mock_prl_clear_last_sent_msg(PORT0); - pe_set_flag(PORT0, PE_FLAGS_PROTOCOL_ERROR); - pe_clr_flag(PORT0, PE_FLAGS_PD_CONNECTION); - set_state_pe(PORT0, PE_SRC_SEND_CAPABILITIES); - task_wait_event(10 * MSEC); - TEST_EQ(mock_prl_get_last_sent_ctrl_msg(PORT0), 0, "%d"); - TEST_EQ(get_state_pe(PORT0), PE_SRC_DISCOVERY, "%d"); - - /* - * Send soft reset when: - * 1) The Protocol Layer indicates that the Message has not been sent - * and we are already Connected - */ - mock_prl_clear_last_sent_msg(PORT0); - pe_set_flag(PORT0, PE_FLAGS_PROTOCOL_ERROR); - pe_set_flag(PORT0, PE_FLAGS_PD_CONNECTION); - set_state_pe(PORT0, PE_SRC_SEND_CAPABILITIES); - task_wait_event(10 * MSEC); - TEST_EQ(mock_prl_get_last_sent_ctrl_msg(PORT0), - PD_CTRL_SOFT_RESET, "%d"); - TEST_EQ(get_state_pe(PORT0), PE_SEND_SOFT_RESET, "%d"); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_pe_frs); - RUN_TEST(test_snk_give_source_cap); - RUN_TEST(test_vbus_gpio_discharge); -#ifndef CONFIG_USB_PD_EXTENDED_MESSAGES - RUN_TEST(test_extended_message_not_supported_src); - RUN_TEST(test_extended_message_not_supported_snk); -#else - RUN_TEST(test_prl_is_busy_src); - RUN_TEST(test_prl_is_busy_snk); -#endif - RUN_TEST(test_send_caps_error); - /* Do basic state machine validity checks last. */ - RUN_TEST(test_pe_no_parent_cycles); - - test_print_result(); -} diff --git a/test/usb_pe_drp_old.mocklist b/test/usb_pe_drp_old.mocklist deleted file mode 100644 index 0582e5cbb3..0000000000 --- a/test/usb_pe_drp_old.mocklist +++ /dev/null @@ -1,7 +0,0 @@ -/* Copyright 2020 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 CONFIG_TEST_MOCK_LIST \ - MOCK(USB_PRL) diff --git a/test/usb_pe_drp_old.tasklist b/test/usb_pe_drp_old.tasklist deleted file mode 100644 index eb41326e3e..0000000000 --- a/test/usb_pe_drp_old.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TEST_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) diff --git a/test/usb_pe_drp_old_noextended.c b/test/usb_pe_drp_old_noextended.c deleted file mode 100644 index cefd77b7d2..0000000000 --- a/test/usb_pe_drp_old_noextended.c +++ /dev/null @@ -1,365 +0,0 @@ -/* Copyright 2019 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. - * - * Test USB PE module. - */ -#include "battery.h" -#include "common.h" -#include "task.h" -#include "test_util.h" -#include "timer.h" -#include "usb_emsg.h" -#include "usb_mux.h" -#include "usb_pe.h" -#include "usb_pe_sm.h" -#include "usb_prl_sm.h" -#include "usb_sm_checks.h" -#include "usb_tc_sm.h" - -/** - * STUB Section - */ -const struct svdm_response svdm_rsp = { - .identity = NULL, - .svids = NULL, - .modes = NULL, -}; - -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT]; -const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT]; - -int board_vbus_source_enabled(int port) -{ - return 0; -} -void tc_request_power_swap(int port) -{ - /* Do nothing */ -} - -void pd_set_vbus_discharge(int port, int enable) -{ - gpio_set_level(GPIO_USB_C0_DISCHARGE, enable); -} - -test_static uint8_t tc_enabled = 1; - -uint8_t tc_get_pd_enabled(int port) -{ - return tc_enabled; -} - -void pd_comm_enable(int port, int enable) -{ - tc_enabled = !!enable; -} - -bool pd_alt_mode_capable(int port) -{ - return 1; -} - -void pd_set_suspend(int port, int suspend) -{ - -} - -void pd_set_error_recovery(int port) -{ - -} - -test_static void setup_source(void) -{ - /* Start PE. */ - task_wait_event(10 * MSEC); - pe_set_flag(PORT0, PE_FLAGS_VDM_SETUP_DONE); - pe_set_flag(PORT0, PE_FLAGS_EXPLICIT_CONTRACT); - set_state_pe(PORT0, PE_SRC_READY); - task_wait_event(10 * MSEC); - /* At this point, the PE should be running in PE_SRC_Ready. */ -} - -test_static void setup_sink(void) -{ - tc_set_power_role(PORT0, PD_ROLE_SINK); - pd_comm_enable(PORT0, 0); - task_wait_event(10 * MSEC); - pd_comm_enable(PORT0, 1); - task_wait_event(10 * MSEC); - pe_set_flag(PORT0, PE_FLAGS_VDM_SETUP_DONE); - pe_set_flag(PORT0, PE_FLAGS_EXPLICIT_CONTRACT); - set_state_pe(PORT0, PE_SNK_READY); - task_wait_event(10 * MSEC); - /* At this point, the PE should be running in PE_SNK_Ready. */ -} -/** - * Test section - */ -/* PE Fast Role Swap */ -static int test_pe_frs(void) -{ - /* - * TODO: This test should validate PE boundary API differences -- not - * internal state changes. - */ - - task_wait_event(10 * MSEC); - TEST_ASSERT(pe_is_running(PORT0)); - - /* - * FRS will only trigger when we are SNK, with an Explicit - * contract. So set this state up manually. Also ensure any - * background tasks (ex. discovery) aren't running. - */ - tc_prs_src_snk_assert_rd(PORT0); - pe_set_flag(PORT0, PE_FLAGS_VDM_SETUP_DONE); - pe_set_flag(PORT0, PE_FLAGS_EXPLICIT_CONTRACT); - set_state_pe(PORT0, PE_SNK_READY); - task_wait_event(10 * MSEC); - TEST_ASSERT(get_state_pe(PORT0) == PE_SNK_READY); - - /* - * Trigger the Fast Role Switch from simulated ISR - */ - pd_got_frs_signal(PORT0); - TEST_ASSERT(pe_chk_flag(PORT0, PE_FLAGS_FAST_ROLE_SWAP_SIGNALED)); - - /* - * Verify we detected FRS and ready to start swap - */ - task_wait_event(10 * MSEC); - TEST_ASSERT(get_state_pe(PORT0) == PE_PRS_SNK_SRC_SEND_SWAP); - TEST_ASSERT(pe_chk_flag(PORT0, PE_FLAGS_FAST_ROLE_SWAP_PATH)); - TEST_ASSERT(!pe_chk_flag(PORT0, PE_FLAGS_EXPLICIT_CONTRACT)); - - /* - * Make sure that we sent FR_Swap - */ - task_wait_event(10 * MSEC); - TEST_ASSERT(fake_prl_get_last_sent_ctrl_msg(PORT0) == PD_CTRL_FR_SWAP); - TEST_ASSERT(get_state_pe(PORT0) == PE_PRS_SNK_SRC_SEND_SWAP); - TEST_ASSERT(pe_chk_flag(PORT0, PE_FLAGS_FAST_ROLE_SWAP_PATH)); - - /* - * Accept the partners PS_RDY control message - */ - rx_emsg[PORT0].header = PD_HEADER(PD_CTRL_ACCEPT, 0, 0, 0, 0, 0, 0); - pe_set_flag(PORT0, PE_FLAGS_MSG_RECEIVED); - task_wait_event(10 * MSEC); - TEST_ASSERT(!pe_chk_flag(PORT0, PE_FLAGS_MSG_RECEIVED)); - TEST_ASSERT(get_state_pe(PORT0) == PE_PRS_SNK_SRC_TRANSITION_TO_OFF); - TEST_ASSERT(pe_chk_flag(PORT0, PE_FLAGS_FAST_ROLE_SWAP_PATH)); - - /* - * Send back our PS_RDY - */ - rx_emsg[PORT0].header = PD_HEADER(PD_CTRL_PS_RDY, 0, 0, 0, 0, 0, 0); - pe_set_flag(PORT0, PE_FLAGS_MSG_RECEIVED); - TEST_ASSERT(!tc_is_attached_src(PORT0)); - task_wait_event(10 * MSEC); - TEST_ASSERT(!pe_chk_flag(PORT0, PE_FLAGS_MSG_RECEIVED)); - TEST_ASSERT(tc_is_attached_src(PORT0)); - TEST_ASSERT(get_state_pe(PORT0) == PE_PRS_SNK_SRC_SOURCE_ON); - TEST_ASSERT(pe_chk_flag(PORT0, PE_FLAGS_FAST_ROLE_SWAP_PATH)); - - /* - * After delay we are ready to send our PS_RDY - */ - task_wait_event(PD_POWER_SUPPLY_TURN_ON_DELAY); - TEST_ASSERT(get_state_pe(PORT0) == PE_PRS_SNK_SRC_SOURCE_ON); - TEST_ASSERT(pe_chk_flag(PORT0, PE_FLAGS_FAST_ROLE_SWAP_PATH)); - TEST_ASSERT(fake_prl_get_last_sent_ctrl_msg(PORT0) == PD_CTRL_PS_RDY); - - /* - * Fake the Transmit complete and this will bring us to Source Startup - */ - pe_set_flag(PORT0, PE_FLAGS_TX_COMPLETE); - task_wait_event(10 * MSEC); - TEST_ASSERT(get_state_pe(PORT0) == PE_SRC_STARTUP); - TEST_ASSERT(!pe_chk_flag(PORT0, PE_FLAGS_FAST_ROLE_SWAP_PATH)); - - return EC_SUCCESS; -} - -static int test_snk_give_source_cap(void) -{ - setup_sink(); - - /* - * Receive a Get_Source_Cap message; respond with Source_Capabilities - * and return to PE_SNK_Ready once sent. - */ - rx_emsg[PORT0].header = - PD_HEADER(PD_CTRL_GET_SOURCE_CAP, 0, 0, 0, 0, 0, 0); - pe_set_flag(PORT0, PE_FLAGS_MSG_RECEIVED); - task_wait_event(10 * MSEC); - - TEST_ASSERT(!pe_chk_flag(PORT0, PE_FLAGS_MSG_RECEIVED)); - TEST_ASSERT(!pe_chk_flag(PORT0, PE_FLAGS_TX_COMPLETE)); - TEST_EQ(fake_prl_get_last_sent_data_msg_type(PORT0), - PD_DATA_SOURCE_CAP, "%d"); - TEST_EQ(get_state_pe(PORT0), PE_DR_SNK_GIVE_SOURCE_CAP, "%d"); - - pe_set_flag(PORT0, PE_FLAGS_TX_COMPLETE); - task_wait_event(10 * MSEC); - TEST_EQ(get_state_pe(PORT0), PE_SNK_READY, "%d"); - - return EC_SUCCESS; -} - -static int test_vbus_gpio_discharge(void) -{ - pd_set_vbus_discharge(PORT0, 1); - TEST_EQ(gpio_get_level(GPIO_USB_C0_DISCHARGE), 1, "%d"); - - pd_set_vbus_discharge(PORT0, 0); - TEST_EQ(gpio_get_level(GPIO_USB_C0_DISCHARGE), 0, "%d"); - - return EC_SUCCESS; -} - -test_static int test_extended_message_not_supported(void) -{ - memset(rx_emsg[PORT0].buf, 0, ARRAY_SIZE(rx_emsg[PORT0].buf)); - - /* - * Receive an extended, non-chunked message; expect a Not Supported - * response. - */ - rx_emsg[PORT0].header = PD_HEADER( - PD_DATA_BATTERY_STATUS, PD_ROLE_SINK, PD_ROLE_UFP, 0, - PDO_MAX_OBJECTS, PD_REV30, 1); - *(uint16_t *)rx_emsg[PORT0].buf = - PD_EXT_HEADER(0, 0, ARRAY_SIZE(rx_emsg[PORT0].buf)) & ~BIT(15); - pe_set_flag(PORT0, PE_FLAGS_MSG_RECEIVED); - fake_prl_clear_last_sent_ctrl_msg(PORT0); - task_wait_event(10 * MSEC); - - pe_set_flag(PORT0, PE_FLAGS_TX_COMPLETE); - task_wait_event(10 * MSEC); - TEST_EQ(fake_prl_get_last_sent_ctrl_msg(PORT0), PD_CTRL_NOT_SUPPORTED, - "%d"); - /* At this point, the PE should again be running in PE_SRC_Ready. */ - - /* - * Receive an extended, chunked, single-chunk message; expect a Not - * Supported response. - */ - rx_emsg[PORT0].header = PD_HEADER( - PD_DATA_BATTERY_STATUS, PD_ROLE_SINK, PD_ROLE_UFP, 0, - PDO_MAX_OBJECTS, PD_REV30, 1); - *(uint16_t *)rx_emsg[PORT0].buf = - PD_EXT_HEADER(0, 0, PD_MAX_EXTENDED_MSG_CHUNK_LEN); - pe_set_flag(PORT0, PE_FLAGS_MSG_RECEIVED); - fake_prl_clear_last_sent_ctrl_msg(PORT0); - task_wait_event(10 * MSEC); - - pe_set_flag(PORT0, PE_FLAGS_TX_COMPLETE); - task_wait_event(10 * MSEC); - TEST_EQ(fake_prl_get_last_sent_ctrl_msg(PORT0), PD_CTRL_NOT_SUPPORTED, - "%d"); - /* At this point, the PE should again be running in PE_SRC_Ready. */ - - /* - * Receive an extended, chunked, multi-chunk message; expect a Not - * Supported response after tChunkingNotSupported (not earlier). - */ - rx_emsg[PORT0].header = PD_HEADER( - PD_DATA_BATTERY_STATUS, PD_ROLE_SINK, PD_ROLE_UFP, 0, - PDO_MAX_OBJECTS, PD_REV30, 1); - *(uint16_t *)rx_emsg[PORT0].buf = - PD_EXT_HEADER(0, 0, ARRAY_SIZE(rx_emsg[PORT0].buf)); - pe_set_flag(PORT0, PE_FLAGS_MSG_RECEIVED); - fake_prl_clear_last_sent_ctrl_msg(PORT0); - task_wait_event(10 * MSEC); - /* - * The PE should stay in PE_SRC_Chunk_Received for - * tChunkingNotSupported. - */ - task_wait_event(10 * MSEC); - TEST_NE(fake_prl_get_last_sent_ctrl_msg(PORT0), PD_CTRL_NOT_SUPPORTED, - "%d"); - - task_wait_event(PD_T_CHUNKING_NOT_SUPPORTED); - pe_set_flag(PORT0, PE_FLAGS_TX_COMPLETE); - task_wait_event(10 * MSEC); - TEST_EQ(fake_prl_get_last_sent_ctrl_msg(PORT0), PD_CTRL_NOT_SUPPORTED, - "%d"); - /* At this point, the PE should again be running in PE_SRC_Ready. */ - - /* - * TODO(b/160374787): Test responding with Not Supported to control - * messages requesting extended messages as responses. - */ - - return EC_SUCCESS; -} - -test_static int test_extended_message_not_supported_src(void) -{ - setup_source(); - return test_extended_message_not_supported(); -} - -test_static int test_extended_message_not_supported_snk(void) -{ - setup_sink(); - return test_extended_message_not_supported(); -} - -static int test_send_caps_error(void) -{ - /* - * See section 8.3.3.4.1.1 PE_SRC_Send_Soft_Reset State and section - * 8.3.3.2.3 PE_SRC_Send_Capabilities State. - * - * Transition to the PE_SRC_Discovery state when: - * 1) The Protocol Layer indicates that the Message has not been sent - * and we are presently not Connected - */ - fake_prl_clear_last_sent_ctrl_msg(PORT0); - pe_set_flag(PORT0, PE_FLAGS_PROTOCOL_ERROR); - pe_clr_flag(PORT0, PE_FLAGS_PD_CONNECTION); - set_state_pe(PORT0, PE_SRC_SEND_CAPABILITIES); - task_wait_event(10 * MSEC); - TEST_EQ(fake_prl_get_last_sent_ctrl_msg(PORT0), 0, "%d"); - TEST_EQ(get_state_pe(PORT0), PE_SRC_DISCOVERY, "%d"); - - /* - * Send soft reset when: - * 1) The Protocol Layer indicates that the Message has not been sent - * and we are already Connected - */ - fake_prl_clear_last_sent_ctrl_msg(PORT0); - pe_set_flag(PORT0, PE_FLAGS_PROTOCOL_ERROR); - pe_set_flag(PORT0, PE_FLAGS_PD_CONNECTION); - set_state_pe(PORT0, PE_SRC_SEND_CAPABILITIES); - task_wait_event(10 * MSEC); - TEST_EQ(fake_prl_get_last_sent_ctrl_msg(PORT0), - PD_CTRL_SOFT_RESET, "%d"); - TEST_EQ(get_state_pe(PORT0), PE_SEND_SOFT_RESET, "%d"); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_pe_frs); - RUN_TEST(test_snk_give_source_cap); - RUN_TEST(test_vbus_gpio_discharge); -#ifndef CONFIG_USB_PD_EXTENDED_MESSAGES - RUN_TEST(test_extended_message_not_supported_src); - RUN_TEST(test_extended_message_not_supported_snk); -#endif - RUN_TEST(test_send_caps_error); - - /* Do basic state machine validity checks last. */ - RUN_TEST(test_pe_no_parent_cycles); - RUN_TEST(test_pe_no_empty_state); - - test_print_result(); -} diff --git a/test/usb_pe_drp_old_noextended.mocklist b/test/usb_pe_drp_old_noextended.mocklist deleted file mode 100644 index 0582e5cbb3..0000000000 --- a/test/usb_pe_drp_old_noextended.mocklist +++ /dev/null @@ -1,7 +0,0 @@ -/* Copyright 2020 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 CONFIG_TEST_MOCK_LIST \ - MOCK(USB_PRL) diff --git a/test/usb_pe_drp_old_noextended.tasklist b/test/usb_pe_drp_old_noextended.tasklist deleted file mode 100644 index eb41326e3e..0000000000 --- a/test/usb_pe_drp_old_noextended.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TEST_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) diff --git a/test/usb_ppc.c b/test/usb_ppc.c deleted file mode 100644 index 0cf6f69bf3..0000000000 --- a/test/usb_ppc.c +++ /dev/null @@ -1,193 +0,0 @@ -/* Copyright 2019 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. - * - * Test USB PD module. - */ -#include "common.h" -#include "console.h" -#include "crc.h" -#include "task.h" -#include "test_util.h" -#include "timer.h" -#include "usbc_ppc.h" -#include "util.h" - -const struct ppc_drv null_drv = { - .init = NULL, - .is_sourcing_vbus = NULL, - .vbus_sink_enable = NULL, - .vbus_source_enable = NULL, - .set_polarity = NULL, - .set_vbus_source_current_limit = NULL, - .discharge_vbus = NULL, - .set_sbu = NULL, - .set_vconn = NULL, - .is_vbus_present = NULL, - .enter_low_power_mode = NULL, -}; - -struct ppc_config_t ppc_chips[] = { - [0] = { - .drv = &null_drv - }, -}; -unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips); - -const struct tcpc_config_t tcpc_config[] = { - [0] = { - }, -}; - -static int test_ppc_init(void) -{ - int rv; - - rv = ppc_init(1); - TEST_ASSERT(rv == EC_ERROR_INVAL); - rv = ppc_init(0); - TEST_ASSERT(rv == EC_ERROR_UNIMPLEMENTED); - - return EC_SUCCESS; -} - -static int test_ppc_is_sourcing_vbus(void) -{ - int rv; - - rv = ppc_is_sourcing_vbus(1); - TEST_ASSERT(rv == 0); - rv = ppc_is_sourcing_vbus(0); - TEST_ASSERT(rv == 0); - - return EC_SUCCESS; -} - -static int test_ppc_set_polarity(void) -{ - int rv; - - rv = ppc_set_polarity(1, 0); - TEST_ASSERT(rv == EC_ERROR_INVAL); - rv = ppc_set_polarity(0, 0); - TEST_ASSERT(rv == EC_ERROR_UNIMPLEMENTED); - - return EC_SUCCESS; -} - -static int test_ppc_set_vbus_source_current_limit(void) -{ - int rv; - - rv = ppc_set_vbus_source_current_limit(1, 0); - TEST_ASSERT(rv == EC_ERROR_INVAL); - rv = ppc_set_vbus_source_current_limit(0, 0); - TEST_ASSERT(rv == EC_ERROR_UNIMPLEMENTED); - - return EC_SUCCESS; -} - -static int test_ppc_set_sbu(void) -{ - int rv; - - rv = ppc_set_sbu(1, 0); - TEST_ASSERT(rv == EC_ERROR_INVAL); - rv = ppc_set_sbu(0, 0); - TEST_ASSERT(rv == EC_ERROR_UNIMPLEMENTED); - - return EC_SUCCESS; -} - -static int test_ppc_set_vconn(void) -{ - int rv; - - rv = ppc_set_vconn(1, 0); - TEST_ASSERT(rv == EC_ERROR_INVAL); - rv = ppc_set_vconn(0, 0); - TEST_ASSERT(rv == EC_ERROR_UNIMPLEMENTED); - - return EC_SUCCESS; -} - -static int test_ppc_discharge_vbus(void) -{ - int rv; - - rv = ppc_discharge_vbus(1, 0); - TEST_ASSERT(rv == EC_ERROR_INVAL); - rv = ppc_discharge_vbus(0, 0); - TEST_ASSERT(rv == EC_ERROR_UNIMPLEMENTED); - - return EC_SUCCESS; -} - -static int test_ppc_vbus_sink_enable(void) -{ - int rv; - - rv = ppc_vbus_sink_enable(1, 0); - TEST_ASSERT(rv == EC_ERROR_INVAL); - rv = ppc_vbus_sink_enable(0, 0); - TEST_ASSERT(rv == EC_ERROR_UNIMPLEMENTED); - - return EC_SUCCESS; -} - -static int test_ppc_enter_low_power_mode(void) -{ - int rv; - - rv = ppc_enter_low_power_mode(1); - TEST_ASSERT(rv == EC_ERROR_INVAL); - rv = ppc_enter_low_power_mode(0); - TEST_ASSERT(rv == EC_ERROR_UNIMPLEMENTED); - - return EC_SUCCESS; -} - -static int test_ppc_vbus_source_enable(void) -{ - int rv; - - rv = ppc_vbus_source_enable(1, 0); - TEST_ASSERT(rv == EC_ERROR_INVAL); - rv = ppc_vbus_source_enable(0, 0); - TEST_ASSERT(rv == EC_ERROR_UNIMPLEMENTED); - - return EC_SUCCESS; -} - -static int test_ppc_is_vbus_present(void) -{ - int rv; - - rv = ppc_is_vbus_present(1); - TEST_ASSERT(rv == 0); - rv = ppc_is_vbus_present(0); - TEST_ASSERT(rv == 0); - - return EC_SUCCESS; -} - - - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_ppc_init); - RUN_TEST(test_ppc_is_sourcing_vbus); - RUN_TEST(test_ppc_set_polarity); - RUN_TEST(test_ppc_set_vbus_source_current_limit); - RUN_TEST(test_ppc_set_sbu); - RUN_TEST(test_ppc_set_vconn); - RUN_TEST(test_ppc_discharge_vbus); - RUN_TEST(test_ppc_vbus_sink_enable); - RUN_TEST(test_ppc_enter_low_power_mode); - RUN_TEST(test_ppc_vbus_source_enable); - RUN_TEST(test_ppc_is_vbus_present); - - test_print_result(); -} diff --git a/test/usb_ppc.tasklist b/test/usb_ppc.tasklist deleted file mode 100644 index 9fc1a80f4d..0000000000 --- a/test/usb_ppc.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST diff --git a/test/usb_prl.c b/test/usb_prl.c deleted file mode 100644 index 061bb1ad3c..0000000000 --- a/test/usb_prl.c +++ /dev/null @@ -1,170 +0,0 @@ -/* Copyright 2020 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. - * - * Test USB Protocol Layer module. - */ -#include "common.h" -#include "mock/tcpc_mock.h" -#include "mock/tcpm_mock.h" -#include "mock/usb_pe_sm_mock.h" -#include "mock/usb_tc_sm_mock.h" -#include "task.h" -#include "tcpm/tcpci.h" -#include "tcpm/tcpm.h" -#include "test_util.h" -#include "timer.h" -#include "usb_emsg.h" -#include "usb_pd.h" -#include "usb_pd_test_util.h" -#include "usb_pe_sm.h" -#include "usb_prl_sm.h" -#include "usb_sm_checks.h" -#include "usb_tc_sm.h" -#include "util.h" - -#define PORT0 0 - -/* Install Mock TCPC and MUX drivers */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { - { - .drv = &mock_tcpc_driver, - }, -}; - -static void enable_prl(int port, int en) -{ - tcpm_set_rx_enable(port, en); - - mock_tc_port[port].pd_enable = en; - - task_wait_event(10*MSEC); - - prl_set_rev(port, TCPCI_MSG_SOP, mock_tc_port[port].rev); -} - -static int test_receive_control_msg(void) -{ - int port = PORT0; - uint16_t header = PD_HEADER(PD_CTRL_DR_SWAP, - pd_get_power_role(port), - pd_get_data_role(port), - mock_tc_port[port].msg_rx_id, - 0, mock_tc_port[port].rev, 0); - - /* Set up the message to be received. */ - mock_tcpm_rx_msg(port, header, 0, NULL); - - /* Process the message. */ - task_wait_event(10*MSEC); - - /* Check results. */ - TEST_NE(mock_pe_port[port].mock_pe_message_received, 0, "%d"); - TEST_EQ(header, rx_emsg[port].header, "%d"); - TEST_EQ(rx_emsg[port].len, 0, "%d"); - - TEST_LE(mock_pe_port[port].mock_pe_error, 0, "%d"); - TEST_EQ(mock_pe_port[port].mock_pe_message_discarded, 0, "%d"); - TEST_EQ(mock_pe_port[port].mock_got_soft_reset, 0, "%d"); - TEST_EQ(mock_pe_port[port].mock_pe_got_hard_reset, 0, "%d"); - TEST_EQ(mock_pe_port[port].mock_pe_hard_reset_sent, 0, "%d"); - - return EC_SUCCESS; -} - -static int test_send_control_msg(void) -{ - int port = PORT0; - - /* Set up the message to be sent. */ - prl_send_ctrl_msg(port, TCPCI_MSG_SOP, PD_CTRL_ACCEPT); - task_wait_event(MSEC); - /* Simulate the TX complete that the PD_INT handler would signal */ - pd_transmit_complete(port, TCPC_TX_COMPLETE_SUCCESS); - - task_wait_event(10*MSEC); - - /* Check results. */ - TEST_NE(mock_pe_port[port].mock_pe_message_sent, 0, "%d"); - TEST_LE(mock_pe_port[port].mock_pe_error, 0, "%d"); - TEST_EQ(mock_pe_port[port].mock_pe_message_discarded, 0, "%d"); - TEST_EQ(mock_pe_port[port].mock_got_soft_reset, 0, "%d"); - TEST_EQ(mock_pe_port[port].mock_pe_got_hard_reset, 0, "%d"); - TEST_EQ(mock_pe_port[port].mock_pe_hard_reset_sent, 0, "%d"); - - return EC_SUCCESS; -} - -static int test_discard_queued_tx_when_rx_happens(void) -{ - int port = PORT0; - uint16_t header = PD_HEADER(PD_CTRL_DR_SWAP, - pd_get_power_role(port), - pd_get_data_role(port), - mock_tc_port[port].msg_rx_id, - 0, mock_tc_port[port].rev, 0); - uint8_t *buf = tx_emsg[port].buf; - uint8_t len = 8; - uint8_t i = 0; - - /* Set up the message to be sent. */ - for (i = 0 ; i < len ; i++) - buf[i] = (uint8_t)i; - - tx_emsg[port].len = len; - prl_send_data_msg(port, TCPCI_MSG_SOP, PD_DATA_SOURCE_CAP); - - /* Set up the message to be received. */ - mock_tcpm_rx_msg(port, header, 0, NULL); - - /* Process the message. */ - task_wait_event(10*MSEC); - - /* Check results. Source should have discarded its message queued up - * to TX, and should have received the message from the sink. - */ - TEST_NE(mock_pe_port[port].mock_pe_message_discarded, 0, "%d"); - TEST_NE(mock_pe_port[port].mock_pe_message_received, 0, "%d"); - TEST_EQ(mock_pe_port[port].mock_pe_message_sent, 0, "%d"); - - TEST_LE(mock_pe_port[port].mock_pe_error, 0, "%d"); - TEST_EQ(mock_pe_port[port].mock_got_soft_reset, 0, "%d"); - TEST_EQ(mock_pe_port[port].mock_pe_got_hard_reset, 0, "%d"); - TEST_EQ(mock_pe_port[port].mock_pe_hard_reset_sent, 0, "%d"); - - return EC_SUCCESS; -} - -void before_test(void) -{ - mock_tc_port_reset(); - mock_tc_port[PORT0].rev = PD_REV30; - mock_tc_port[PORT0].power_role = PD_ROLE_SOURCE; - mock_tc_port[PORT0].data_role = PD_ROLE_DFP; - - mock_tcpm_reset(); - mock_pe_port_reset(); - - prl_reset_soft(PORT0); - enable_prl(PORT0, 1); -} - -void after_test(void) -{ - enable_prl(PORT0, 0); -} - -void run_test(int argc, char **argv) -{ - RUN_TEST(test_receive_control_msg); - RUN_TEST(test_send_control_msg); - RUN_TEST(test_discard_queued_tx_when_rx_happens); - /* TODO add tests here */ - - - /* Do basic state machine validity checks last. */ - RUN_TEST(test_prl_no_parent_cycles); - RUN_TEST(test_prl_all_states_named); - - test_print_result(); -} diff --git a/test/usb_prl.mocklist b/test/usb_prl.mocklist deleted file mode 100644 index bf5357334a..0000000000 --- a/test/usb_prl.mocklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2019 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 CONFIG_TEST_MOCK_LIST \ - MOCK(TCPC) \ - MOCK(TCPM) \ - MOCK(USB_PE_SM) \ - MOCK(USB_TC_SM) diff --git a/test/usb_prl.tasklist b/test/usb_prl.tasklist deleted file mode 100644 index eb41326e3e..0000000000 --- a/test/usb_prl.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TEST_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) diff --git a/test/usb_prl_noextended.c b/test/usb_prl_noextended.c deleted file mode 120000 index a47c01a13e..0000000000 --- a/test/usb_prl_noextended.c +++ /dev/null @@ -1 +0,0 @@ -usb_prl_old.c
\ No newline at end of file diff --git a/test/usb_prl_noextended.tasklist b/test/usb_prl_noextended.tasklist deleted file mode 120000 index 26ff35c76c..0000000000 --- a/test/usb_prl_noextended.tasklist +++ /dev/null @@ -1 +0,0 @@ -usb_prl_old.tasklist
\ No newline at end of file diff --git a/test/usb_prl_old.c b/test/usb_prl_old.c deleted file mode 100644 index 526015b6c9..0000000000 --- a/test/usb_prl_old.c +++ /dev/null @@ -1,1330 +0,0 @@ -/* Copyright 2019 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. - * - * Test USB Protocol Layer module. - */ -#include "common.h" -#include "crc.h" -#include "task.h" -#include "tcpm/tcpm.h" -#include "test_util.h" -#include "timer.h" -#include "usb_emsg.h" -#include "usb_pd_test_util.h" -#include "usb_pd.h" -#include "usb_pd_tcpm.h" -#include "usb_pe_sm.h" -#include "usb_prl_sm.h" -#include "usb_sm_checks.h" -#include "usb_tc_sm.h" -#include "util.h" - -#define PORT0 0 - -/* - * These enum definitions are declared in usb_prl_sm and are private to that - * file. If those definitions are re-ordered, then we need to update these - * definitions (should be very rare). - */ -enum usb_prl_tx_state { - PRL_TX_PHY_LAYER_RESET, - PRL_TX_WAIT_FOR_MESSAGE_REQUEST, - PRL_TX_LAYER_RESET_FOR_TRANSMIT, - PRL_TX_WAIT_FOR_PHY_RESPONSE, - PRL_TX_SRC_SOURCE_TX, - PRL_TX_SNK_START_AMS, - PRL_TX_SRC_PENDING, - PRL_TX_SNK_PENDING, - PRL_TX_DISCARD_MESSAGE, -}; - -enum usb_prl_hr_state { - PRL_HR_WAIT_FOR_REQUEST, - PRL_HR_RESET_LAYER, - PRL_HR_WAIT_FOR_PHY_HARD_RESET_COMPLETE, - PRL_HR_WAIT_FOR_PE_HARD_RESET_COMPLETE, -}; - -enum usb_rch_state { - RCH_WAIT_FOR_MESSAGE_FROM_PROTOCOL_LAYER, - RCH_PASS_UP_MESSAGE, - RCH_PROCESSING_EXTENDED_MESSAGE, - RCH_REQUESTING_CHUNK, - RCH_WAITING_CHUNK, - RCH_REPORT_ERROR, -}; - -enum usb_tch_state { - TCH_WAIT_FOR_MESSAGE_REQUEST_FROM_PE, - TCH_WAIT_FOR_TRANSMISSION_COMPLETE, - TCH_CONSTRUCT_CHUNKED_MESSAGE, - TCH_SENDING_CHUNKED_MESSAGE, - TCH_WAIT_CHUNK_REQUEST, - TCH_MESSAGE_RECEIVED, - TCH_MESSAGE_SENT, - TCH_REPORT_ERROR, -}; - -/* Defined in implementation */ -enum usb_prl_tx_state prl_tx_get_state(const int port); -enum usb_prl_hr_state prl_hr_get_state(const int port); -enum usb_rch_state rch_get_state(const int port); -enum usb_tch_state tch_get_state(const int port); - -#ifndef CONFIG_USB_PD_EXTENDED_MESSAGES -enum usb_rch_state rch_get_state(const int port) -{ - return RCH_WAIT_FOR_MESSAGE_FROM_PROTOCOL_LAYER; -} -#endif - - -static uint32_t test_data[] = { - 0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f, - 0x10111213, 0x14151617, 0x1819a0b0, 0xc0d0e0f0, - 0x20212223, 0x24252627, 0x28292a2b, 0x2c2d2e2f, - 0x30313233, 0x34353637, 0x38393a3b, 0x3c3d3e3f, - 0x40414243, 0x44454647, 0x48494a4b, 0x4c4d4e4f, - 0x50515253, 0x54555657, 0x58595a5b, 0x5c5d5e5f, - 0x60616263, 0x64656667, 0x68696a6b, 0x6c6d6e6f, - 0x70717273, 0x74757677, 0x78797a7b, 0x7c7d7e7f, - 0x80818283, 0x84858687, 0x88898a8b, 0x8c8d8e8f, - 0x90919293, 0x94959697, 0x98999a9b, 0x9c9d9e9f, - 0xa0a1a2a3, 0xa4a5a6a7, 0xa8a9aaab, 0xacadaeaf, - 0xb0b1b2b3, 0xb4b5b6b7, 0xb8b9babb, 0xbcbdbebf, - 0xc0c1c2c3, 0xc4c5c6c7, 0xc8c9cacb, 0xcccdcecf, - 0xd0d1d2d3, 0xd4d5d6d7, 0xd8d9dadb, 0xdcdddedf, - 0xe0e1e2e3, 0xe4e5e6e7, 0xe8e9eaeb, 0xecedeeef, - 0xf0f1f2f3, 0xf4f5f6f7, 0xf8f9fafb, 0xfcfdfeff, - 0x11223344 -}; - -void pd_set_suspend(int port, int suspend) -{ -} - -void pd_set_error_recovery(int port) -{ -} - -static struct pd_prl { - int rev; - int pd_enable; - enum pd_power_role power_role; - enum pd_data_role data_role; - int msg_tx_id; - int msg_rx_id; - enum tcpci_msg_type sop; - - int mock_pe_message_sent; - int mock_pe_error; - int mock_pe_hard_reset_sent; - int mock_pe_got_hard_reset; - int mock_pe_message_received; - int mock_got_soft_reset; - int mock_message_discard; -} pd_port[CONFIG_USB_PD_PORT_MAX_COUNT]; - -static void init_port(int port, int rev) -{ - pd_port[port].rev = rev; - pd_port[port].pd_enable = 0; - pd_port[port].power_role = PD_ROLE_SINK; - pd_port[port].data_role = PD_ROLE_UFP; - pd_port[port].msg_tx_id = 0; - pd_port[port].msg_rx_id = 0; - - tcpm_init(port); - tcpm_set_polarity(port, 0); - tcpm_set_rx_enable(port, 0); -} - -static inline uint32_t pending_pd_task_events(int port) -{ - return *task_get_event_bitmap(PD_PORT_TO_TASK_ID(port)); -} - -void inc_tx_id(int port) -{ - pd_port[port].msg_tx_id = (pd_port[port].msg_tx_id + 1) & 7; -} - -void inc_rx_id(int port) -{ - pd_port[port].msg_rx_id = (pd_port[port].msg_rx_id + 1) % 7; -} - -static int verify_goodcrc(int port, int role, int id) -{ - return pd_test_tx_msg_verify_sop(port) && - pd_test_tx_msg_verify_short(port, PD_HEADER(PD_CTRL_GOOD_CRC, - role, role, id, 0, 0, 0)) && - pd_test_tx_msg_verify_crc(port) && - pd_test_tx_msg_verify_eop(port); -} - -static void simulate_rx_msg(int port, uint16_t header, int cnt, - const uint32_t *data) -{ - int i; - - pd_test_rx_set_preamble(port, 1); - pd_test_rx_msg_append_sop(port); - pd_test_rx_msg_append_short(port, header); - - crc32_init(); - crc32_hash16(header); - - for (i = 0; i < cnt; ++i) { - pd_test_rx_msg_append_word(port, data[i]); - crc32_hash32(data[i]); - } - - pd_test_rx_msg_append_word(port, crc32_result()); - - pd_test_rx_msg_append_eop(port); - pd_test_rx_msg_append_last_edge(port); - - pd_simulate_rx(port); -} - -static void simulate_goodcrc(int port, int role, int id) -{ - simulate_rx_msg(port, PD_HEADER(PD_CTRL_GOOD_CRC, role, role, id, 0, - pd_port[port].rev, 0), 0, NULL); -} - -static void cycle_through_state_machine(int port, uint32_t num, uint32_t time) -{ - int i; - - for (i = 0; i < num; i++) { - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(time); - } -} - -static int simulate_request_chunk(int port, enum pd_data_msg_type msg_type, - int chunk_num, int len) -{ - uint16_t header = PD_HEADER(msg_type, pd_port[port].power_role, - pd_port[port].data_role, - pd_port[port].msg_rx_id, - 1, pd_port[port].rev, 1); - uint32_t msg = PD_EXT_HEADER(chunk_num, 1, len); - - simulate_rx_msg(port, header, 1, (const uint32_t *)&msg); - task_wait_event(30 * MSEC); - - if (!verify_goodcrc(port, pd_port[port].data_role, - pd_port[port].msg_rx_id)) - return 0; - - return 1; -} - -static int simulate_receive_ctrl_msg(int port, enum pd_ctrl_msg_type msg_type) -{ - uint16_t header = PD_HEADER(msg_type, pd_port[port].power_role, - pd_port[port].data_role, pd_port[port].msg_rx_id, - 0, pd_port[port].rev, 0); - - simulate_rx_msg(port, header, 0, NULL); - task_wait_event(30 * MSEC); - - if (!verify_goodcrc(port, pd_port[port].data_role, - pd_port[port].msg_rx_id)) - return 0; - - return 1; -} - -static int verify_data_reception(int port, uint16_t header, int len) -{ - int i; - int cnt = (len + 3) & ~3; - - cycle_through_state_machine(port, 3, 10 * MSEC); - - if (pd_port[port].mock_pe_error >= 0) - return 0; - - if (!pd_port[port].mock_pe_message_received) - return 0; - - if (rx_emsg[port].header != header) - return 0; - - if (rx_emsg[port].len != cnt) - return 0; - - for (i = 0; i < cnt; i++) { - if (i < len) { - if (rx_emsg[port].buf[i] != - *((unsigned char *)test_data + i)) - return 0; - } else { - if (rx_emsg[port].buf[i] != 0) - return 0; - } - } - - return 1; -} - -static int verify_chunk_data_reception(int port, uint16_t header, int len) -{ - int i; - uint8_t *td = (uint8_t *)test_data; - - if (pd_port[port].mock_got_soft_reset) { - ccprintf("Got mock soft reset\n"); - return 0; - } - - if (!pd_port[port].mock_pe_message_received) { - ccprintf("No mock pe msg received\n"); - return 0; - } - - if (pd_port[port].mock_pe_error >= 0) { - ccprintf("Mock pe error (%d)\n", pd_port[port].mock_pe_error); - return 0; - } - - if (rx_emsg[port].len != len) { - ccprintf("emsg len (%d) != 0\n", rx_emsg[port].len); - return 0; - } - - for (i = 0; i < len; i++) { - if (rx_emsg[port].buf[i] != td[i]) { - ccprintf("emsg buf[%d] != td\n", i); - return 0; - } - } - - return 1; -} - -static int simulate_receive_data(int port, enum pd_data_msg_type msg_type, - int len) -{ - int i; - int nw = (len + 3) >> 2; - uint8_t td[28]; - uint16_t header = PD_HEADER(msg_type, pd_port[port].power_role, - pd_port[port].data_role, pd_port[port].msg_rx_id, - nw, pd_port[port].rev, 0); - - pd_port[port].mock_pe_error = -1; - pd_port[port].mock_pe_message_received = 0; - rx_emsg[port].header = 0; - rx_emsg[port].len = 0; - memset(rx_emsg[port].buf, 0, ARRAY_SIZE(rx_emsg[port].buf)); - - for (i = 0; i < 28; i++) { - if (i < len) - td[i] = *((uint8_t *)test_data + i); - else - td[i] = 0; - } - - simulate_rx_msg(port, header, nw, (uint32_t *)td); - task_wait_event(30 * MSEC); - - if (!verify_goodcrc(port, pd_port[port].data_role, - pd_port[port].msg_rx_id)) - return 0; - - inc_rx_id(port); - - return verify_data_reception(port, header, len); -} - -static int simulate_receive_extended_data(int port, - enum pd_data_msg_type msg_type, int len) -{ - int i; - int j; - int byte_len; - int nw; - int dsize; - uint8_t td[28]; - int chunk_num = 0; - int data_offset = 0; - uint8_t *expected_data = (uint8_t *)test_data; - uint16_t header; - - pd_port[port].mock_pe_error = -1; - pd_port[port].mock_pe_message_received = 0; - rx_emsg[port].header = 0; - rx_emsg[port].len = 0; - memset(rx_emsg[port].buf, 0, ARRAY_SIZE(rx_emsg[port].buf)); - - dsize = len; - for (j = 0; j < 10; j++) { - /* Let state machine settle before starting another round */ - cycle_through_state_machine(port, 10, MSEC); - - byte_len = len; - if (byte_len > PD_MAX_EXTENDED_MSG_CHUNK_LEN) - byte_len = PD_MAX_EXTENDED_MSG_CHUNK_LEN; - - len -= PD_MAX_EXTENDED_MSG_CHUNK_LEN; - - memset(td, 0, 28); - *(uint16_t *)td = PD_EXT_HEADER(chunk_num, 0, dsize); - - for (i = 0; i < byte_len; i++) - td[i + 2] = *(expected_data + data_offset++); - - nw = (byte_len + 2 + 3) >> 2; - header = PD_HEADER(msg_type, pd_port[port].power_role, - pd_port[port].data_role, pd_port[port].msg_rx_id, - nw, pd_port[port].rev, 1); - - if (pd_port[port].mock_pe_error >= 0) { - ccprintf("Mock pe error (%d) iteration (%d)\n", - pd_port[port].mock_pe_error, j); - return 0; - } - - if (IS_ENABLED(CONFIG_USB_PD_EXTENDED_MESSAGES) && - pd_port[port].mock_pe_message_received) { - ccprintf("Mock pe msg received iteration (%d)\n", j); - return 0; - } - - if (rx_emsg[port].len != 0) { - ccprintf("emsg len (%d) != 0 iteration (%d)\n", - rx_emsg[port].len, j); - return 0; - } - - simulate_rx_msg(port, header, nw, (uint32_t *)td); - cycle_through_state_machine(port, 1, MSEC); - - if (!verify_goodcrc(port, pd_port[port].data_role, - pd_port[port].msg_rx_id)) { - ccprintf("Verify goodcrc bad iteration (%d)\n", j); - return 0; - } - - cycle_through_state_machine(port, 1, MSEC); - inc_rx_id(port); - - if (!IS_ENABLED(CONFIG_USB_PD_EXTENDED_MESSAGES)) { - if (pd_port[port].mock_pe_message_received) - return 1; - return 0; - } - - /* - * If no more data, do expected to get a chunk request - */ - if (len <= 0) - break; - - /* - * We need to ensure that the TX event has been set, which may - * require an extra cycle through the state machine - */ - if (!(PD_EVENT_TX & pending_pd_task_events(port))) - cycle_through_state_machine(port, 1, MSEC); - - chunk_num++; - - /* Test Request next chunk packet */ - if (!pd_test_tx_msg_verify_sop(port)) { - ccprintf("Verify sop bad iteration (%d)\n", j); - return 0; - } - - if (!pd_test_tx_msg_verify_short(port, - PD_HEADER(msg_type, - pd_port[port].power_role, - pd_port[port].data_role, - pd_port[port].msg_tx_id, - 1, pd_port[port].rev, 1))) { - ccprintf("Verify msg short bad iteration (%d)\n", j); - return 0; - } - - if (!pd_test_tx_msg_verify_word(port, - PD_EXT_HEADER(chunk_num, 1, 0))) { - ccprintf("Verify msg word bad iteration (%d)\n", j); - return 0; - } - - if (!pd_test_tx_msg_verify_crc(port)) { - ccprintf("Verify msg crc bad iteration (%d)\n", j); - return 0; - } - - if (!pd_test_tx_msg_verify_eop(port)) { - ccprintf("Verify msg eop bad iteration (%d)\n", j); - return 0; - } - - cycle_through_state_machine(port, 1, MSEC); - - /* Request next chunk packet was good. Send GoodCRC */ - simulate_goodcrc(port, pd_port[port].power_role, - pd_port[port].msg_tx_id); - - cycle_through_state_machine(port, 1, MSEC); - - inc_tx_id(port); - } - - cycle_through_state_machine(port, 1, MSEC); - - return verify_chunk_data_reception(port, header, dsize); -} - -static int verify_ctrl_msg_transmission(int port, - enum pd_ctrl_msg_type msg_type) -{ - if (!pd_test_tx_msg_verify_sop(port)) - return 0; - - if (!pd_test_tx_msg_verify_short(port, - PD_HEADER(msg_type, pd_port[port].power_role, - pd_port[port].data_role, pd_port[port].msg_tx_id, 0, - pd_port[port].rev, 0))) - return 0; - - if (!pd_test_tx_msg_verify_crc(port)) - return 0; - - if (!pd_test_tx_msg_verify_eop(port)) - return 0; - - return 1; -} - -static int simulate_send_ctrl_msg_request_from_pe(int port, - enum tcpci_msg_type type, enum pd_ctrl_msg_type msg_type) -{ - pd_port[port].mock_got_soft_reset = 0; - pd_port[port].mock_pe_error = -1; - pd_port[port].mock_pe_message_sent = 0; - prl_send_ctrl_msg(port, type, msg_type); - cycle_through_state_machine(port, 1, MSEC); - - return verify_ctrl_msg_transmission(port, msg_type); -} - -static int verify_data_msg_transmission(int port, - enum pd_data_msg_type msg_type, int len) -{ - int i; - int num_words = (len + 3) >> 2; - int data_obj_in_bytes; - uint32_t td; - - if (!pd_test_tx_msg_verify_sop(port)) - return 0; - - if (!pd_test_tx_msg_verify_short(port, - PD_HEADER(msg_type, pd_port[port].power_role, - pd_port[port].data_role, pd_port[port].msg_tx_id, - num_words, pd_port[port].rev, 0))) - return 0; - - for (i = 0; i < num_words; i++) { - td = test_data[i]; - data_obj_in_bytes = (i + 1) * 4; - if (data_obj_in_bytes > len) { - switch (data_obj_in_bytes - len) { - case 1: - td &= 0x00ffffff; - break; - case 2: - td &= 0x0000ffff; - break; - case 3: - td &= 0x000000ff; - break; - } - } - - if (!pd_test_tx_msg_verify_word(port, td)) - return 0; - } - - if (!pd_test_tx_msg_verify_crc(port)) - return 0; - - if (!pd_test_tx_msg_verify_eop(port)) - return 0; - - return 1; -} - -static int simulate_send_data_msg_request_from_pe(int port, - enum tcpci_msg_type type, enum pd_ctrl_msg_type msg_type, int len) -{ - int i; - uint8_t *buf = tx_emsg[port].buf; - uint8_t *td = (uint8_t *)test_data; - - pd_port[port].mock_got_soft_reset = 0; - pd_port[port].mock_pe_error = -1; - pd_port[port].mock_pe_message_sent = 0; - - for (i = 0; i < len; i++) - buf[i] = td[i]; - - tx_emsg[port].len = len; - - prl_send_data_msg(port, type, msg_type); - cycle_through_state_machine(port, 1, MSEC); - - return verify_data_msg_transmission(port, msg_type, len); -} - -static int verify_extended_data_msg_transmission(int port, - enum pd_data_msg_type msg_type, int len) -{ - int i; - int j; - int nw; - int byte_len; - int dsize; - uint32_t td; - uint8_t *expected_data = (uint8_t *)&test_data; - int data_offset = 0; - int chunk_number_to_send = 0; - - dsize = len; - - for (j = 0; j < 10; j++) { - byte_len = len; - if (byte_len > PD_MAX_EXTENDED_MSG_CHUNK_LEN) - byte_len = PD_MAX_EXTENDED_MSG_CHUNK_LEN; - - nw = (byte_len + 2 + 3) >> 2; - - if (!pd_test_tx_msg_verify_sop(port)) { - ccprintf("failed tx sop; iteration (%d)\n", j); - return 0; - } - - if (!pd_test_tx_msg_verify_short(port, - PD_HEADER(msg_type, pd_port[port].power_role, - pd_port[port].data_role, - pd_port[port].msg_tx_id, - nw, pd_port[port].rev, 1))) { - ccprintf("failed tx short\n"); - return 0; - } - td = PD_EXT_HEADER(chunk_number_to_send, 0, dsize); - td |= *(expected_data + data_offset++) << 16; - td |= *(expected_data + data_offset++) << 24; - - if (byte_len == 1) - td &= 0x00ffffff; - - if (!pd_test_tx_msg_verify_word(port, td)) { - ccprintf("failed tx word\n"); - return 0; - } - - byte_len -= 2; - - if (byte_len > 0) { - nw = (byte_len + 3) >> 2; - for (i = 0; i < nw; i++) { - td = *(expected_data + data_offset++) << 0; - td |= *(expected_data + data_offset++) << 8; - td |= *(expected_data + data_offset++) << 16; - td |= *(expected_data + data_offset++) << 24; - - switch (byte_len) { - case 3: - td &= 0x00ffffff; - break; - case 2: - td &= 0x0000ffff; - break; - case 1: - td &= 0x000000ff; - break; - } - - if (!pd_test_tx_msg_verify_word(port, td)) - return 0; - byte_len -= 4; - } - } - - if (!pd_test_tx_msg_verify_crc(port)) { - ccprintf("failed tx crc\n"); - return 0; - } - - if (!pd_test_tx_msg_verify_eop(port)) { - ccprintf("failed tx eop\n"); - return 0; - } - - cycle_through_state_machine(port, 1, MSEC); - - /* Send GoodCRC */ - simulate_goodcrc(port, pd_port[port].power_role, - pd_port[port].msg_tx_id); - cycle_through_state_machine(port, 1, MSEC); - inc_tx_id(port); - - len -= PD_MAX_EXTENDED_MSG_CHUNK_LEN; - if (len <= 0) - break; - - chunk_number_to_send++; - /* Let state machine settle */ - cycle_through_state_machine(port, 10, MSEC); - if (!simulate_request_chunk(port, msg_type, - chunk_number_to_send, dsize)) { - ccprintf("failed request chunk\n"); - return 0; - } - - cycle_through_state_machine(port, 1, MSEC); - inc_rx_id(port); - } - - return 1; -} - -static int simulate_send_extended_data_msg(int port, - enum tcpci_msg_type type, enum pd_ctrl_msg_type msg_type, - int len) -{ - int i; - uint8_t *buf = tx_emsg[port].buf; - uint8_t *td = (uint8_t *)test_data; - - memset(buf, 0, ARRAY_SIZE(tx_emsg[port].buf)); - tx_emsg[port].len = len; - - /* don't overflow buffer */ - if (len > ARRAY_SIZE(tx_emsg[port].buf)) - len = ARRAY_SIZE(tx_emsg[port].buf); - - for (i = 0; i < len; i++) - buf[i] = td[i]; - - prl_send_ext_data_msg(port, type, msg_type); - cycle_through_state_machine(port, 1, MSEC); - - return verify_extended_data_msg_transmission(port, msg_type, - len); -} - -uint8_t tc_get_pd_enabled(int port) -{ - return pd_port[port].pd_enable; -} - -static void enable_prl(int port, int en) -{ - tcpm_set_rx_enable(port, en); - - pd_port[port].pd_enable = en; - pd_port[port].msg_tx_id = 0; - pd_port[port].msg_rx_id = 0; - - /* Init PRL */ - cycle_through_state_machine(port, 10, MSEC); - - prl_set_rev(port, TCPCI_MSG_SOP, pd_port[port].rev); -} - -enum pd_power_role pd_get_power_role(int port) -{ - return pd_port[port].power_role; -} - -enum pd_data_role pd_get_data_role(int port) -{ - return pd_port[port].data_role; -} - -enum pd_cable_plug tc_get_cable_plug(int port) -{ - return PD_PLUG_FROM_DFP_UFP; -} - -void pe_report_error(int port, enum pe_error e, enum tcpci_msg_type type) -{ - pd_port[port].mock_pe_error = e; - pd_port[port].sop = type; -} - -void pe_report_discard(int port) -{ - pd_port[port].mock_message_discard = 1; -} - -void pe_got_hard_reset(int port) -{ - pd_port[port].mock_pe_got_hard_reset = 1; -} - -void pe_message_received(int port) -{ - pd_port[port].mock_pe_message_received = 1; -} - -void pe_message_sent(int port) -{ - pd_port[port].mock_pe_message_sent = 1; -} - -void pe_hard_reset_sent(int port) -{ - pd_port[port].mock_pe_hard_reset_sent = 1; -} - -void pe_got_soft_reset(int port) -{ - pd_port[port].mock_got_soft_reset = 1; -} - -bool pe_in_frs_mode(int port) -{ - return false; -} - -bool pe_in_local_ams(int port) -{ - /* We will probably want to change this in the future */ - return false; -} - -static int test_prl_reset(void) -{ - int port = PORT0; - - enable_prl(port, 1); - - prl_reset_soft(port); - - TEST_EQ(prl_tx_get_state(port), - PRL_TX_WAIT_FOR_MESSAGE_REQUEST, "%u"); - TEST_EQ(rch_get_state(port), - RCH_WAIT_FOR_MESSAGE_FROM_PROTOCOL_LAYER, "%u"); - TEST_EQ(tch_get_state(port), - TCH_WAIT_FOR_MESSAGE_REQUEST_FROM_PE, "%u"); - TEST_EQ(prl_hr_get_state(port), - PRL_HR_WAIT_FOR_REQUEST, "%u"); - enable_prl(port, 0); - - return EC_SUCCESS; -} - -static int test_send_ctrl_msg(void) -{ - int i; - int port = PORT0; - - enable_prl(port, 1); - - /* - * TEST: Control message transmission and tx_id increment - */ - for (i = 0; i < 10; i++) { - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - - TEST_EQ(prl_tx_get_state(port), - PRL_TX_WAIT_FOR_MESSAGE_REQUEST, "%u"); - - TEST_NE(simulate_send_ctrl_msg_request_from_pe(port, - TCPCI_MSG_SOP, PD_CTRL_ACCEPT), 0, "%d"); - - cycle_through_state_machine(port, 1, MSEC); - - simulate_goodcrc(port, pd_port[port].power_role, - pd_port[port].msg_tx_id); - inc_tx_id(port); - - /* Let statemachine settle */ - cycle_through_state_machine(port, 10, MSEC); - - TEST_EQ(pd_port[port].mock_got_soft_reset, 0, "%d"); - TEST_NE(pd_port[port].mock_pe_message_sent, 0, "%d"); - TEST_LE(pd_port[port].mock_pe_error, 0, "%d"); - } - - enable_prl(port, 0); - - return EC_SUCCESS; -} - -static int test_send_data_msg(void) -{ - int i; - int port = PORT0; - - enable_prl(port, 1); - - /* - * TEST: Sending data message with 1 to 28 bytes - */ - for (i = 1; i <= 28; i++) { - cycle_through_state_machine(port, 1, MSEC); - - TEST_EQ(prl_tx_get_state(port), - PRL_TX_WAIT_FOR_MESSAGE_REQUEST, "%u"); - - TEST_NE(simulate_send_data_msg_request_from_pe(port, - TCPCI_MSG_SOP, PD_DATA_SOURCE_CAP, i), 0, "%d"); - - cycle_through_state_machine(port, 1, MSEC); - - simulate_goodcrc(port, pd_port[port].power_role, - pd_port[port].msg_tx_id); - inc_tx_id(port); - - cycle_through_state_machine(port, 10, MSEC); - - TEST_EQ(pd_port[port].mock_got_soft_reset, 0, "%d"); - TEST_NE(pd_port[port].mock_pe_message_sent, 0, "%d"); - TEST_LE(pd_port[port].mock_pe_error, 0, "%d"); - } - - enable_prl(port, 0); - - return EC_SUCCESS; -} - -static int test_send_data_msg_to_much_data(void) -{ - int port = PORT0; - - enable_prl(port, 1); - - /* - * TEST: Send data message with more than 28-bytes, should fail - */ - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - - TEST_EQ(prl_tx_get_state(port), - PRL_TX_WAIT_FOR_MESSAGE_REQUEST, "%u"); - - /* Try to send 29-bytes */ - TEST_EQ(simulate_send_data_msg_request_from_pe(port, - TCPCI_MSG_SOP, PD_DATA_SOURCE_CAP, 29), 0, "%d"); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - - cycle_through_state_machine(port, 10, MSEC); - - TEST_EQ(pd_port[port].mock_got_soft_reset, 0, "%d"); - TEST_EQ(pd_port[port].mock_pe_message_sent, 0, "%d"); - TEST_EQ(pd_port[port].mock_pe_error, ERR_TCH_XMIT, "%d"); - - enable_prl(port, 0); - - return EC_SUCCESS; -} - -static int test_send_extended_data_msg(void) -{ - int i; - int port = PORT0; - - if (!IS_ENABLED(CONFIG_USB_PD_EXTENDED_MESSAGES)) { - ccprints("CONFIG_USB_PD_EXTENDED_MESSAGES disabled; skipping"); - return EC_SUCCESS; - } - - enable_prl(port, 1); - - /* - * TEST: Sending extended data message with 29 to 260 bytes - */ - - pd_port[port].mock_got_soft_reset = 0; - pd_port[port].mock_pe_error = -1; - - ccprintf("Iteration "); - for (i = 29; i <= PD_MAX_EXTENDED_MSG_LEN; i++) { - ccprintf(".%d", i); - pd_port[port].mock_pe_message_sent = 0; - - cycle_through_state_machine(port, 10, MSEC); - - TEST_EQ(prl_tx_get_state(port), - PRL_TX_WAIT_FOR_MESSAGE_REQUEST, "%d"); - - TEST_NE(simulate_send_extended_data_msg(port, TCPCI_MSG_SOP, - PD_EXT_MANUFACTURER_INFO, i), - 0, "%d"); - - cycle_through_state_machine(port, 10, MSEC); - - TEST_EQ(pd_port[port].mock_got_soft_reset, 0, "%d"); - TEST_NE(pd_port[port].mock_pe_message_sent, 0, "%d"); - TEST_LE(pd_port[port].mock_pe_error, 0, "%d"); - } - enable_prl(port, 0); - - return EC_SUCCESS; -} - -static int test_receive_soft_reset_msg(void) -{ - int port = PORT0; - - enable_prl(port, 1); - - /* - * TEST: Receiving Soft Reset - */ - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - - TEST_EQ(rch_get_state(port), - RCH_WAIT_FOR_MESSAGE_FROM_PROTOCOL_LAYER, "%u"); - - pd_port[port].mock_got_soft_reset = 0; - pd_port[port].mock_pe_error = -1; - pd_port[port].mock_pe_message_received = 0; - - TEST_NE(simulate_receive_ctrl_msg(port, PD_CTRL_SOFT_RESET), 0, "%d"); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - - cycle_through_state_machine(port, 10, MSEC); - - TEST_EQ(pd_port[port].mock_got_soft_reset, 1, "%d"); - TEST_LE(pd_port[port].mock_pe_error, 0, "%d"); - /* - * We don't want to get pe_got_soft_reset and pe_message_received, just - * pe_got_soft_reset. - */ - TEST_EQ(pd_port[port].mock_pe_message_received, 0, "%d"); - - enable_prl(port, 0); - - return EC_SUCCESS; -} - -static int test_receive_control_msg(void) -{ - int port = PORT0; - int expected_header = PD_HEADER(PD_CTRL_DR_SWAP, - pd_port[port].power_role, - pd_port[port].data_role, - pd_port[port].msg_rx_id, - 0, pd_port[port].rev, 0); - - enable_prl(port, 1); - - /* - * TEST: Receiving a control message - */ - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - - TEST_EQ(rch_get_state(port), - RCH_WAIT_FOR_MESSAGE_FROM_PROTOCOL_LAYER, "%u"); - - pd_port[port].mock_got_soft_reset = 0; - pd_port[port].mock_pe_error = -1; - pd_port[port].mock_pe_message_received = 0; - - TEST_NE(simulate_receive_ctrl_msg(port, PD_CTRL_DR_SWAP), 0, "%d"); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - - cycle_through_state_machine(port, 3, 10 * MSEC); - - TEST_EQ(pd_port[port].mock_got_soft_reset, 0, "%d"); - TEST_LE(pd_port[port].mock_pe_error, 0, "%d"); - TEST_NE(pd_port[port].mock_pe_message_received, 0, "%d"); - TEST_EQ(expected_header, rx_emsg[port].header, "%d"); - TEST_EQ(rx_emsg[port].len, 0, "%d"); - - enable_prl(port, 0); - - return EC_SUCCESS; -} - -static int test_receive_data_msg(void) -{ - int port = PORT0; - int i; - - enable_prl(port, 1); - - /* - * TEST: Receiving data message with 1 to 28 bytes - */ - - for (i = 1; i <= 28; i++) { - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - - TEST_EQ(rch_get_state(port), - RCH_WAIT_FOR_MESSAGE_FROM_PROTOCOL_LAYER, "%u"); - TEST_NE(simulate_receive_data(port, - PD_DATA_BATTERY_STATUS, i), 0, "%d"); - } - - enable_prl(port, 0); - - return EC_SUCCESS; -} - -static int test_receive_extended_data_msg(void) -{ - int len; - int port = PORT0; - - enable_prl(port, 1); - - if (IS_ENABLED(CONFIG_USB_PD_EXTENDED_MESSAGES)) { - /* - * TEST: Receiving extended data message with 29 to 260 bytes - */ - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - - TEST_EQ(rch_get_state(port), - RCH_WAIT_FOR_MESSAGE_FROM_PROTOCOL_LAYER, "%u"); - - for (len = 29; len <= PD_MAX_EXTENDED_MSG_LEN; len++) { - TEST_NE(simulate_receive_extended_data(port, - PD_DATA_BATTERY_STATUS, len), 0, "%d"); - } - } else { - /* - * TEST: Receiving unsupported extended data message and then - * subsequently receiving a support non-extended data message. - */ - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - TEST_NE(simulate_receive_extended_data(port, - PD_DATA_BATTERY_STATUS, 29), 0, "%d"); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - TEST_NE(simulate_receive_data(port, - PD_DATA_BATTERY_STATUS, 28), 0, "%d"); - } - - enable_prl(port, 0); - - return EC_SUCCESS; -} - -static int test_send_soft_reset_msg(void) -{ - int port = PORT0; - - enable_prl(port, 1); - - /* - * TEST: Send soft reset - */ - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - - TEST_EQ(prl_tx_get_state(port), - PRL_TX_WAIT_FOR_MESSAGE_REQUEST, "%u"); - - TEST_NE(simulate_send_ctrl_msg_request_from_pe(port, - TCPCI_MSG_SOP, PD_CTRL_SOFT_RESET), 0, "%d"); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - - simulate_goodcrc(port, pd_port[port].power_role, - pd_port[port].msg_tx_id); - inc_tx_id(port); - - TEST_EQ(prl_tx_get_state(port), - PRL_TX_LAYER_RESET_FOR_TRANSMIT, "%u"); - - cycle_through_state_machine(port, 3, 10 * MSEC); - - TEST_EQ(pd_port[port].mock_got_soft_reset, 0, "%d"); - TEST_NE(pd_port[port].mock_pe_message_sent, 0, "%d"); - TEST_LE(pd_port[port].mock_pe_error, 0, "%d"); - - enable_prl(port, 0); - - return EC_SUCCESS; -} - -static int test_pe_execute_hard_reset_msg(void) -{ - int port = PORT0; - - enable_prl(port, 1); - - pd_port[port].mock_pe_hard_reset_sent = 0; - - /* - * TEST: Policy Engine initiated hard reset - */ - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - - TEST_EQ(prl_hr_get_state(port), PRL_HR_WAIT_FOR_REQUEST, "%u"); - - /* Simulate receiving hard reset from policy engine */ - prl_execute_hard_reset(port); - - TEST_EQ(prl_hr_get_state(port), PRL_HR_RESET_LAYER, "%u"); - TEST_EQ(prl_tx_get_state(port), - PRL_TX_WAIT_FOR_MESSAGE_REQUEST, "%u"); - - cycle_through_state_machine(port, 1, 10 * MSEC); - - TEST_EQ(prl_hr_get_state(port), - PRL_HR_WAIT_FOR_PHY_HARD_RESET_COMPLETE, "%u"); - - cycle_through_state_machine(port, 2, PD_T_PS_HARD_RESET); - TEST_NE(pd_port[port].mock_pe_hard_reset_sent, 0, "%d"); - - TEST_EQ(prl_hr_get_state(port), - PRL_HR_WAIT_FOR_PE_HARD_RESET_COMPLETE, "%u"); - - /* Simulate policy engine indicating that it is done hard reset */ - prl_hard_reset_complete(port); - - cycle_through_state_machine(port, 1, 10 * MSEC); - - TEST_EQ(prl_hr_get_state(port), PRL_HR_WAIT_FOR_REQUEST, "%u"); - - enable_prl(port, 0); - - return EC_SUCCESS; -} - -static int test_phy_execute_hard_reset_msg(void) -{ - int port = PORT0; - - enable_prl(port, 1); - - /* - * TEST: Port partner initiated hard reset - */ - - pd_port[port].mock_pe_got_hard_reset = 0; - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - - TEST_EQ(prl_hr_get_state(port), PRL_HR_WAIT_FOR_REQUEST, "%u"); - - /* Simulate receiving hard reset from port partner */ - pd_execute_hard_reset(port); - - TEST_EQ(prl_hr_get_state(port), PRL_HR_RESET_LAYER, "%u"); - TEST_EQ(prl_tx_get_state(port), - PRL_TX_WAIT_FOR_MESSAGE_REQUEST, "%u"); - - cycle_through_state_machine(port, 1, 10 * MSEC); - - TEST_EQ(prl_hr_get_state(port), - PRL_HR_WAIT_FOR_PE_HARD_RESET_COMPLETE, "%u"); - - cycle_through_state_machine(port, 2, PD_T_PS_HARD_RESET); - TEST_NE(pd_port[port].mock_pe_got_hard_reset, 0, "%d"); - - TEST_EQ(prl_hr_get_state(port), - PRL_HR_WAIT_FOR_PE_HARD_RESET_COMPLETE, "%u"); - - /* Simulate policy engine indicating that it is done hard reset */ - prl_hard_reset_complete(port); - - cycle_through_state_machine(port, 1, 10 * MSEC); - - TEST_EQ(prl_hr_get_state(port), PRL_HR_WAIT_FOR_REQUEST, "%u"); - - enable_prl(port, 0); - - return EC_SUCCESS; -} - -/* Reset the state machine between each test */ -void before_test(void) -{ - /* This test relies on explicitly cycling through events manually */ - tc_pause_event_loop(PORT0); - - pd_port[PORT0].mock_pe_message_sent = 0; - pd_port[PORT0].mock_pe_error = -1; - pd_port[PORT0].mock_message_discard = 0; - pd_port[PORT0].mock_pe_hard_reset_sent = 0; - pd_port[PORT0].mock_pe_got_hard_reset = 0; - pd_port[PORT0].mock_pe_message_received = 0; - pd_port[PORT0].mock_got_soft_reset = 0; - pd_port[PORT0].pd_enable = false; - cycle_through_state_machine(PORT0, 10, MSEC); - pd_port[PORT0].pd_enable = true; - cycle_through_state_machine(PORT0, 10, MSEC); -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - /* Test PD 2.0 Protocol */ - init_port(PORT0, PD_REV20); - RUN_TEST(test_prl_reset); - RUN_TEST(test_send_ctrl_msg); - RUN_TEST(test_send_data_msg); - RUN_TEST(test_send_data_msg_to_much_data); - RUN_TEST(test_receive_control_msg); - RUN_TEST(test_receive_data_msg); - RUN_TEST(test_receive_soft_reset_msg); - RUN_TEST(test_send_soft_reset_msg); - RUN_TEST(test_pe_execute_hard_reset_msg); - RUN_TEST(test_phy_execute_hard_reset_msg); - - /* TODO(shurst): More PD 2.0 Tests */ - - ccprints("Starting PD 3.0 tests"); - - /* Test PD 3.0 Protocol */ - init_port(PORT0, PD_REV30); - RUN_TEST(test_prl_reset); - RUN_TEST(test_send_ctrl_msg); - RUN_TEST(test_send_data_msg); - RUN_TEST(test_send_data_msg_to_much_data); - RUN_TEST(test_send_extended_data_msg); - RUN_TEST(test_receive_control_msg); - RUN_TEST(test_receive_data_msg); - RUN_TEST(test_receive_extended_data_msg); - RUN_TEST(test_receive_soft_reset_msg); - RUN_TEST(test_send_soft_reset_msg); - RUN_TEST(test_pe_execute_hard_reset_msg); - RUN_TEST(test_phy_execute_hard_reset_msg); - - /* TODO(shurst): More PD 3.0 Tests */ - - /* Do basic state machine validity checks last. */ - RUN_TEST(test_prl_no_parent_cycles); - RUN_TEST(test_prl_all_states_named); - - test_print_result(); -} diff --git a/test/usb_prl_old.tasklist b/test/usb_prl_old.tasklist deleted file mode 100644 index eb41326e3e..0000000000 --- a/test/usb_prl_old.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TEST_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) diff --git a/test/usb_sm_checks.c b/test/usb_sm_checks.c deleted file mode 100644 index 03e5aa23c2..0000000000 --- a/test/usb_sm_checks.c +++ /dev/null @@ -1,190 +0,0 @@ -/* Copyright 2019 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. - * - * Test USB Type-C VPD and CTVPD module. - */ -#include "common.h" -#include "task.h" -#include "test_util.h" -#include "timer.h" -#include "usb_pd.h" -#include "usb_sm.h" -#include "usb_tc_sm.h" -#include "util.h" -#include "usb_pd_test_util.h" -#include "vpd_api.h" - -#ifdef CONFIG_USB_TYPEC_SM -extern const struct test_sm_data test_tc_sm_data[]; -extern const int test_tc_sm_data_size; -#else -const struct test_sm_data test_tc_sm_data[] = {}; -const int test_tc_sm_data_size; -#endif - -#ifdef CONFIG_USB_PRL_SM -extern const struct test_sm_data test_prl_sm_data[]; -extern const int test_prl_sm_data_size; -#else -const struct test_sm_data test_prl_sm_data[] = {}; -const int test_prl_sm_data_size; -#endif - -#ifdef CONFIG_USB_PE_SM -extern const struct test_sm_data test_pe_sm_data[]; -extern const int test_pe_sm_data_size; -#else -const struct test_sm_data test_pe_sm_data[] = {}; -const int test_pe_sm_data_size; -#endif - -test_static int test_no_parent_cycles(const struct test_sm_data * const sm_data) -{ - int i; - - for (i = 0; i < sm_data->size; ++i) { - int depth = 0; - usb_state_ptr current = &sm_data->base[i]; - - while (current != NULL && ++depth <= sm_data->size) - current = current->parent; - - if (depth > sm_data->size) - break; - } - - /* Ensure all states end, otherwise the ith state has a cycle. */ - TEST_EQ(i, sm_data->size, "%d"); - - return EC_SUCCESS; -} - -int test_tc_no_parent_cycles(void) -{ - int i; - - for (i = 0; i < test_tc_sm_data_size; ++i) { - const int rv = test_no_parent_cycles(&test_tc_sm_data[i]); - - if (rv) { - ccprintf("TC State machine %d has a cycle!\n", i); - TEST_ASSERT(0); - } - } - - return EC_SUCCESS; -} - -int test_prl_no_parent_cycles(void) -{ - int i; - - for (i = 0; i < test_prl_sm_data_size; ++i) { - const int rv = test_no_parent_cycles(&test_prl_sm_data[i]); - - if (rv) { - ccprintf("PRL State machine %d has a cycle!\n", i); - TEST_ASSERT(0); - } - } - - return EC_SUCCESS; -} - -int test_pe_no_parent_cycles(void) -{ - int i; - - for (i = 0; i < test_pe_sm_data_size; ++i) { - const int rv = test_no_parent_cycles(&test_pe_sm_data[i]); - - if (rv) { - ccprintf("PE State machine %d has a cycle!\n", i); - TEST_ASSERT(0); - } - } - - return EC_SUCCESS; -} - -static volatile int state_printed; - -/* Override the implement version of print */ -__override void print_current_state(const int port) -{ - state_printed = 1; -} - -static int test_all_states_named(const struct test_sm_data * const sm_data) -{ - int i; - - for (i = 0; i < sm_data->size; ++i) { - usb_state_ptr current = &sm_data->base[i]; - - state_printed = 0; - - if (current->entry) - current->entry(0); - - if (state_printed) { - if (i >= sm_data->names_size || - sm_data->names[i] == NULL) { - ccprintf("State %d does not have a name!\n", i); - TEST_ASSERT(0); - } - } - } - - return EC_SUCCESS; -} - -int test_tc_all_states_named(void) -{ - int i; - - for (i = 0; i < test_tc_sm_data_size; ++i) { - const int rv = test_all_states_named(&test_tc_sm_data[i]); - - if (rv) { - ccprintf("TC State machine %d has empty name!\n", i); - TEST_ASSERT(0); - } - } - - return EC_SUCCESS; -} - -int test_prl_all_states_named(void) -{ - int i; - - for (i = 0; i < test_prl_sm_data_size; ++i) { - const int rv = test_all_states_named(&test_prl_sm_data[i]); - - if (rv) { - ccprintf("PRL State machine %d has empty name!\n", i); - TEST_ASSERT(0); - } - } - - return EC_SUCCESS; -} - -int test_pe_all_states_named(void) -{ - int i; - - for (i = 0; i < test_pe_sm_data_size; ++i) { - const int rv = test_all_states_named(&test_pe_sm_data[i]); - - if (rv) { - ccprintf("PE State machine %d has empty name!\n", i); - TEST_ASSERT(0); - } - } - - return EC_SUCCESS; -} - diff --git a/test/usb_sm_checks.h b/test/usb_sm_checks.h deleted file mode 100644 index 92529ac385..0000000000 --- a/test/usb_sm_checks.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright 2019 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. - */ - -/* Validity tests for a state machine definition */ - -#ifndef __CROS_EC_USB_SM_CHECKS_H -#define __CROS_EC_USB_SM_CHECKS_H - -int test_tc_no_parent_cycles(void); -int test_tc_all_states_named(void); - - -int test_prl_no_parent_cycles(void); -int test_prl_all_states_named(void); - - -int test_pe_no_parent_cycles(void); -int test_pe_all_states_named(void); - -#endif /* __CROS_EC_USB_SM_CHECKS_H */
\ No newline at end of file diff --git a/test/usb_sm_framework_h0.tasklist b/test/usb_sm_framework_h0.tasklist deleted file mode 120000 index b55922b1ee..0000000000 --- a/test/usb_sm_framework_h0.tasklist +++ /dev/null @@ -1 +0,0 @@ -usb_sm_framework_h3.tasklist
\ No newline at end of file diff --git a/test/usb_sm_framework_h1.tasklist b/test/usb_sm_framework_h1.tasklist deleted file mode 120000 index b55922b1ee..0000000000 --- a/test/usb_sm_framework_h1.tasklist +++ /dev/null @@ -1 +0,0 @@ -usb_sm_framework_h3.tasklist
\ No newline at end of file diff --git a/test/usb_sm_framework_h2.tasklist b/test/usb_sm_framework_h2.tasklist deleted file mode 120000 index b55922b1ee..0000000000 --- a/test/usb_sm_framework_h2.tasklist +++ /dev/null @@ -1 +0,0 @@ -usb_sm_framework_h3.tasklist
\ No newline at end of file diff --git a/test/usb_sm_framework_h3.c b/test/usb_sm_framework_h3.c deleted file mode 100644 index ba544a749a..0000000000 --- a/test/usb_sm_framework_h3.c +++ /dev/null @@ -1,1002 +0,0 @@ -/* Copyright 2019 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. - * - * Test USB Type-C VPD and CTVPD module. - */ -#include "common.h" -#include "task.h" -#include "test_util.h" -#include "timer.h" -#include "usb_pd.h" -#include "usb_sm.h" -#include "usb_tc_sm.h" -#include "util.h" -#include "usb_pd_test_util.h" -#include "vpd_api.h" - -/* - * Test State Hierarchy - * SM_TEST_A4 transitions to SM_TEST_B4 - * SM_TEST_B4 transitions to SM_TEST_B5 - * SM_TEST_B5 transitions to SM_TEST_B6 - * SM_TEST_B6 transitions to SM_TEST_C - * SM_TEST_C transitions to SM_TEST_A7 - * SM_TEST_A7 transitions to SM_TEST_A6 - * SM_TEST_A6 transitions to SM_TEST_A5 - * SM_TEST_A5 transitions to SM_TEST_A4 - * - * --------------------------- --------------------------- - * | SM_TEST_SUPER_A1 | | SM_TEST_SUPER_B1 | - * | ----------------------- | | ----------------------- | - * | | SM_TEST_SUPER_A2 | | | | SM_TEST_SUPER_B2 | | - * | | ------------------- | | | | ------------------- | | - * | | |SM_TEST_SUPER_A3 | | | | | |SM_TEST_SUPER_B3 | | | - * | | | | | | | | | | | | - * | | | ------------- | | | | | | ------------- | | | - * | | | | SM_TEST_A4|------------------>| SM_TEST_B4| | | | - * | | | ------------- | | | | | | ------------- | | | - * | | | ^ | | | | | |--------|--------| | | - * | | | | | | | | | | | | - * | | | -------------- | | | | | \/ | | - * | | | | SM_TEST_A5 | | | | | | -------------- | | - * | | | -------------- | | | | | | SM_TEST_B5 | | | - * | | |--------^--------| | | | | -------------- | | - * | | | | | | | | | | - * | | -------------- | | | -----------|----------- | - * | | | SM_TEST_A6 | | | | \/ | - * | | -------------- | | | -------------- | - * | |----------^----------| | | | SM_TEST_B6 | | - * | | | | -------------- | - * | -------------- | |--------/----------------| - * | | SM_TEST_A7 | | / - * | -------------- | / - * |------------------^------| / - * \ / - * \ \/ - * ------------- - * | SM_TEST_C | - * ------------- - * - * test_hierarchy_0: Tests a flat state machine without super states - * test_hierarchy_1: Tests a hierarchical state machine with 1 super state - * test_hierarchy_2: Tests a hierarchical state machine with 2 super states - * test_hierarchy_3: Tests a hierarchical state machine with 3 super states - * - */ - -#define SEQUENCE_SIZE 55 - -enum state_id { - ENTER_A1 = 1, - RUN_A1, - EXIT_A1, - ENTER_A2, - RUN_A2, - EXIT_A2, - ENTER_A3, - RUN_A3, - EXIT_A3, - ENTER_A4, - RUN_A4, - EXIT_A4, - ENTER_A5, - RUN_A5, - EXIT_A5, - ENTER_A6, - RUN_A6, - EXIT_A6, - ENTER_A7, - RUN_A7, - EXIT_A7, - ENTER_B1, - RUN_B1, - EXIT_B1, - ENTER_B2, - RUN_B2, - EXIT_B2, - ENTER_B3, - RUN_B3, - EXIT_B3, - ENTER_B4, - RUN_B4, - EXIT_B4, - ENTER_B5, - RUN_B5, - EXIT_B5, - ENTER_B6, - RUN_B6, - EXIT_B6, - ENTER_C, - RUN_C, - EXIT_C, -}; - -#define PORT0 0 - -struct sm_ { - /* struct sm_obj must be first */ - struct sm_ctx ctx; - int sv_tmp; - int idx; - int seq[SEQUENCE_SIZE]; -} sm[1]; - -enum state { - SM_TEST_SUPER_A1, - SM_TEST_SUPER_A2, - SM_TEST_SUPER_A3, - SM_TEST_SUPER_B1, - SM_TEST_SUPER_B2, - SM_TEST_SUPER_B3, - SM_TEST_A4, - SM_TEST_A5, - SM_TEST_A6, - SM_TEST_A7, - SM_TEST_B4, - SM_TEST_B5, - SM_TEST_B6, - SM_TEST_C, -}; -static const struct usb_state states[]; - -static struct control { - usb_state_ptr a3_entry_to; - usb_state_ptr b3_run_to; - usb_state_ptr b6_entry_to; - usb_state_ptr c_entry_to; - usb_state_ptr c_exit_to; -} test_control; - -static void set_state_sm(const int port, const enum state new_state) -{ - set_state(port, &sm[port].ctx, &states[new_state]); -} - -static void sm_test_super_A1_entry(const int port) -{ - sm[port].seq[sm[port].idx++] = ENTER_A1; -} - -static void sm_test_super_A1_run(const int port) -{ - sm[port].seq[sm[port].idx++] = RUN_A1; -} - -static void sm_test_super_A1_exit(const int port) -{ - sm[port].seq[sm[port].idx++] = EXIT_A1; -} - -static void sm_test_super_B1_entry(const int port) -{ - sm[port].seq[sm[port].idx++] = ENTER_B1; -} - -static void sm_test_super_B1_run(const int port) -{ - sm[port].seq[sm[port].idx++] = RUN_B1; -} - -static void sm_test_super_B1_exit(const int port) -{ - sm[port].seq[sm[port].idx++] = EXIT_B1; -} - -static void sm_test_super_A2_entry(const int port) -{ - sm[port].seq[sm[port].idx++] = ENTER_A2; -} - -static void sm_test_super_A2_run(const int port) -{ - sm[port].seq[sm[port].idx++] = RUN_A2; -} - -static void sm_test_super_A2_exit(const int port) -{ - sm[port].seq[sm[port].idx++] = EXIT_A2; -} - - -static void sm_test_super_B2_entry(const int port) -{ - sm[port].seq[sm[port].idx++] = ENTER_B2; -} - -static void sm_test_super_B2_run(const int port) -{ - sm[port].seq[sm[port].idx++] = RUN_B2; -} - -static void sm_test_super_B2_exit(const int port) -{ - sm[port].seq[sm[port].idx++] = EXIT_B2; -} - -static void sm_test_super_A3_entry(const int port) -{ - sm[port].seq[sm[port].idx++] = ENTER_A3; - if (test_control.a3_entry_to) - set_state(port, &sm[port].ctx, test_control.a3_entry_to); -} - -static void sm_test_super_A3_run(const int port) -{ - sm[port].seq[sm[port].idx++] = RUN_A3; -} - -static void sm_test_super_A3_exit(const int port) -{ - sm[port].seq[sm[port].idx++] = EXIT_A3; -} - -static void sm_test_super_B3_entry(const int port) -{ - sm[port].seq[sm[port].idx++] = ENTER_B3; -} - -static void sm_test_super_B3_run(const int port) -{ - sm[port].seq[sm[port].idx++] = RUN_B3; - if (test_control.b3_run_to) - set_state(port, &sm[port].ctx, test_control.b3_run_to); -} - -static void sm_test_super_B3_exit(const int port) -{ - sm[port].seq[sm[port].idx++] = EXIT_B3; -} - -static void sm_test_A4_entry(const int port) -{ - sm[port].sv_tmp = 0; - sm[port].seq[sm[port].idx++] = ENTER_A4; -} - -static void sm_test_A4_run(const int port) -{ - if (sm[port].sv_tmp == 0) { - sm[port].sv_tmp = 1; - sm[port].seq[sm[port].idx++] = RUN_A4; - } else { - set_state_sm(port, SM_TEST_B4); - } -} - -static void sm_test_A4_exit(const int port) -{ - sm[port].seq[sm[port].idx++] = EXIT_A4; -} - - -static void sm_test_A5_entry(const int port) -{ - sm[port].sv_tmp = 0; - sm[port].seq[sm[port].idx++] = ENTER_A5; -} - -static void sm_test_A5_run(const int port) -{ - if (sm[port].sv_tmp == 0) { - sm[port].sv_tmp = 1; - sm[port].seq[sm[port].idx++] = RUN_A5; - } else { - set_state_sm(port, SM_TEST_A4); - } -} - -static void sm_test_A5_exit(const int port) -{ - sm[port].seq[sm[port].idx++] = EXIT_A5; -} - - -static void sm_test_A6_entry(const int port) -{ - sm[port].sv_tmp = 0; - sm[port].seq[sm[port].idx++] = ENTER_A6; -} - -static void sm_test_A6_run(const int port) -{ - if (sm[port].sv_tmp == 0) { - sm[port].sv_tmp = 1; - sm[port].seq[sm[port].idx++] = RUN_A6; - } else { - set_state_sm(port, SM_TEST_A5); - } -} - -static void sm_test_A6_exit(const int port) -{ - sm[port].seq[sm[port].idx++] = EXIT_A6; -} - -static void sm_test_A7_entry(const int port) -{ - sm[port].sv_tmp = 0; - sm[port].seq[sm[port].idx++] = ENTER_A7; -} - -static void sm_test_A7_run(const int port) -{ - if (sm[port].sv_tmp == 0) { - sm[port].sv_tmp = 1; - sm[port].seq[sm[port].idx++] = RUN_A7; - } else { - set_state_sm(port, SM_TEST_A6); - } -} - -static void sm_test_A7_exit(const int port) -{ - sm[port].seq[sm[port].idx++] = EXIT_A7; -} - -static void sm_test_B4_entry(const int port) -{ - sm[port].sv_tmp = 0; - sm[port].seq[sm[port].idx++] = ENTER_B4; -} - -static void sm_test_B4_run(const int port) -{ - if (sm[port].sv_tmp == 0) { - sm[port].seq[sm[port].idx++] = RUN_B4; - sm[port].sv_tmp = 1; - } else { - set_state_sm(port, SM_TEST_B5); - } -} - -static void sm_test_B4_exit(const int port) -{ - sm[port].seq[sm[port].idx++] = EXIT_B4; -} - - -static void sm_test_B5_entry(const int port) -{ - sm[port].sv_tmp = 0; - sm[port].seq[sm[port].idx++] = ENTER_B5; -} - -static void sm_test_B5_run(const int port) -{ - if (sm[port].sv_tmp == 0) { - sm[port].sv_tmp = 1; - sm[port].seq[sm[port].idx++] = RUN_B5; - } else { - set_state_sm(port, SM_TEST_B6); - } -} - -static void sm_test_B5_exit(const int port) -{ - sm[port].seq[sm[port].idx++] = EXIT_B5; -} - - -static void sm_test_B6_entry(const int port) -{ - sm[port].sv_tmp = 0; - sm[port].seq[sm[port].idx++] = ENTER_B6; - if (test_control.b6_entry_to) - set_state(port, &sm[port].ctx, test_control.b6_entry_to); -} - -static void sm_test_B6_run(const int port) -{ - if (sm[port].sv_tmp == 0) { - sm[port].sv_tmp = 1; - sm[port].seq[sm[port].idx++] = RUN_B6; - } else { - set_state_sm(port, SM_TEST_C); - } -} - -static void sm_test_B6_exit(const int port) -{ - sm[port].seq[sm[port].idx++] = EXIT_B6; -} - -static void sm_test_C_entry(const int port) -{ - sm[port].sv_tmp = 0; - sm[port].seq[sm[port].idx++] = ENTER_C; - if (test_control.c_entry_to) - set_state(port, &sm[port].ctx, test_control.c_entry_to); -} - -static void sm_test_C_run(const int port) -{ - if (sm[port].sv_tmp == 0) { - sm[port].seq[sm[port].idx++] = RUN_C; - sm[port].sv_tmp = 1; - } else { - set_state_sm(port, SM_TEST_A7); - } -} - -static void sm_test_C_exit(const int port) -{ - sm[port].seq[sm[port].idx++] = EXIT_C; - if (test_control.c_exit_to) - set_state(port, &sm[port].ctx, test_control.c_exit_to); -} - -static void run_sm(void) -{ - task_wake(TASK_ID_TEST); - task_wait_event(5 * MSEC); -} - -test_static int test_hierarchy_0(void) -{ - int port = PORT0; - int i = 0; - - set_state_sm(port, SM_TEST_A4); - - run_sm(); - TEST_EQ(sm[port].seq[i], ENTER_A4, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_A4, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_A4, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B4, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_B4, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_B4, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B5, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_B5, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_B5, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B6, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_B6, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_B6, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_C, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_C, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_C, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A7, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_A7, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_A7, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A6, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_A6, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_A6, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A5, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_A5, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_A5, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A4, "%d"); ++i; - - for (; i < SEQUENCE_SIZE; i++) - TEST_EQ(sm[port].seq[i], 0, "%d"); - - return EC_SUCCESS; -} - -test_static int test_hierarchy_1(void) -{ - int port = PORT0; - int i = 0; - - set_state_sm(port, SM_TEST_A4); - - run_sm(); - TEST_EQ(sm[port].seq[i], ENTER_A3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A4, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_A4, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_A3, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_A4, "%d"); ++i; - TEST_EQ(sm[port].seq[i], EXIT_A3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B4, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_B4, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_B3, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_B4, "%d"); ++i; - TEST_EQ(sm[port].seq[i], EXIT_B3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B5, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_B5, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_B5, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B6, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_B6, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_B6, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_C, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_C, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_C, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A7, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_A7, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_A7, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A6, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_A6, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_A6, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A5, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_A5, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_A3, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_A5, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A4, "%d"); ++i; - - for (i = 33; i < SEQUENCE_SIZE; i++) - TEST_EQ(sm[port].seq[i], 0, "%d"); - - return EC_SUCCESS; -} - -test_static int test_hierarchy_2(void) -{ - - int port = PORT0; - int i = 0; - - set_state_sm(port, SM_TEST_A4); - - run_sm(); - TEST_EQ(sm[port].seq[i], ENTER_A2, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A4, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_A4, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_A3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_A2, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_A4, "%d"); ++i; - TEST_EQ(sm[port].seq[i], EXIT_A3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], EXIT_A2, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B2, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B4, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_B4, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_B3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_B2, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_B4, "%d"); ++i; - TEST_EQ(sm[port].seq[i], EXIT_B3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B5, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_B5, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_B2, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_B5, "%d"); ++i; - TEST_EQ(sm[port].seq[i], EXIT_B2, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B6, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_B6, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_B6, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_C, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_C, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_C, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A7, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_A7, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_A7, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A2, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A6, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_A6, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_A2, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_A6, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A5, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_A5, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_A3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_A2, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_A5, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A4, "%d"); ++i; - - for (; i < SEQUENCE_SIZE; i++) - TEST_EQ(sm[port].seq[i], 0, "%d"); - - return EC_SUCCESS; -} - -test_static int test_hierarchy_3(void) -{ - - int port = PORT0; - int i = 0; - - set_state_sm(port, SM_TEST_A4); - - run_sm(); - TEST_EQ(sm[port].seq[i], ENTER_A1, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A2, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A4, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_A4, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_A3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_A2, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_A1, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_A4, "%d"); ++i; - TEST_EQ(sm[port].seq[i], EXIT_A3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], EXIT_A2, "%d"); ++i; - TEST_EQ(sm[port].seq[i], EXIT_A1, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B1, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B2, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B4, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_B4, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_B3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_B2, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_B1, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_B4, "%d"); ++i; - TEST_EQ(sm[port].seq[i], EXIT_B3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B5, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_B5, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_B2, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_B1, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_B5, "%d"); ++i; - TEST_EQ(sm[port].seq[i], EXIT_B2, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B6, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_B6, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_B1, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_B6, "%d"); ++i; - TEST_EQ(sm[port].seq[i], EXIT_B1, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_C, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_C, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_C, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A1, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A7, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_A7, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_A1, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_A7, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A2, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A6, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_A6, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_A2, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_A1, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_A6, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A5, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_A5, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_A3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_A2, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_A1, "%d"); ++i; - - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_A5, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A4, "%d"); ++i; - - for (; i < SEQUENCE_SIZE; i++) - TEST_EQ(sm[port].seq[i], 0, "%d"); - - return EC_SUCCESS; -} - -test_static int test_set_state_from_parents(void) -{ - int port = PORT0; - int i = 0; - - /* Start state machine */ - test_control.a3_entry_to = &states[SM_TEST_B4]; - run_sm(); - set_state_sm(port, SM_TEST_A4); - TEST_EQ(sm[port].seq[i], ENTER_A1, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A2, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A3, "%d"); ++i; - /* Does not enter or exit A4 */ - TEST_EQ(sm[port].seq[i], EXIT_A3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], EXIT_A2, "%d"); ++i; - TEST_EQ(sm[port].seq[i], EXIT_A1, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B1, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B2, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B4, "%d"); ++i; - /* Ensure we didn't go further than above statements */ - TEST_EQ(sm[port].seq[i], 0, "%d"); - - test_control.b3_run_to = &states[SM_TEST_B5]; - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_B4, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_B3, "%d"); ++i; - /* Does not run b2 or b1 */ - TEST_EQ(sm[port].seq[i], EXIT_B4, "%d"); ++i; - TEST_EQ(sm[port].seq[i], EXIT_B3, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B5, "%d"); ++i; - /* Ensure we didn't go further than above statements */ - TEST_EQ(sm[port].seq[i], 0, "%d"); - - run_sm(); - TEST_EQ(sm[port].seq[i], RUN_B5, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_B2, "%d"); ++i; - TEST_EQ(sm[port].seq[i], RUN_B1, "%d"); ++i; - /* Ensure we didn't go further than above statements */ - TEST_EQ(sm[port].seq[i], 0, "%d"); - - /* - * Ensure that multiple chains of parent entry works. Also ensure - * that set states in exit are ignored. - */ - test_control.b6_entry_to = &states[SM_TEST_C]; - test_control.c_entry_to = &states[SM_TEST_A7]; - test_control.c_exit_to = &states[SM_TEST_A4]; - run_sm(); - TEST_EQ(sm[port].seq[i], EXIT_B5, "%d"); ++i; - TEST_EQ(sm[port].seq[i], EXIT_B2, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_B6, "%d"); ++i; - TEST_EQ(sm[port].seq[i], EXIT_B6, "%d"); ++i; - TEST_EQ(sm[port].seq[i], EXIT_B1, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_C, "%d"); ++i; - TEST_EQ(sm[port].seq[i], EXIT_C, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A1, "%d"); ++i; - TEST_EQ(sm[port].seq[i], ENTER_A7, "%d"); ++i; - /* Ensure we didn't go further than above statements */ - TEST_EQ(sm[port].seq[i], 0, "%d"); - - for (; i < SEQUENCE_SIZE; i++) - TEST_EQ(sm[port].seq[i], 0, "%d"); - - return EC_SUCCESS; -} - -#ifdef TEST_USB_SM_FRAMEWORK_H3 -#define TEST_AT_LEAST_3 -#endif - -#if defined(TEST_AT_LEAST_3) || defined(TEST_USB_SM_FRAMEWORK_H2) -#define TEST_AT_LEAST_2 -#endif - -#if defined(TEST_AT_LEAST_2) || defined(TEST_USB_SM_FRAMEWORK_H1) -#define TEST_AT_LEAST_1 -#endif - -static const struct usb_state states[] = { - [SM_TEST_SUPER_A1] = { - .entry = sm_test_super_A1_entry, - .run = sm_test_super_A1_run, - .exit = sm_test_super_A1_exit, - }, - [SM_TEST_SUPER_A2] = { - .entry = sm_test_super_A2_entry, - .run = sm_test_super_A2_run, - .exit = sm_test_super_A2_exit, -#ifdef TEST_AT_LEAST_3 - .parent = &states[SM_TEST_SUPER_A1], -#endif - }, - [SM_TEST_SUPER_A3] = { - .entry = sm_test_super_A3_entry, - .run = sm_test_super_A3_run, - .exit = sm_test_super_A3_exit, -#ifdef TEST_AT_LEAST_2 - .parent = &states[SM_TEST_SUPER_A2], -#endif - }, - [SM_TEST_SUPER_B1] = { - .entry = sm_test_super_B1_entry, - .run = sm_test_super_B1_run, - .exit = sm_test_super_B1_exit, - }, - [SM_TEST_SUPER_B2] = { - .entry = sm_test_super_B2_entry, - .run = sm_test_super_B2_run, - .exit = sm_test_super_B2_exit, -#ifdef TEST_AT_LEAST_3 - .parent = &states[SM_TEST_SUPER_B1], -#endif - }, - [SM_TEST_SUPER_B3] = { - .entry = sm_test_super_B3_entry, - .run = sm_test_super_B3_run, - .exit = sm_test_super_B3_exit, -#ifdef TEST_AT_LEAST_2 - .parent = &states[SM_TEST_SUPER_B2], -#endif - }, - [SM_TEST_A4] = { - .entry = sm_test_A4_entry, - .run = sm_test_A4_run, - .exit = sm_test_A4_exit, -#ifdef TEST_AT_LEAST_1 - .parent = &states[SM_TEST_SUPER_A3], -#endif - }, - [SM_TEST_A5] = { - .entry = sm_test_A5_entry, - .run = sm_test_A5_run, - .exit = sm_test_A5_exit, -#ifdef TEST_AT_LEAST_1 - .parent = &states[SM_TEST_SUPER_A3], -#endif - }, - [SM_TEST_A6] = { - .entry = sm_test_A6_entry, - .run = sm_test_A6_run, - .exit = sm_test_A6_exit, -#ifdef TEST_AT_LEAST_2 - .parent = &states[SM_TEST_SUPER_A2], -#endif - }, - [SM_TEST_A7] = { - .entry = sm_test_A7_entry, - .run = sm_test_A7_run, - .exit = sm_test_A7_exit, -#ifdef TEST_AT_LEAST_3 - .parent = &states[SM_TEST_SUPER_A1], -#endif - }, - [SM_TEST_B4] = { - .entry = sm_test_B4_entry, - .run = sm_test_B4_run, - .exit = sm_test_B4_exit, -#ifdef TEST_AT_LEAST_1 - .parent = &states[SM_TEST_SUPER_B3], -#endif - }, - [SM_TEST_B5] = { - .entry = sm_test_B5_entry, - .run = sm_test_B5_run, - .exit = sm_test_B5_exit, -#ifdef TEST_AT_LEAST_2 - .parent = &states[SM_TEST_SUPER_B2], -#endif - }, - [SM_TEST_B6] = { - .entry = sm_test_B6_entry, - .run = sm_test_B6_run, - .exit = sm_test_B6_exit, -#ifdef TEST_AT_LEAST_3 - .parent = &states[SM_TEST_SUPER_B1], -#endif - }, - [SM_TEST_C] = { - .entry = sm_test_C_entry, - .run = sm_test_C_run, - .exit = sm_test_C_exit, - }, -}; - -/* Run before each RUN_TEST line */ -void before_test(void) -{ - /* Rest test variables */ - memset(&sm[PORT0], 0, sizeof(struct sm_)); - memset(&test_control, 0, sizeof(struct control)); -} - -int test_task(void *u) -{ - int port = PORT0; - - while (1) { - /* wait for next event/packet or timeout expiration */ - task_wait_event(-1); - /* run state machine */ - run_state(port, &sm[port].ctx); - } - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); -#if defined(TEST_USB_SM_FRAMEWORK_H3) - RUN_TEST(test_hierarchy_3); - RUN_TEST(test_set_state_from_parents); -#elif defined(TEST_USB_SM_FRAMEWORK_H2) - RUN_TEST(test_hierarchy_2); -#elif defined(TEST_USB_SM_FRAMEWORK_H1) - RUN_TEST(test_hierarchy_1); -#else - RUN_TEST(test_hierarchy_0); -#endif - test_print_result(); -} diff --git a/test/usb_sm_framework_h3.tasklist b/test/usb_sm_framework_h3.tasklist deleted file mode 100644 index 998998fd6c..0000000000 --- a/test/usb_sm_framework_h3.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TEST_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(TEST, test_task, NULL, LARGER_TASK_STACK_SIZE) diff --git a/test/usb_tcpmv2_compliance.c b/test/usb_tcpmv2_compliance.c deleted file mode 100644 index e0288feb18..0000000000 --- a/test/usb_tcpmv2_compliance.c +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright 2020 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 "mock/tcpci_i2c_mock.h" -#include "mock/usb_mux_mock.h" -#include "task.h" -#include "test_util.h" -#include "timer.h" -#include "usb_tc_sm.h" -#include "usb_tcpmv2_compliance.h" - -void before_test(void) -{ - partner_set_pd_rev(PD_REV30); - partner_tx_msg_id_reset(TCPCI_MSG_SOP_ALL); - - mock_usb_mux_reset(); - mock_tcpci_reset(); - - /* Restart the PD task and let it settle */ - task_set_event(TASK_ID_PD_C0, TASK_EVENT_RESET_DONE); - task_wait_event(SECOND); - - /* - * Default to not allowing DUT to TRY.SRC and set it to be allowed - * specifically in the TRY.SRC tests - */ - tc_try_src_override(TRY_SRC_OVERRIDE_OFF); -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_td_pd_ll_e3_dfp); - RUN_TEST(test_td_pd_ll_e3_ufp); - RUN_TEST(test_td_pd_ll_e4_dfp); - RUN_TEST(test_td_pd_ll_e4_ufp); - RUN_TEST(test_td_pd_ll_e5_dfp); - RUN_TEST(test_td_pd_ll_e5_ufp); - RUN_TEST(test_td_pd_src_e1); - RUN_TEST(test_td_pd_src_e2); - RUN_TEST(test_td_pd_src_e5); - - RUN_TEST(test_td_pd_src3_e1); - RUN_TEST(test_td_pd_src3_e7); - RUN_TEST(test_td_pd_src3_e8); - RUN_TEST(test_td_pd_src3_e9); - RUN_TEST(test_td_pd_src3_e26); - RUN_TEST(test_td_pd_src3_e32); - RUN_TEST(test_td_pd_snk3_e12); - - RUN_TEST(test_td_pd_vndi3_e3_dfp); - RUN_TEST(test_td_pd_vndi3_e3_ufp); - - RUN_TEST(test_connect_as_nonpd_sink); - RUN_TEST(test_retry_count_sop); - RUN_TEST(test_retry_count_hard_reset); - - test_print_result(); -} diff --git a/test/usb_tcpmv2_compliance.h b/test/usb_tcpmv2_compliance.h deleted file mode 100644 index 331e3c5ee8..0000000000 --- a/test/usb_tcpmv2_compliance.h +++ /dev/null @@ -1,102 +0,0 @@ -/* Copyright 2020 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. - */ - -#ifndef USB_TCPMV2_COMPLIANCE_H -#define USB_TCPMV2_COMPLIANCE_H - -#define PORT0 0 - -enum mock_cc_state { - MOCK_CC_SRC_OPEN = 0, - MOCK_CC_SNK_OPEN = 0, - MOCK_CC_SRC_RA = 1, - MOCK_CC_SNK_RP_DEF = 1, - MOCK_CC_SRC_RD = 2, - MOCK_CC_SNK_RP_1_5 = 2, - MOCK_CC_SNK_RP_3_0 = 3, -}; -enum mock_connect_result { - MOCK_CC_DUT_IS_SRC = 0, - MOCK_CC_DUT_IS_SNK = 1, -}; - - -extern uint32_t rdo; -extern uint32_t pdo; - -extern const struct tcpc_config_t tcpc_config[]; -extern const struct usb_mux usb_muxes[]; - - -void mock_set_cc(enum mock_connect_result cr, - enum mock_cc_state cc1, enum mock_cc_state cc2); -void mock_set_role(int drp, enum tcpc_rp_value rp, - enum tcpc_cc_pull cc1, enum tcpc_cc_pull cc2); -void mock_set_alert(int alert); -uint16_t tcpc_get_alert_status(void); -bool vboot_allow_usb_pd(void); -int pd_check_vconn_swap(int port); -void board_reset_pd_mcu(void); - -int tcpci_startup(void); - -void partner_set_data_role(enum pd_data_role data_role); -enum pd_data_role partner_get_data_role(void); - -void partner_set_power_role(enum pd_power_role power_role); -enum pd_power_role partner_get_power_role(void); - -void partner_set_pd_rev(enum pd_rev_type pd_rev); -enum pd_rev_type partner_get_pd_rev(void); - -#define TCPCI_MSG_SOP_ALL -1 -void partner_tx_msg_id_reset(int sop); - -void partner_send_msg(enum tcpci_msg_type sop, - uint16_t type, - uint16_t cnt, - uint16_t ext, - uint32_t *payload); - - -int handle_attach_expected_msgs(enum pd_data_role data_role); - - -enum proc_pd_e1_attach { - INITIAL_ATTACH = BIT(0), - ALREADY_ATTACHED = BIT(1), - INITIAL_AND_ALREADY_ATTACHED = INITIAL_ATTACH | ALREADY_ATTACHED -}; -int proc_pd_e1(enum pd_data_role data_role, enum proc_pd_e1_attach attach); -int proc_pd_e3(void); - -int test_td_pd_ll_e3_dfp(void); -int test_td_pd_ll_e3_ufp(void); -int test_td_pd_ll_e4_dfp(void); -int test_td_pd_ll_e4_ufp(void); -int test_td_pd_ll_e5_dfp(void); -int test_td_pd_ll_e5_ufp(void); - -int test_td_pd_src_e1(void); -int test_td_pd_src_e2(void); -int test_td_pd_src_e5(void); - -int test_td_pd_src3_e1(void); -int test_td_pd_src3_e7(void); -int test_td_pd_src3_e8(void); -int test_td_pd_src3_e9(void); -int test_td_pd_src3_e26(void); -int test_td_pd_src3_e32(void); - -int test_td_pd_snk3_e12(void); - -int test_td_pd_vndi3_e3_dfp(void); -int test_td_pd_vndi3_e3_ufp(void); - -int test_connect_as_nonpd_sink(void); -int test_retry_count_sop(void); -int test_retry_count_hard_reset(void); - -#endif /* USB_TCPMV2_COMPLIANCE_H */ diff --git a/test/usb_tcpmv2_compliance.mocklist b/test/usb_tcpmv2_compliance.mocklist deleted file mode 100644 index f364fb1050..0000000000 --- a/test/usb_tcpmv2_compliance.mocklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2020 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 CONFIG_TEST_MOCK_LIST \ - MOCK(USB_MUX) \ - MOCK(TCPCI_I2C) \ - MOCK(BATTERY) diff --git a/test/usb_tcpmv2_compliance.tasklist b/test/usb_tcpmv2_compliance.tasklist deleted file mode 100644 index 654e4eca2b..0000000000 --- a/test/usb_tcpmv2_compliance.tasklist +++ /dev/null @@ -1,11 +0,0 @@ -/* Copyright 2020 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. - */ - -/** - * See CONFIG_TEST_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_TEST(PD_INT_C0, pd_interrupt_handler_task, 0, LARGER_TASK_STACK_SIZE) diff --git a/test/usb_tcpmv2_compliance_common.c b/test/usb_tcpmv2_compliance_common.c deleted file mode 100644 index c1c4f21e09..0000000000 --- a/test/usb_tcpmv2_compliance_common.c +++ /dev/null @@ -1,495 +0,0 @@ -/* Copyright 2020 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 "hooks.h" -#include "mock/tcpci_i2c_mock.h" -#include "mock/usb_mux_mock.h" -#include "task.h" -#include "tcpm/tcpci.h" -#include "test_util.h" -#include "timer.h" -#include "usb_tcpmv2_compliance.h" -#include "usb_tc_sm.h" - -uint32_t rdo = RDO_FIXED(1, 500, 500, 0); -uint32_t pdo = PDO_FIXED(5000, 3000, - PDO_FIXED_DUAL_ROLE | - PDO_FIXED_DATA_SWAP | - PDO_FIXED_COMM_CAP); - -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { - { - .bus_type = EC_BUS_TYPE_I2C, - .i2c_info = { - .port = I2C_PORT_HOST_TCPC, - .addr_flags = MOCK_TCPCI_I2C_ADDR_FLAGS, - }, - .drv = &tcpci_tcpm_drv, - .flags = TCPC_FLAGS_TCPCI_REV2_0, - }, -}; - -const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { - { - .driver = &mock_usb_mux_driver, - } -}; - - -void mock_set_cc(enum mock_connect_result cr, - enum mock_cc_state cc1, enum mock_cc_state cc2) -{ - mock_tcpci_set_reg(TCPC_REG_CC_STATUS, - TCPC_REG_CC_STATUS_SET(cr, cc1, cc2)); -} - -void mock_set_role(int drp, enum tcpc_rp_value rp, - enum tcpc_cc_pull cc1, enum tcpc_cc_pull cc2) -{ - mock_tcpci_set_reg(TCPC_REG_ROLE_CTRL, - TCPC_REG_ROLE_CTRL_SET(drp, rp, cc1, cc2)); -} - -static int mock_alert_count; -void mock_set_alert(int alert) -{ - mock_tcpci_set_reg_bits(TCPC_REG_ALERT, alert); - mock_alert_count = 1; - schedule_deferred_pd_interrupt(PORT0); -} - -uint16_t tcpc_get_alert_status(void) -{ - ccprints("mock_alert_count %d", mock_alert_count); - if (mock_alert_count > 0) { - mock_alert_count--; - return PD_STATUS_TCPC_ALERT_0; - } - return 0; -} - -bool vboot_allow_usb_pd(void) -{ - return 1; -} - -int pd_check_vconn_swap(int port) -{ - return 1; -} - -void board_reset_pd_mcu(void) {} - -/***************************************************************************** - * Partner utility functions - */ -static enum pd_data_role partner_data_role; -void partner_set_data_role(enum pd_data_role data_role) -{ - partner_data_role = data_role; -} -enum pd_data_role partner_get_data_role(void) -{ - return partner_data_role; -} - -static enum pd_power_role partner_power_role; -void partner_set_power_role(enum pd_power_role power_role) -{ - partner_power_role = power_role; -} -enum pd_power_role partner_get_power_role(void) -{ - return partner_power_role; -} - -static enum pd_rev_type partner_pd_rev; -void partner_set_pd_rev(enum pd_rev_type pd_rev) -{ - partner_pd_rev = pd_rev; -} -enum pd_rev_type partner_get_pd_rev(void) -{ - return partner_pd_rev; -} - -static int partner_tx_id[NUM_SOP_STAR_TYPES]; -void partner_tx_msg_id_reset(int sop) -{ - if (sop == TCPCI_MSG_SOP_ALL) - for (sop = 0; sop < NUM_SOP_STAR_TYPES; ++sop) - partner_tx_id[sop] = 0; - else - partner_tx_id[sop] = 0; -} - -void partner_send_msg(enum tcpci_msg_type sop, - uint16_t type, - uint16_t cnt, - uint16_t ext, - uint32_t *payload) -{ - uint16_t header; - - partner_tx_id[sop] &= 7; - header = PD_HEADER(type, - sop == TCPCI_MSG_SOP ? partner_get_power_role() - : PD_PLUG_FROM_CABLE, - partner_get_data_role(), - partner_tx_id[sop], - cnt, - partner_get_pd_rev(), - ext); - - mock_tcpci_receive(sop, header, payload); - ++partner_tx_id[sop]; - mock_set_alert(TCPC_REG_ALERT_RX_STATUS); -} - - -/***************************************************************************** - * TCPCI clean power up - */ -int tcpci_startup(void) -{ - /* Should be in low power mode before AP boots. */ - TEST_EQ(mock_tcpci_get_reg(TCPC_REG_COMMAND), - TCPC_REG_COMMAND_I2CIDLE, "%d"); - task_wait_event(10 * SECOND); - - hook_notify(HOOK_CHIPSET_STARTUP); - task_wait_event(5 * MSEC); - hook_notify(HOOK_CHIPSET_RESUME); - - task_wait_event(10 * SECOND); - /* Should be in low power mode and DRP auto-toggling with AP in S0. */ - TEST_EQ((mock_tcpci_get_reg(TCPC_REG_ROLE_CTRL) - & TCPC_REG_ROLE_CTRL_DRP_MASK), - TCPC_REG_ROLE_CTRL_DRP_MASK, "%d"); - /* TODO: check previous command was TCPC_REG_COMMAND_LOOK4CONNECTION */ - TEST_EQ(mock_tcpci_get_reg(TCPC_REG_COMMAND), - TCPC_REG_COMMAND_I2CIDLE, "%d"); - - /* TODO: this should be performed in TCPCI mock on startup but needs - * more TCPCI functionality added before that can happen. So until - * that time, if the FAULT register is set, send the alert here. - */ - if (mock_tcpci_get_reg(TCPC_REG_FAULT_STATUS)) - mock_set_alert(TCPC_REG_ALERT_FAULT); - - return EC_SUCCESS; -} - -/***************************************************************************** - * PROC.PD.E1. Bring-up procedure - */ -int proc_pd_e1(enum pd_data_role data_role, enum proc_pd_e1_attach attach) -{ - if (attach & INITIAL_ATTACH) { - /* - * a) The test starts in a disconnected state. - */ - mock_tcpci_set_reg(TCPC_REG_EXT_STATUS, - TCPC_REG_EXT_STATUS_SAFE0V); - mock_set_alert(TCPC_REG_ALERT_EXT_STATUS); - task_wait_event(10 * SECOND); - TEST_EQ(pd_get_data_role(I2C_PORT_HOST_TCPC), - PD_ROLE_DISCONNECTED, "%d"); - - partner_set_data_role((data_role == PD_ROLE_UFP) - ? PD_ROLE_DFP - : PD_ROLE_UFP); - - partner_set_power_role((data_role == PD_ROLE_UFP) - ? PD_ROLE_SOURCE - : PD_ROLE_SINK); - - switch (partner_get_power_role()) { - case PD_ROLE_SOURCE: - /* - * b) The tester applies Rp (PD3=1.5A, PD2=3A) and - * waits for the UUT attachment. - */ - mock_set_cc(MOCK_CC_DUT_IS_SNK, - MOCK_CC_SNK_OPEN, - (partner_get_pd_rev() == PD_REV30 - ? MOCK_CC_SNK_RP_1_5 - : MOCK_CC_SNK_RP_3_0)); - mock_set_alert(TCPC_REG_ALERT_CC_STATUS); - task_wait_event(5 * MSEC); - - /* - * c) If Ra is detected, the tester applies Vconn. - */ - - /* - * d) The tester applies Vbus and waits 50 ms. - */ - mock_tcpci_set_reg_bits(TCPC_REG_POWER_STATUS, - TCPC_REG_POWER_STATUS_VBUS_PRES); - - mock_tcpci_clr_reg_bits(TCPC_REG_EXT_STATUS, - TCPC_REG_EXT_STATUS_SAFE0V); - mock_set_alert(TCPC_REG_ALERT_EXT_STATUS | - TCPC_REG_ALERT_POWER_STATUS); - task_wait_event(50 * MSEC); - break; - - case PD_ROLE_SINK: - /* - * b) The tester applies Rd and waits for Vbus for - * tNoResponse max (5.5 s). - */ - mock_set_cc(MOCK_CC_DUT_IS_SRC, - MOCK_CC_SRC_OPEN, - MOCK_CC_SRC_RD); - mock_set_alert(TCPC_REG_ALERT_CC_STATUS); - break; - } - } - - if (attach & ALREADY_ATTACHED) { - switch (partner_get_power_role()) { - case PD_ROLE_SOURCE: - /* - * e) The tester transmits Source Capabilities until - * reception of GoodCrc for tNoResponse max (5.5s). - * The Source Capabilities includes Fixed 5V 3A PDO. - */ - task_wait_event(1 * MSEC); - partner_send_msg(TCPCI_MSG_SOP, PD_DATA_SOURCE_CAP, 1, - 0, &pdo); - - /* - * f) The tester waits for the Request from the UUT for - * tSenderResponse max (30 ms). - */ - TEST_EQ(verify_tcpci_transmit(TCPCI_MSG_SOP, 0, - PD_DATA_REQUEST), - EC_SUCCESS, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - - /* - * g) The tester sends Accept, and when Vbus is stable - * at the target voltage, sends PS_RDY. - */ - partner_send_msg(TCPCI_MSG_SOP, PD_CTRL_ACCEPT, 0, 0, - NULL); - task_wait_event(10 * MSEC); - partner_send_msg(TCPCI_MSG_SOP, PD_CTRL_PS_RDY, 0, 0, - NULL); - task_wait_event(1 * MSEC); - - TEST_EQ(tc_is_attached_snk(PORT0), true, "%d"); - break; - - case PD_ROLE_SINK: - /* - * c) The tester waits Source Capabilities for for - * tNoResponse max (5.5 s). - */ - TEST_EQ(verify_tcpci_transmit(TCPCI_MSG_SOP, 0, - PD_DATA_SOURCE_CAP), - EC_SUCCESS, "%d"); - - /* - * d) The tester replies GoodCrc on reception of the - * Source Capabilities. - */ - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - task_wait_event(10 * MSEC); - - /* - * e) The tester requests 5V 0.5A. - */ - partner_send_msg(TCPCI_MSG_SOP, PD_DATA_REQUEST, 1, 0, - &rdo); - - TEST_EQ(verify_tcpci_transmit(TCPCI_MSG_SOP, - PD_CTRL_ACCEPT, 0), - EC_SUCCESS, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - - /* - * f) The tester waits PS_RDY for tPSSourceOn max - * (480 ms). - */ - TEST_EQ(verify_tcpci_transmit(TCPCI_MSG_SOP, - PD_CTRL_PS_RDY, 0), - EC_SUCCESS, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - - TEST_EQ(tc_is_attached_src(PORT0), true, "%d"); - break; - } - TEST_EQ(pd_get_data_role(I2C_PORT_HOST_TCPC), - data_role, "%d"); - } - - return EC_SUCCESS; -} - -/***************************************************************************** - * PROC.PD.E3. Wait to Start AMS for DFP(Source) UUT - */ -int proc_pd_e3(void) -{ - /* - * Make sure we are idle. Reject everything that is pending - */ - TEST_EQ(handle_attach_expected_msgs(PD_ROLE_DFP), EC_SUCCESS, "%d"); - - /* - * PROC.PD.E3. Wait to Start AMS for DFP(Source) UUT: - * a) The Tester keeps monitoring the Rp value and if the UUT doesn't - * set the value to SinkTXOK if it doesn't have anything to send in 1s, - * the test fails. During this period, the Tester replies any message - * sent from the UUT with a proper response. - */ - TEST_EQ(tc_is_attached_src(PORT0), true, "%d"); - TEST_EQ(TCPC_REG_ROLE_CTRL_RP(mock_tcpci_get_reg(TCPC_REG_ROLE_CTRL)), - SINK_TX_OK, "%d"); - - task_wait_event(10 * SECOND); - return EC_SUCCESS; -} - -/***************************************************************************** - * handle_attach_expected_msgs - * - * Depending on the data role, the DUT will send a sequence of messages on - * attach. Most of these can be rejected. - */ -int handle_attach_expected_msgs(enum pd_data_role data_role) -{ - int rv; - int found_index; - struct possible_tx possible[4]; - - if (data_role == PD_ROLE_DFP) { - possible[0].tx_type = TCPCI_MSG_SOP; - possible[0].ctrl_msg = PD_CTRL_GET_SOURCE_CAP; - possible[0].data_msg = 0; - - possible[1].tx_type = TCPCI_MSG_SOP; - possible[1].ctrl_msg = PD_CTRL_GET_SINK_CAP; - possible[1].data_msg = 0; - - possible[2].tx_type = TCPCI_MSG_SOP_PRIME; - possible[2].ctrl_msg = 0; - possible[2].data_msg = PD_DATA_VENDOR_DEF; - - possible[3].tx_type = TCPCI_MSG_SOP; - possible[3].ctrl_msg = 0; - possible[3].data_msg = PD_DATA_VENDOR_DEF; - - do { - rv = verify_tcpci_possible_tx(possible, - 4, - &found_index, - NULL, - 0, - NULL, - -1); - - TEST_NE(rv, EC_ERROR_UNKNOWN, "%d"); - if (rv == EC_ERROR_TIMEOUT) - break; - - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - task_wait_event(10 * MSEC); - - switch (found_index) { - case 0: /* TCPCI_MSG_SOP PD_CTRL_GET_SOURCE_CAP */ - partner_send_msg(TCPCI_MSG_SOP, - PD_DATA_SOURCE_CAP, - 1, 0, &pdo); - break; - case 1: /* TCPCI_MSG_SOP PD_CTRL_GET_SINK_CAP */ - partner_send_msg(TCPCI_MSG_SOP, - PD_DATA_SINK_CAP, - 1, 0, &pdo); - break; - case 2: /* TCPCI_MSG_SOP_PRIME PD_DATA_VENDOR_DEF */ - partner_send_msg(TCPCI_MSG_SOP_PRIME, - PD_CTRL_NOT_SUPPORTED, - 0, 0, NULL); - break; - case 3: /* TCPCI_MSG_SOP PD_DATA_VENDOR_DEF */ - partner_send_msg(TCPCI_MSG_SOP, - PD_CTRL_NOT_SUPPORTED, - 0, 0, NULL); - break; - default: - TEST_ASSERT(0); - break; - } - } while (rv != EC_ERROR_TIMEOUT); - } else if (data_role == PD_ROLE_UFP) { - int vcs = 0; - - possible[0].tx_type = TCPCI_MSG_SOP; - possible[0].ctrl_msg = PD_CTRL_GET_SINK_CAP; - possible[0].data_msg = 0; - - possible[1].tx_type = TCPCI_MSG_SOP; - possible[1].ctrl_msg = PD_CTRL_DR_SWAP; - possible[1].data_msg = 0; - - possible[2].tx_type = TCPCI_MSG_SOP; - possible[2].ctrl_msg = PD_CTRL_PR_SWAP; - possible[2].data_msg = 0; - - possible[3].tx_type = TCPCI_MSG_SOP; - possible[3].ctrl_msg = PD_CTRL_VCONN_SWAP; - possible[3].data_msg = 0; - - do { - rv = verify_tcpci_possible_tx(possible, - 4, - &found_index, - NULL, - 0, - NULL, - -1); - - TEST_NE(rv, EC_ERROR_UNKNOWN, "%d"); - if (rv == EC_ERROR_TIMEOUT) - break; - - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - task_wait_event(10 * MSEC); - - switch (found_index) { - case 0: /* TCPCI_MSG_SOP PD_CTRL_GET_SINK_CAP */ - partner_send_msg(TCPCI_MSG_SOP, - PD_DATA_SINK_CAP, - 1, 0, &pdo); - break; - case 1: /* TCPCI_MSG_SOP PD_CTRL_DR_SWAP */ - partner_send_msg(TCPCI_MSG_SOP, - PD_CTRL_REJECT, - 0, 0, NULL); - break; - case 2: /* TCPCI_MSG_SOP PD_CTRL_PR_SWAP */ - partner_send_msg(TCPCI_MSG_SOP, - PD_CTRL_REJECT, - 0, 0, NULL); - break; - case 3: /* TCPCI_MSG_SOP PD_CTRL_VCONN_SWAP */ - TEST_LT(vcs++, 4, "%d"); - partner_send_msg(TCPCI_MSG_SOP, - PD_CTRL_REJECT, - 0, 0, NULL); - break; - default: - TEST_ASSERT(0); - break; - } - } while (rv != EC_ERROR_TIMEOUT); - } - task_wait_event(1 * SECOND); - return EC_SUCCESS; -} diff --git a/test/usb_tcpmv2_td_pd_ll_e3.c b/test/usb_tcpmv2_td_pd_ll_e3.c deleted file mode 100644 index 46fbee393f..0000000000 --- a/test/usb_tcpmv2_td_pd_ll_e3.c +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright 2020 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 "mock/tcpci_i2c_mock.h" -#include "task.h" -#include "tcpm/tcpci.h" -#include "test_util.h" -#include "timer.h" -#include "usb_tcpmv2_compliance.h" -#include "usb_tc_sm.h" - -/***************************************************************************** - * TD.PD.LL.E3. Soft Reset Usage - * - * Description: - * Check that the UUT will issue a Soft Reset after unsuccessful retries, - * and that the link can be successfully recovered after that. - */ -static int td_pd_ll_e3(enum pd_data_role data_role) -{ - int retries; - - partner_set_pd_rev(PD_REV20); - - TEST_EQ(tcpci_startup(), EC_SUCCESS, "%d"); - - /* - * a) Run PROC.PD.E1 Bring-up according to the UUT role. - */ - TEST_EQ(proc_pd_e1(data_role, INITIAL_AND_ALREADY_ATTACHED), - EC_SUCCESS, "%d"); - - /* - * Make sure we are idle. Reject everything that is pending - */ - TEST_EQ(handle_attach_expected_msgs(data_role), EC_SUCCESS, "%d"); - - /* - * b) Send a Get_Sink_Cap message to the UUT, wait for a reply - * and do not send GoodCrc for nRetryCount + 1 times - * (nRetryCount equals 3 since PD 2.1). - */ - partner_send_msg(TCPCI_MSG_SOP, - PD_CTRL_GET_SINK_CAP, - 0, 0, NULL); - - retries = (partner_get_pd_rev() == PD_REV30) ? 2 : 3; - TEST_EQ(verify_tcpci_tx_retry_count(TCPCI_MSG_SOP, 0, PD_DATA_SINK_CAP, - retries), - EC_SUCCESS, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_FAILED); - - /* - * c) Check that the UUT issues a Soft Reset. - */ - TEST_EQ(verify_tcpci_transmit(TCPCI_MSG_SOP, PD_CTRL_SOFT_RESET, 0), - EC_SUCCESS, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - task_wait_event(10 * MSEC); - - /* - * d) Handle correctly the Soft Reset procedure. - */ - partner_send_msg(TCPCI_MSG_SOP, PD_CTRL_ACCEPT, 0, 0, NULL); - - /* - * e) Continue the bring-up procedure and check that the link is - * successfully established. - */ - TEST_EQ(proc_pd_e1(data_role, ALREADY_ATTACHED), EC_SUCCESS, "%d"); - - return EC_SUCCESS; -} -int test_td_pd_ll_e3_dfp(void) -{ - return td_pd_ll_e3(PD_ROLE_DFP); -} -int test_td_pd_ll_e3_ufp(void) -{ - return td_pd_ll_e3(PD_ROLE_UFP); -} diff --git a/test/usb_tcpmv2_td_pd_ll_e4.c b/test/usb_tcpmv2_td_pd_ll_e4.c deleted file mode 100644 index cb6aa8e8b6..0000000000 --- a/test/usb_tcpmv2_td_pd_ll_e4.c +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright 2020 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 "mock/tcpci_i2c_mock.h" -#include "task.h" -#include "tcpm/tcpci.h" -#include "test_util.h" -#include "timer.h" -#include "usb_tcpmv2_compliance.h" -#include "usb_tc_sm.h" - -/***************************************************************************** - * TD.PD.LL.E4. Hard Reset Usage - * - * Description: - * Check that the UUT will issue a Soft Reset after unsuccessful retries, - * and that the link can be successfully recovered after that. - * Check that the UUT will issue a Hard Reset if the Soft Reset fails, - * and that the link can be successfully recovered after that. - */ -static int td_pd_ll_e4(enum pd_data_role data_role) -{ - int retries; - - partner_set_pd_rev(PD_REV20); - - TEST_EQ(tcpci_startup(), EC_SUCCESS, "%d"); - - /* - * a) Run PROC.PD.E1 Bring-up according to the UUT role. - */ - TEST_EQ(proc_pd_e1(data_role, INITIAL_AND_ALREADY_ATTACHED), - EC_SUCCESS, "%d"); - - /* - * Make sure we are idle. Reject everything that is pending - */ - TEST_EQ(handle_attach_expected_msgs(data_role), EC_SUCCESS, "%d"); - - /* - * b) Send a Get_Sink_Cap message to the UUT, wait for a reply - * and do not send GoodCrc for nRetryCount + 1 times - * (nRetryCount equals 3 since PD 2.1). - */ - partner_send_msg(TCPCI_MSG_SOP, - PD_CTRL_GET_SINK_CAP, - 0, 0, NULL); - - retries = 3; - TEST_EQ(verify_tcpci_tx_retry_count(TCPCI_MSG_SOP, 0, PD_DATA_SINK_CAP, - retries), - EC_SUCCESS, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_FAILED); - - /* - * c) Wait the nRetryCount + 1 (four) Soft Resets from the UUT and do - * not reply GoodCrc. - */ - retries = 3; - TEST_EQ(verify_tcpci_tx_retry_count(TCPCI_MSG_SOP, PD_CTRL_SOFT_RESET, - 0, retries), - EC_SUCCESS, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_FAILED); - task_wait_event(1 * MSEC); - - /* - * d) Check that the UUT issues a Hard Reset. - */ - TEST_EQ(mock_tcpci_get_reg(TCPC_REG_TRANSMIT), - TCPCI_MSG_TX_HARD_RESET, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS | TCPC_REG_ALERT_TX_FAILED); - mock_tcpci_set_reg(TCPC_REG_TRANSMIT, 0); - task_wait_event(1 * MSEC); - - /* - * e) Do the bring-up procedure for Link tests and check that the link - * is successfully established. - */ - TEST_EQ(proc_pd_e1(data_role, ALREADY_ATTACHED), EC_SUCCESS, "%d"); - - return EC_SUCCESS; -} -int test_td_pd_ll_e4_dfp(void) -{ - return td_pd_ll_e4(PD_ROLE_DFP); -} -int test_td_pd_ll_e4_ufp(void) -{ - return td_pd_ll_e4(PD_ROLE_UFP); -} diff --git a/test/usb_tcpmv2_td_pd_ll_e5.c b/test/usb_tcpmv2_td_pd_ll_e5.c deleted file mode 100644 index ae6409eb20..0000000000 --- a/test/usb_tcpmv2_td_pd_ll_e5.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright 2020 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 "mock/tcpci_i2c_mock.h" -#include "task.h" -#include "tcpm/tcpci.h" -#include "test_util.h" -#include "timer.h" -#include "usb_tcpmv2_compliance.h" -#include "usb_tc_sm.h" - -/***************************************************************************** - * TD.PD.LL.E5. Soft Reset - * - * Description: - * Check that the UUT will correctly complete the Soft Reset procedure. - */ -static int td_pd_ll_e5(enum pd_data_role data_role) -{ - partner_set_pd_rev(PD_REV20); - - TEST_EQ(tcpci_startup(), EC_SUCCESS, "%d"); - - /* - * a) Run PROC.PD.E1 Bring-up according to the UUT role. - */ - TEST_EQ(proc_pd_e1(data_role, INITIAL_AND_ALREADY_ATTACHED), - EC_SUCCESS, "%d"); - - /* - * Make sure we are idle. Reject everything that is pending - */ - TEST_EQ(handle_attach_expected_msgs(data_role), EC_SUCCESS, "%d"); - - /* - * b) Initiate a Soft Reset and check that the procedure is completed - * successfully. - */ - partner_send_msg(TCPCI_MSG_SOP, PD_CTRL_SOFT_RESET, 0, 0, NULL); - - TEST_EQ(verify_tcpci_transmit(TCPCI_MSG_SOP, PD_CTRL_ACCEPT, 0), - EC_SUCCESS, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - - TEST_EQ(proc_pd_e1(data_role, ALREADY_ATTACHED), EC_SUCCESS, "%d"); - - return EC_SUCCESS; -} -int test_td_pd_ll_e5_dfp(void) -{ - return td_pd_ll_e5(PD_ROLE_DFP); -} -int test_td_pd_ll_e5_ufp(void) -{ - return td_pd_ll_e5(PD_ROLE_UFP); -} diff --git a/test/usb_tcpmv2_td_pd_other.c b/test/usb_tcpmv2_td_pd_other.c deleted file mode 100644 index 1882480150..0000000000 --- a/test/usb_tcpmv2_td_pd_other.c +++ /dev/null @@ -1,107 +0,0 @@ -/* Copyright 2020 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 "mock/tcpci_i2c_mock.h" -#include "task.h" -#include "tcpm/tcpci.h" -#include "test_util.h" -#include "timer.h" -#include "usb_tcpmv2_compliance.h" -#include "usb_tc_sm.h" -#include "usb_prl_sm.h" - -int test_connect_as_nonpd_sink(void) -{ - task_wait_event(10 * SECOND); - - /* Simulate a non-PD power supply being plugged in. */ - mock_set_cc(MOCK_CC_DUT_IS_SNK, MOCK_CC_SNK_OPEN, MOCK_CC_SNK_RP_3_0); - mock_set_alert(TCPC_REG_ALERT_CC_STATUS); - - task_wait_event(50 * MSEC); - - mock_tcpci_set_reg(TCPC_REG_POWER_STATUS, - TCPC_REG_POWER_STATUS_VBUS_PRES); - mock_set_alert(TCPC_REG_ALERT_POWER_STATUS); - - task_wait_event(10 * SECOND); - TEST_EQ(tc_is_attached_snk(PORT0), true, "%d"); - - return EC_SUCCESS; -} - -int test_retry_count_sop(void) -{ - /* DRP auto-toggling with AP in S0, source enabled. */ - TEST_EQ(tcpci_startup(), EC_SUCCESS, "%d"); - - /* - * The test starts in a disconnected state. - */ - mock_tcpci_set_reg(TCPC_REG_EXT_STATUS, TCPC_REG_EXT_STATUS_SAFE0V); - mock_set_alert(TCPC_REG_ALERT_EXT_STATUS); - task_wait_event(10 * SECOND); - - /* - * The Tester applies Rd and waits for Vbus for tNoResponse max. - */ - mock_set_cc(MOCK_CC_DUT_IS_SRC, MOCK_CC_SRC_OPEN, MOCK_CC_SRC_RD); - mock_set_alert(TCPC_REG_ALERT_CC_STATUS); - - /* - * The Tester waits for Source_Capabilities for tNoResponse max. - * - * Source Caps is SOP message which should be retried at TCPC layer. - * The retry count for PD3 should be 2. - */ - TEST_EQ(verify_tcpci_tx_retry_count(TCPCI_MSG_SOP, 0, - PD_DATA_SOURCE_CAP, 2), - EC_SUCCESS, "%d"); - return EC_SUCCESS; -} - -int test_retry_count_hard_reset(void) -{ - /* DRP auto-toggling with AP in S0, source enabled. */ - TEST_EQ(tcpci_startup(), EC_SUCCESS, "%d"); - - /* - * The test starts in a disconnected state. - */ - mock_tcpci_set_reg(TCPC_REG_EXT_STATUS, TCPC_REG_EXT_STATUS_SAFE0V); - mock_set_alert(TCPC_REG_ALERT_EXT_STATUS); - task_wait_event(10 * SECOND); - - /* - * The Tester applies Rd and waits for Vbus for tNoResponse max. - */ - mock_set_cc(MOCK_CC_DUT_IS_SRC, MOCK_CC_SRC_OPEN, MOCK_CC_SRC_RD); - mock_set_alert(TCPC_REG_ALERT_CC_STATUS); - - /* - * The Tester waits for Source_Capabilities for tNoResponse max. - */ - TEST_EQ(verify_tcpci_transmit(TCPCI_MSG_SOP, 0, PD_DATA_SOURCE_CAP), - EC_SUCCESS, "%d"); - /* - * The Tester replies GoodCrc on reception of the Source_Capabilities. - */ - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - task_wait_event(10 * MSEC); - - /* - * Now that PRL is running since we are connected, we can send a hard - * reset. - */ - - /* Request that DUT send hard reset */ - prl_execute_hard_reset(PORT0); - - /* The retry count for hard resets should be 0 */ - TEST_EQ(verify_tcpci_tx_retry_count(TCPCI_MSG_TX_HARD_RESET, 0, 0, 0), - EC_SUCCESS, "%d"); - - return EC_SUCCESS; -} diff --git a/test/usb_tcpmv2_td_pd_snk3_e12.c b/test/usb_tcpmv2_td_pd_snk3_e12.c deleted file mode 100644 index 0195d39dba..0000000000 --- a/test/usb_tcpmv2_td_pd_snk3_e12.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright 2020 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 "mock/tcpci_i2c_mock.h" -#include "task.h" -#include "tcpm/tcpci.h" -#include "test_util.h" -#include "timer.h" -#include "usb_tcpmv2_compliance.h" - -/***************************************************************************** - * TD.PD.SNK3.E12.Soft_Reset sent regardless of Rp value - * - * Description: - * As Provider (DFP), the Tester forces the UUT to send Soft_Reset and - * verifies Soft_Reset is sent regardless even though the Rp value is - * SinkTxNG. - */ -int test_td_pd_snk3_e12(void) -{ - /* - * TD.PD.SNK3.E12.Soft_Reset sent regardless of Rp value - * a) Run PROC.PD.E1 Bring-up according to the UUT role. - */ - TEST_EQ(tcpci_startup(), EC_SUCCESS, "%d"); - TEST_EQ(proc_pd_e1(PD_ROLE_UFP, INITIAL_AND_ALREADY_ATTACHED), - EC_SUCCESS, "%d"); - - /* - * b) The Tester keeps the Rp value as SinkTXNG and sends a - * Get_Sink_Cap message to the UUT. - */ - partner_send_msg(TCPCI_MSG_SOP, PD_CTRL_GET_SINK_CAP, 0, 0, NULL); - - /* - * c) Upon receipt of the Sink_Capabilities Message, the Tester doesn't - * reply with GoodCRC. - */ - TEST_EQ(verify_tcpci_transmit(TCPCI_MSG_SOP, 0, PD_DATA_SINK_CAP), - EC_SUCCESS, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_FAILED); - - /* - * d) The Tester verifies that a Soft_Reset message is sent by the UUT - * within tReceive max + tSoftReset max - */ - TEST_EQ(verify_tcpci_tx_timeout( - TCPCI_MSG_SOP, PD_CTRL_SOFT_RESET, 0, 16 * MSEC), - EC_SUCCESS, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - - return EC_SUCCESS; -} diff --git a/test/usb_tcpmv2_td_pd_src3_e1.c b/test/usb_tcpmv2_td_pd_src3_e1.c deleted file mode 100644 index 751e354b11..0000000000 --- a/test/usb_tcpmv2_td_pd_src3_e1.c +++ /dev/null @@ -1,176 +0,0 @@ -/* Copyright 2020 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 "mock/tcpci_i2c_mock.h" -#include "task.h" -#include "tcpm/tcpci.h" -#include "test_util.h" -#include "timer.h" -#include "usb_tcpmv2_compliance.h" -#include "usb_tc_sm.h" - -#define BUFFER_SIZE 100 - -#define HEADER_BYTE_OFFSET 1 -#define HEADER_BYTE_CNT 2 -#define PDO_BYTE_CNT 4 - -enum pd_revision { - REVISION_1 = 0, - REVISION_2 = 1, - REVISION_3 = 2, - REVISION_RESERVED = 3 -}; - -/***************************************************************************** - * TD.PD.SRC3.E1 Source Capabilities Fields Checks - * - * Description: - * As Consumer (UFP), the Tester waits for a Source_Capabilities message - * from the Provider (DFP,UUT) and verifies correct field values. - */ -int test_td_pd_src3_e1(void) -{ - int i; - int msg_len; - uint8_t data[BUFFER_SIZE]; - uint16_t header; - uint16_t pd_cnt; - uint32_t pdo; - uint32_t type; - uint32_t last_fixed_voltage = 0; - uint32_t last_battery_voltage = 0; - uint32_t last_variable_voltage = 0; - uint32_t last_programmable_voltage = 0; - - partner_set_pd_rev(PD_REV30); - - TEST_EQ(tcpci_startup(), EC_SUCCESS, "%d"); - - /* - * a) Run PROC.PD.E1 Bring-up For DFP UUT steps a and b. - * - * NOTE: Calling PROC.PD.E1 with INITIAL_ATTACH will stop just before - * the PD_DATA_SOURCE_CAP is verified. We need to stop the process - * there to gather the actual message data. - */ - TEST_EQ(proc_pd_e1(PD_ROLE_DFP, INITIAL_ATTACH), EC_SUCCESS, "%d"); - - /* - * b) Upon receipt of the Source_Capabilities message from the - * Provider, the Tester verifies: - * 1. Number of Data Objects field equals the number of Src_PDOs in - * the message and is not 000b. - * 2. Port Power Role field = 1b (Source) - * 3. Specification Revision field = 10b (Rev 3.0) - * 4. Port Data Role field = 1b (DFP) - * 5. Message Type field = 00001b (Source Capabilities) - * 6. Extended field = 0b - */ - TEST_EQ(verify_tcpci_tx_with_data(TCPCI_MSG_SOP, - PD_DATA_SOURCE_CAP, - data, - sizeof(data), - &msg_len, - 0), - EC_SUCCESS, "%d"); - TEST_GE(msg_len, HEADER_BYTE_CNT, "%d"); - - header = UINT16_FROM_BYTE_ARRAY_LE(data, HEADER_BYTE_OFFSET); - pd_cnt = PD_HEADER_CNT(header); - TEST_NE(pd_cnt, 0, "%d"); - TEST_EQ(msg_len, HEADER_BYTE_OFFSET + - HEADER_BYTE_CNT + - (pd_cnt * PDO_BYTE_CNT), "%d"); - TEST_EQ(PD_HEADER_PROLE(header), PD_ROLE_SOURCE, "%d"); - TEST_EQ(PD_HEADER_REV(header), REVISION_3, "%d"); - TEST_EQ(PD_HEADER_DROLE(header), PD_ROLE_DFP, "%d"); - TEST_EQ(PD_HEADER_TYPE(header), PD_DATA_SOURCE_CAP, "%d"); - TEST_EQ(PD_HEADER_EXT(header), 0, "%d"); - - /* - * c) For the first PDO, the Tester verifies: - * 1. Bits 31..30 (PDO type) are 00b (Fixed Supply). - * 2. Voltage field = 100 (5 V) - * 3. Bits 23..22 = 000b (Reserved) - */ - pdo = UINT32_FROM_BYTE_ARRAY_LE(data, HEADER_BYTE_OFFSET + - HEADER_BYTE_CNT); - - type = pdo & PDO_TYPE_MASK; - TEST_EQ(type, PDO_TYPE_FIXED, "%d"); - - last_fixed_voltage = PDO_FIXED_VOLTAGE(pdo); - TEST_EQ(last_fixed_voltage, 5000, "%d"); - TEST_EQ(pdo & GENMASK(23, 22), 0, "%d"); - - /* - * d) For the other PDOs (if any), the Tester verifies: - * 1. If Bits 31..30 are 00b - * -- Bits 29..22 are set to 0. - * NOTE: Bit 29 is Dual Role Power and looks correct for this - * to not be 0. Bit 25 is Dual Role Data and looks - * correct for this to not be 0. - * 2. If Bits 31..30 are 11b - * -- Bits 29..28 are 00b (Programmable Power Supply) - * -- Bits 26..25 are 00b (Reserved) - * -- Bit 16 is 0b (Reserved) - * -- Bit 7 is 0b (Reserved) - * 3. PDOs are in the order of Fixed Supply Objects (if present), - * Battery Supply Objects (if present), Variable Supply Objects - * (if present) and then Programmable Power Supply Objects (if - * present). - * 4. Fixed Supply Objects (if present) are in voltage order; lowest - * to highest. - * 5. Battery Supply Objects (if present) are in Minimum Voltage - * order; lowest to highest. - * 6. Variable Supply Objects (if present) are in Minimum Voltage - * order; lowest to highest. - * 7. Programmable Power Supply Objects (if present) are in Maximum - * Voltage order; lowest to highest. - */ - for (i = 1; i < pd_cnt; ++i) { - int offset; - uint32_t voltage; - - offset = HEADER_BYTE_OFFSET + - HEADER_BYTE_CNT + - (i * PDO_BYTE_CNT); - pdo = UINT32_FROM_BYTE_ARRAY_LE(data, offset); - - type = pdo & PDO_TYPE_MASK; - if (type == PDO_TYPE_FIXED) { - TEST_EQ(pdo & (GENMASK(28, 26)|GENMASK(24, 22)), - 0, "%d"); - TEST_EQ(last_battery_voltage, 0, "%d"); - TEST_EQ(last_variable_voltage, 0, "%d"); - TEST_EQ(last_programmable_voltage, 0, "%d"); - voltage = PDO_FIXED_VOLTAGE(pdo); - TEST_GE(voltage, last_fixed_voltage, "%d"); - last_fixed_voltage = voltage; - } else if (type == PDO_TYPE_BATTERY) { - TEST_EQ(last_variable_voltage, 0, "%d"); - TEST_EQ(last_programmable_voltage, 0, "%d"); - voltage = PDO_BATT_MIN_VOLTAGE(pdo); - TEST_GE(voltage, last_battery_voltage, "%d"); - last_battery_voltage = voltage; - } else if (type == PDO_TYPE_VARIABLE) { - TEST_EQ(last_programmable_voltage, 0, "%d"); - voltage = PDO_VAR_MIN_VOLTAGE(pdo); - TEST_GE(voltage, last_variable_voltage, "%d"); - last_variable_voltage = voltage; - } else { - TEST_EQ(pdo & GENMASK(29, 28), 0, "%d"); - TEST_EQ(pdo & GENMASK(26, 25), 0, "%d"); - TEST_EQ(pdo & BIT(16), 0, "%d"); - TEST_EQ(pdo & BIT(7), 0, "%d"); - voltage = PDO_AUG_MAX_VOLTAGE(pdo); - TEST_GE(voltage, last_programmable_voltage, "%d"); - last_programmable_voltage = voltage; - } - } - - return EC_SUCCESS; -} diff --git a/test/usb_tcpmv2_td_pd_src3_e26.c b/test/usb_tcpmv2_td_pd_src3_e26.c deleted file mode 100644 index f5f5bcd3c4..0000000000 --- a/test/usb_tcpmv2_td_pd_src3_e26.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright 2020 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 "mock/tcpci_i2c_mock.h" -#include "task.h" -#include "tcpm/tcpci.h" -#include "test_util.h" -#include "timer.h" -#include "usb_tcpmv2_compliance.h" - -/***************************************************************************** - * TD.PD.SRC3.E26.Soft_Reset sent regardless of Rp value - * - * Description: - * As Consumer (UFP), the Tester forces the UUT to send Soft_Reset and - * verifies Soft_Reset is sent regardless of the Rp value is SinkTxOK or - * SinkTxNG. - */ -int test_td_pd_src3_e26(void) -{ - /* - * TD.PD.SRC3.E26.Soft_Reset sent regardless of Rp value - * a) Run PROC.PD.E1 Bring-up according to the UUT role. - * b) The Tester waits until it can start an AMS (Run PROC.PD.E3)... - */ - TEST_EQ(tcpci_startup(), EC_SUCCESS, "%d"); - TEST_EQ(proc_pd_e1(PD_ROLE_DFP, INITIAL_AND_ALREADY_ATTACHED), - EC_SUCCESS, "%d"); - TEST_EQ(proc_pd_e3(), EC_SUCCESS, "%d"); - - /* - * ...and sends a Get_Source_Cap message to the UUT. - */ - partner_send_msg(TCPCI_MSG_SOP, PD_CTRL_GET_SOURCE_CAP, 0, 0, NULL); - - /* - * c) Upon receipt of the Source_Capabilities Message, the Tester - * doesn’t reply with GoodCRC. - */ - TEST_EQ(verify_tcpci_transmit(TCPCI_MSG_SOP, 0, PD_DATA_SOURCE_CAP), - EC_SUCCESS, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_FAILED); - - /* - * d) The Tester verifies that a Soft_Reset message is sent by the UUT - * within tReceive max (1.1 ms) + tSoftReset max (15 ms). - */ - TEST_EQ(verify_tcpci_tx_timeout( - TCPCI_MSG_SOP, PD_CTRL_SOFT_RESET, 0, 15 * MSEC), - EC_SUCCESS, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - - return EC_SUCCESS; -} diff --git a/test/usb_tcpmv2_td_pd_src3_e32.c b/test/usb_tcpmv2_td_pd_src3_e32.c deleted file mode 100644 index 9ade7b83c8..0000000000 --- a/test/usb_tcpmv2_td_pd_src3_e32.c +++ /dev/null @@ -1,221 +0,0 @@ -/* Copyright 2021 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 "mock/tcpci_i2c_mock.h" -#include "task.h" -#include "tcpm/tcpci.h" -#include "test_util.h" -#include "timer.h" -#include "usb_tcpmv2_compliance.h" - -#define PD_T_CHUNK_RECEIVER_REQUEST_MAX (15 * MSEC) -#define PD_T_CHUNK_SENDER_RSP_MAX (30 * MSEC) -#define PD_T_CHUNKING_NOT_SUPPORTED_MIN (40 * MSEC) -#define PD_T_CHUNKING_NOT_SUPPORTED_MAX (50 * MSEC) - -static void setup_chunk_msg(int chunk, char *data) -{ - int i; - int base_msg_byte = chunk * PD_MAX_EXTENDED_MSG_CHUNK_LEN; - - *(uint16_t *)data = PD_EXT_HEADER(chunk, 0, - PD_MAX_EXTENDED_MSG_LEN); - - for (i = 0; i < PD_MAX_EXTENDED_MSG_CHUNK_LEN; ++i) { - int val = (i + base_msg_byte) % 256; - - data[i + sizeof(uint16_t)] = val; - } -} - -/***************************************************************************** - * TD.PD.SRC3.E32 ChunkSenderResponseTimer Timeout - * - * Description: - * As Consumer (UFP), the Tester verifies that the UUT recovers correctly - * after the Tester stops sending chunked messages in the middle. - */ -int test_td_pd_src3_e32(void) -{ - int chunk = 0; - int msg_len; - uint32_t header; - char data[PD_MAX_EXTENDED_MSG_CHUNK_LEN + sizeof(uint16_t)]; - - int found_index; - struct possible_tx possible[2]; - - uint64_t start_time; - - /* - * a) Run PROC.PD.E1 Bring-up according to the UUT role. The Tester - * sets Unchunked Extended Messages Supported set to 0 in Request - * message during this process. - * b) The Tester waits until it can start an AMS (Run PROC.PD.E3) - */ - TEST_EQ(tcpci_startup(), EC_SUCCESS, "%d"); - TEST_EQ(proc_pd_e1(PD_ROLE_DFP, INITIAL_AND_ALREADY_ATTACHED), - EC_SUCCESS, "%d"); - TEST_EQ(proc_pd_e3(), EC_SUCCESS, "%d"); - - /* - * ...and sends the first chunk of a chunked extended message - * to the UUT, with Data Size set to 260 and Message Type set - * to 11111b. Bytes 0 to 259 of data block contain - * incrementing values (mod 256) starting at 0x00. - */ - setup_chunk_msg(0, data); - partner_send_msg(TCPCI_MSG_SOP, 0x1F, 7, 1, (uint32_t *)data); - start_time = get_time().val; - - /* - * c) If a message is not received within tChunkingNotSupported - * max (50ms), this test fails. The delay is messaged from the - * time the last bit of the EOP of the chunk has been - * transmitted until the first bit of the response Message - * Preamble has been received. - */ - possible[0].tx_type = TCPCI_MSG_SOP; - possible[0].ctrl_msg = PD_CTRL_NOT_SUPPORTED; - possible[0].data_msg = 0; - - possible[1].tx_type = TCPCI_MSG_SOP; - possible[1].ctrl_msg = 0; - possible[1].data_msg = 0x1F; - - TEST_EQ(verify_tcpci_possible_tx(possible, - 2, - &found_index, - data, - sizeof(data), - &msg_len, - PD_T_CHUNKING_NOT_SUPPORTED_MAX), - EC_SUCCESS, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - - /* - * d) If the received message is Not_Supported, the Tester verifies - * the message is received after tChunkingNotSupported min (40ms) - * and stops here. - */ - if (found_index == 0) { - TEST_ASSERT((get_time().val - start_time) >= - PD_T_CHUNKING_NOT_SUPPORTED_MIN); - return EC_SUCCESS; - } - TEST_EQ(found_index, 1, "%d"); - - /* - * e) If the message is not received within - * tChunkReceiverRequest max (15ms), the test fails. - */ - TEST_ASSERT((get_time().val - start_time) <= - PD_T_CHUNK_RECEIVER_REQUEST_MAX); - - while (chunk < 4) { - int next_chunk; - - /* - * f) Upon receipt of the message from the UUT to request for - * the next chunk, the Tester sends the requested chunk to the - * UUT. - */ - header = *(uint16_t *)&data[3]; - next_chunk = PD_EXT_HEADER_CHUNK_NUM(header); - TEST_EQ(chunk + 1, next_chunk, "%d"); - chunk = next_chunk; - - setup_chunk_msg(chunk, data); - partner_send_msg(TCPCI_MSG_SOP, 0x1F, 7, 1, (uint32_t *)data); - - TEST_EQ(verify_tcpci_tx_with_data(TCPCI_MSG_SOP, - 0x1F, - data, - sizeof(data), - &msg_len, - PD_T_CHUNK_RECEIVER_REQUEST_MAX), - EC_SUCCESS, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - - /* - * g) Repeat f) until the Tester has finished sending 4 chunks - * and intentionally does not send the 5th chunk to the UUT. - */ - } - - /* - * h) The Tester waits for tChunkSenderResponse max + 5 ms, waits until - * it can start an AMS (Run PROC.PD.E3) and sends the first chunk to - * the UUT. - */ - task_wait_event(PD_T_CHUNK_SENDER_RSP_MAX + (5 * MSEC)); - - setup_chunk_msg(0, data); - partner_send_msg(TCPCI_MSG_SOP, 0x1F, 7, 1, (uint32_t *)data); - - /* - * i) If a message is not received within tChunkReceiverRequest max, - * the test fails. - */ - TEST_EQ(verify_tcpci_tx_with_data(TCPCI_MSG_SOP, - 0x1F, - data, - sizeof(data), - &msg_len, - PD_T_CHUNK_RECEIVER_REQUEST_MAX), - EC_SUCCESS, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - - /* - * j) Upon receipt of the message, the Tester verifies the following: - * 1. For Message Header - * ï€ Extended = 1 - * Number of Data Objects = 1 - * ï€ Port Power Role field = 1b (Source) - * ï€ Port Data Role field = 1b (DFP) - * ï€ Specification Revision = 10b (Rev 3.0) - * ï€ Message Type = 11111b - */ - TEST_EQ(msg_len, 7, "%d"); - header = *(uint32_t *)&data[1]; - TEST_EQ(PD_HEADER_EXT(header), 1, "%d"); - TEST_EQ(PD_HEADER_CNT(header), 1, "%d"); - TEST_EQ(PD_HEADER_PROLE(header), 1, "%d"); - TEST_EQ(PD_HEADER_DROLE(header), 1, "%d"); - TEST_EQ(PD_HEADER_REV(header), PD_REV30, "%d"); - TEST_EQ(PD_HEADER_TYPE(header), 0x1F, "%d"); - - /* - * 2. For Extended Message Header - * ï€ Chunked = 1 - * ï€ Chunk Number = 1 - * ï€ Request Chunk = 1 - * ï€ Bit 9 = 0 (Reserved) - * ï€ Data Size = 0 - */ - header = *(uint16_t *)&data[3]; - TEST_EQ(PD_EXT_HEADER_CHUNKED(header), 1, "%d"); - TEST_EQ(PD_EXT_HEADER_CHUNK_NUM(header), 1, "%d"); - TEST_EQ(PD_EXT_HEADER_REQ_CHUNK(header), 1, "%d"); - TEST_EQ(header & BIT(9), 0, "%d"); - TEST_EQ(PD_EXT_HEADER_DATA_SIZE(header), 0, "%d"); - - /* - * 3. The total number of data bytes is consistent with the - * Number of Data Objects field - */ - header = *(uint32_t *)&data[1]; - TEST_EQ(msg_len - 3, - PD_HEADER_CNT(header) * 4, - "%d"); - - /* - * 4. The last 2 bytes of the Data Object are 0 - */ - TEST_EQ(data[5], 0, "%d"); - TEST_EQ(data[6], 0, "%d"); - - return EC_SUCCESS; -} diff --git a/test/usb_tcpmv2_td_pd_src3_e7.c b/test/usb_tcpmv2_td_pd_src3_e7.c deleted file mode 100644 index 409d0d6b80..0000000000 --- a/test/usb_tcpmv2_td_pd_src3_e7.c +++ /dev/null @@ -1,139 +0,0 @@ -/* Copyright 2021 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 "battery.h" -#include "mock/tcpci_i2c_mock.h" -#include "task.h" -#include "driver/tcpm/tcpci.h" -#include "test_util.h" -#include "timer.h" -#include "usb_tcpmv2_compliance.h" -#include "usb_tc_sm.h" - -#define BUFFER_SIZE 100 - -#define HEADER_BYTE_OFFSET 1 -#define HEADER_BYTE_CNT 2 -#define SRC_CAP_EXT_NUM_BATTERY_OFFSET 22 - -#define EXT_MSG_CHUNKED BIT(15) -#define EXT_MSG_DATA_SIZE_1 1 -#define GBSDB_FIXED_BATTERY_0 (0 << 16) - - -static int number_of_fixed_batteries(void) -{ - return CONFIG_NUM_FIXED_BATTERIES; -} - -static int number_of_swappable_batteries(void) -{ - return 0; -} - -/***************************************************************************** - * TD.PD.SRC3.E7 Battery Status sent timely - * - * Description: - * As Consumer (UFP), the Tester verifies that the UUT replies - * Get_Battery_Status message with a Battery_Status message timely. - */ -int test_td_pd_src3_e7(void) -{ - int msg_len; - uint8_t data[BUFFER_SIZE]; - uint32_t ext_msg; - - int found_index; - struct possible_tx possible[2]; - - TEST_EQ(tcpci_startup(), EC_SUCCESS, "%d"); - - /* - * a) Run PROC.PD.E1 Bring-up according to the UUT role. - */ - TEST_EQ(proc_pd_e1(PD_ROLE_DFP, INITIAL_AND_ALREADY_ATTACHED), - EC_SUCCESS, "%d"); - - /* - * b) The Tester waits until it can start an AMS (Run PROC.PD.E3) and - * sends a Get_Source_Cap_Extended message to the UUT. - */ - TEST_EQ(proc_pd_e3(), EC_SUCCESS, "%d"); - - partner_send_msg(TCPCI_MSG_SOP, PD_CTRL_GET_SOURCE_CAP_EXT, 0, 0, NULL); - - /* - * c) If a Not_Supported message is received, and Num_Fixed_Batteries - * and Num_Swappable_Battery_Slots in the VIF are 0, the test - * passes and stops here. - */ - possible[0].tx_type = TCPCI_MSG_SOP; - possible[0].ctrl_msg = PD_CTRL_NOT_SUPPORTED; - possible[0].data_msg = 0; - - possible[1].tx_type = TCPCI_MSG_SOP; - possible[1].ctrl_msg = 0; - possible[1].data_msg = PD_EXT_SOURCE_CAP; - - TEST_EQ(verify_tcpci_possible_tx(possible, - 2, - &found_index, - data, - sizeof(data), - &msg_len, - 0), - EC_SUCCESS, "%d"); - if (found_index == 0) { - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - task_wait_event(10 * MSEC); - - if (number_of_fixed_batteries() == 0 && - number_of_swappable_batteries() == 0) - return EC_SUCCESS; - } - /* - * d) If the Number of Batteries/Battery Slots field in the returned - * Source_Capabilities_Extended message is 0, the test passes and - * stops here. - */ - else { - TEST_EQ(found_index, 1, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - task_wait_event(10 * MSEC); - - if (data[HEADER_BYTE_OFFSET + - HEADER_BYTE_CNT + - SRC_CAP_EXT_NUM_BATTERY_OFFSET] == 0) - return EC_SUCCESS; - } - - /* - * e) The Tester waits until it can start an AMS (Run PROC.PD.E3) and - * sends a Get_Battery_Status message to the UUT - */ - ext_msg = EXT_MSG_CHUNKED | - EXT_MSG_DATA_SIZE_1 | - GBSDB_FIXED_BATTERY_0; - partner_send_msg(TCPCI_MSG_SOP, PD_EXT_GET_BATTERY_STATUS, 1, 1, - &ext_msg); - - /* - * f) If a Battery_Status message is not received within - * tReceiverResponse max, the test fails. This delay is measured - * from the time the last bit of Get_Battery_Status message EOP has - * been transmitted to the time the first bit of the Battery_Status - * message preamble has been received. - */ - TEST_EQ(verify_tcpci_tx_timeout(TCPCI_MSG_SOP, - 0, - PD_DATA_BATTERY_STATUS, - (15 * MSEC)), - EC_SUCCESS, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - task_wait_event(10 * MSEC); - - return EC_SUCCESS; -} diff --git a/test/usb_tcpmv2_td_pd_src3_e8.c b/test/usb_tcpmv2_td_pd_src3_e8.c deleted file mode 100644 index dee52f1753..0000000000 --- a/test/usb_tcpmv2_td_pd_src3_e8.c +++ /dev/null @@ -1,251 +0,0 @@ -/* Copyright 2021 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 "battery.h" -#include "mock/tcpci_i2c_mock.h" -#include "task.h" -#include "driver/tcpm/tcpci.h" -#include "test_util.h" -#include "timer.h" -#include "usb_tcpmv2_compliance.h" -#include "usb_tc_sm.h" - -#define BUFFER_SIZE 100 - -#define EXT_MSG_CHUNKED BIT(15) -#define EXT_MSG_DATA_SIZE_1 1 - -#define HEADER_BYTE_OFFSET 1 -#define HEADER_NUM_BYTES 2 - -#define SCEDB_NUM_BATTERY_OFFSET 22 -#define SCEDB_NUM_BYTES 24 - -#define BSDO_NUM_BYTES 4 -#define BSDO_INV_BATTERY_REF(bsdo) (((bsdo) >> 8) & 1) -#define BSDO_BATTERY_PRESENT(bsdo) (((bsdo) >> 9) & 1) -#define BSDO_BATTERY_CHRG_STS(bsdo) (((bsdo) >> 10) & 3) -#define BSDO_BATTERY_INFO(bsdo) (((bsdo) >> 8) & 0xFF) - -static int number_of_fixed_batteries(void) -{ - return CONFIG_NUM_FIXED_BATTERIES; -} - -static int number_of_swappable_batteries(void) -{ - return 0; -} - -/***************************************************************************** - * TD.PD.SRC3.E8 Battery Status Field Checks - * - * Description: - * As Consumer (UFP), the Tester sends a Get_Battery_Status message to - * the UUT, verifies the UUT respond with a Battery_Status or - * Not_Supported message. If a Battery_Status message is received, the - * Tester verifies correct field values. - */ -int test_td_pd_src3_e8(void) -{ - int msg_len; - uint8_t data[BUFFER_SIZE]; - uint32_t ext_msg; - int num_fixed_batteries; - int num_swappable_battery_slots; - - int ref; - int found_index; - struct possible_tx possible[2]; - - TEST_EQ(tcpci_startup(), EC_SUCCESS, "%d"); - - /* - * a) Run PROC.PD.E1 Bring-up according to the UUT role. - */ - TEST_EQ(proc_pd_e1(PD_ROLE_DFP, INITIAL_AND_ALREADY_ATTACHED), - EC_SUCCESS, "%d"); - - /* - * b) The Tester waits until it can start an AMS (Run PROC.PD.E3) and - * sends a Get_Source_Cap_Extended message to the UUT. - */ - TEST_EQ(proc_pd_e3(), EC_SUCCESS, "%d"); - - partner_send_msg(TCPCI_MSG_SOP, PD_CTRL_GET_SOURCE_CAP_EXT, 0, 0, NULL); - - /* - * c) If a Source_Capabilities_Extended message is received, the - * Tester record the Number of Batteries/Battery Slots field. - */ - possible[0].tx_type = TCPCI_MSG_SOP; - possible[0].ctrl_msg = PD_CTRL_NOT_SUPPORTED; - possible[0].data_msg = 0; - - possible[1].tx_type = TCPCI_MSG_SOP; - possible[1].ctrl_msg = 0; - possible[1].data_msg = PD_EXT_SOURCE_CAP; - - TEST_EQ(verify_tcpci_possible_tx(possible, - 2, - &found_index, - data, - sizeof(data), - &msg_len, - 0), - EC_SUCCESS, "%d"); - if (found_index == 1) { - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - task_wait_event(10 * MSEC); - - TEST_EQ(msg_len, HEADER_BYTE_OFFSET + - HEADER_NUM_BYTES + - SCEDB_NUM_BYTES, - "%d"); - - num_fixed_batteries = - data[HEADER_BYTE_OFFSET + - HEADER_NUM_BYTES + - SCEDB_NUM_BATTERY_OFFSET] & - 0x0F; - num_swappable_battery_slots = - (data[HEADER_BYTE_OFFSET + - HEADER_NUM_BYTES + - SCEDB_NUM_BATTERY_OFFSET] >> 4) & - 0x0F; - } - /* - * If a Not_Supported message is received, the Tester reads the - * Number of Batteries/Battery Slots field (combine - * Num_Fixed_Batteries and Num_Swappable_Battery_Slots) from the - * VIF. - */ - else { - TEST_EQ(found_index, 0, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - task_wait_event(10 * MSEC); - - num_fixed_batteries = number_of_fixed_batteries(); - num_swappable_battery_slots = number_of_swappable_batteries(); - } - - /* - * d) The Tester waits until it can start an AMS (Run PROC.PD.E3) and - * sends a Get_Battery_Status message to the UUT, with Battery - * Status Ref set to 0 (step g includes doing d-f with Battery - * Status Ref set to 1 - 7). - */ - for (ref = 0; ref <= 7; ++ref) { - uint16_t header; - uint32_t bsdo; - - ext_msg = EXT_MSG_CHUNKED | EXT_MSG_DATA_SIZE_1 | - (ref << 16); - partner_send_msg(TCPCI_MSG_SOP, PD_EXT_GET_BATTERY_STATUS, 1, 1, - &ext_msg); - - /* - * e) If a Battery_Status message is received, the Tester - * verifies: - */ - TEST_EQ(verify_tcpci_tx_with_data(TCPCI_MSG_SOP, - PD_DATA_BATTERY_STATUS, - data, - sizeof(data), - &msg_len, - 0), - EC_SUCCESS, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - task_wait_event(10 * MSEC); - TEST_EQ(msg_len, HEADER_BYTE_OFFSET + - HEADER_NUM_BYTES + - BSDO_NUM_BYTES, - "%d"); - - /* - * 1. Number of Data Objects field = 001b - */ - header = UINT16_FROM_BYTE_ARRAY_LE(data, HEADER_BYTE_OFFSET); - TEST_EQ(PD_HEADER_CNT(header), 1, "%d"); - - /* - * 2. Port Power Role field = 1b (Source) - */ - TEST_EQ(PD_HEADER_PROLE(header), 1, "%d"); - - /* - * 3. Specification Revision field = 10b (Rev 3.0) - */ - TEST_EQ(PD_HEADER_REV(header), PD_REV30, "%d"); - - /* - * 4. Port Data Role field = 1b (DFP) - */ - TEST_EQ(PD_HEADER_DROLE(header), PD_ROLE_DFP, "%d"); - - /* - * 5. Extended = 0b - */ - TEST_EQ(PD_HEADER_EXT(header), 0, "%d"); - - /* - * 6. Invalid Battery Reference field (Bit 0) of the - * Battery Info field in the BSDO matches with the - * recorded Number of Batteries/Battery Slots field - * 7. If Battery Status Ref referred to a fixed battery - * and Invalid Battery Reference field is 0, the Battery - * is present field (Bit 1) shall be 1 - * 8. If Invalid Battery Reference field is 1, Battery is - * present field shall be 0 - */ - bsdo = UINT32_FROM_BYTE_ARRAY_LE(data, HEADER_BYTE_OFFSET + - HEADER_NUM_BYTES); - - /* FIXED BATTERY */ - if (ref < 4) { - if (ref < num_fixed_batteries) { - TEST_EQ(BSDO_INV_BATTERY_REF(bsdo), - 0, "%d"); - TEST_EQ(BSDO_BATTERY_PRESENT(bsdo), - 1, "%d"); - } else { - TEST_EQ(BSDO_INV_BATTERY_REF(bsdo), - 1, "%d"); - TEST_EQ(BSDO_BATTERY_PRESENT(bsdo), - 0, "%d"); - } - } - /* BATTERY SLOT */ - else { - if ((ref - 4) < num_swappable_battery_slots) { - TEST_EQ(BSDO_INV_BATTERY_REF(bsdo), - 0, "%d"); - } else { - TEST_EQ(BSDO_INV_BATTERY_REF(bsdo), - 1, "%d"); - TEST_EQ(BSDO_BATTERY_PRESENT(bsdo), - 0, "%d"); - } - } - - /* - * 9. If Battery is present, Battery charging status - * (Bits 3..2) of Battery Info field is not 11b - * 10. If Battery is not present, Bits 3..2 of Battery Info - * field is 00b - * 11. Bits 7..4 of Battery Info field are 0 - * 12. Bits 7..0 of the BSDO are 0 - */ - if (BSDO_BATTERY_PRESENT(bsdo)) - TEST_NE(BSDO_BATTERY_CHRG_STS(bsdo), 3, "%d"); - else - TEST_EQ(BSDO_BATTERY_CHRG_STS(bsdo), 0, "%d"); - - TEST_EQ(BSDO_BATTERY_INFO(bsdo) & GENMASK(7, 4), 0, "%d"); - TEST_EQ(bsdo & GENMASK(7, 0), 0, "%d"); - } - - return EC_SUCCESS; -} diff --git a/test/usb_tcpmv2_td_pd_src3_e9.c b/test/usb_tcpmv2_td_pd_src3_e9.c deleted file mode 100644 index faeed0922d..0000000000 --- a/test/usb_tcpmv2_td_pd_src3_e9.c +++ /dev/null @@ -1,226 +0,0 @@ -/* Copyright 2021 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 "battery.h" -#include "mock/tcpci_i2c_mock.h" -#include "task.h" -#include "driver/tcpm/tcpci.h" -#include "test_util.h" -#include "timer.h" -#include "usb_tcpmv2_compliance.h" -#include "usb_tc_sm.h" - -#define BUFFER_SIZE 100 - -#define EXT_MSG_CHUNKED BIT(15) -#define EXT_MSG_DATA_SIZE_1 1 - -#define HEADER_BYTE_OFFSET 1 -#define HEADER_NUM_BYTES 2 - -#define SCEDB_NUM_BATTERY_OFFSET 22 -#define SCEDB_NUM_BYTES 24 - -#define BSDO_INV_BATTERY_REF(bsdo) (((bsdo) >> 8) & 1) -#define BSDO_BATTERY_INFO(bsdo) (((bsdo) >> 8) & 0xFF) - -static int number_of_fixed_batteries(void) -{ - return CONFIG_NUM_FIXED_BATTERIES; -} - -static int number_of_swappable_batteries(void) -{ - return 0; -} - -/***************************************************************************** - * TD.PD.SRC3.E9 Battery Status Fields Checks - Invalid Battery reference - * - * Description: - * As Consumer (UFP), the Tester sends a Get_Battery_Status message with - * an invalid battery reference to the UUT, waits for a Battery_Status - * message from the Provider (DFP, UUT) and verifies correct field values. - */ -int test_td_pd_src3_e9(void) -{ - int msg_len; - uint8_t data[BUFFER_SIZE]; - uint32_t ext_msg; - int num_fixed_batteries; - int num_swappable_battery_slots; - - int ref; - int found_index; - struct possible_tx possible[2]; - - TEST_EQ(tcpci_startup(), EC_SUCCESS, "%d"); - - /* - * a) Run PROC.PD.E1 Bring-up according to the UUT role. - */ - TEST_EQ(proc_pd_e1(PD_ROLE_DFP, INITIAL_AND_ALREADY_ATTACHED), - EC_SUCCESS, "%d"); - - /* - * b) The Tester waits until it can start an AMS (Run PROC.PD.E3) and - * sends a Get_Source_Cap_Extended message to the UUT. - */ - TEST_EQ(proc_pd_e3(), EC_SUCCESS, "%d"); - - partner_send_msg(TCPCI_MSG_SOP, PD_CTRL_GET_SOURCE_CAP_EXT, 0, 0, NULL); - - /* - * c) If a Source_Capabilities_Extended message is received, the - * Tester record the Number of Batteries/Battery Slots field. - */ - possible[0].tx_type = TCPCI_MSG_SOP; - possible[0].ctrl_msg = PD_CTRL_NOT_SUPPORTED; - possible[0].data_msg = 0; - - possible[1].tx_type = TCPCI_MSG_SOP; - possible[1].ctrl_msg = 0; - possible[1].data_msg = PD_EXT_SOURCE_CAP; - - TEST_EQ(verify_tcpci_possible_tx(possible, - 2, - &found_index, - data, - sizeof(data), - &msg_len, - 0), - EC_SUCCESS, "%d"); - if (found_index == 1) { - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - task_wait_event(10 * MSEC); - - TEST_EQ(msg_len, HEADER_BYTE_OFFSET + - HEADER_NUM_BYTES + - SCEDB_NUM_BYTES, - "%d"); - - num_fixed_batteries = - data[HEADER_BYTE_OFFSET + - HEADER_NUM_BYTES + - SCEDB_NUM_BATTERY_OFFSET] & - 0x0F; - num_swappable_battery_slots = - (data[HEADER_BYTE_OFFSET + - HEADER_NUM_BYTES + - SCEDB_NUM_BATTERY_OFFSET] >> 4) & - 0x0F; - } - /* - * If a Not_Supported message is received, the Tester reads the - * Number of Batteries/Battery Slots field (combine - * Num_Fixed_Batteries and Num_Swappable_Battery_Slots) from the - * VIF. - */ - else { - TEST_EQ(found_index, 0, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - task_wait_event(10 * MSEC); - - num_fixed_batteries = number_of_fixed_batteries(); - num_swappable_battery_slots = number_of_swappable_batteries(); - } - - /* - * d) The Tester waits until it can start an AMS (Run PROC.PD.E3) and - * sends a Get_Battery_Status message, with Battery Status Ref set - * to 8, to the UUT. - */ - ref = 8; - ext_msg = EXT_MSG_CHUNKED | EXT_MSG_DATA_SIZE_1 | - (ref << 16); - partner_send_msg(TCPCI_MSG_SOP, PD_EXT_GET_BATTERY_STATUS, 1, 1, - &ext_msg); - - /* - * e) If a Not_Supported message is received, and - * 1. If the recorded Number of Batteries/Battery Slots field is 0, - * the test passes and stops here. - * 2. If the recorded Number of Batteries/Battery Slots field is - * not 0, the test fails. - */ - possible[0].tx_type = TCPCI_MSG_SOP; - possible[0].ctrl_msg = PD_CTRL_NOT_SUPPORTED; - possible[0].data_msg = 0; - - possible[1].tx_type = TCPCI_MSG_SOP; - possible[1].ctrl_msg = 0; - possible[1].data_msg = PD_DATA_BATTERY_STATUS; - - TEST_EQ(verify_tcpci_possible_tx(possible, - 2, - &found_index, - data, - sizeof(data), - &msg_len, - 0), - EC_SUCCESS, "%d"); - if (found_index == 0) { - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - task_wait_event(10 * MSEC); - - TEST_EQ(num_fixed_batteries, 0, "%d"); - TEST_EQ(num_swappable_battery_slots, 0, "%d"); - return EC_SUCCESS; - } - /* - * f) Upon receipt of the Battery_Status message, the Tester verifies: - */ - else { - uint16_t header; - uint32_t bsdo; - - TEST_EQ(found_index, 1, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - task_wait_event(10 * MSEC); - - /* - * 1. Number of Data Objects field = 001b - */ - header = UINT16_FROM_BYTE_ARRAY_LE(data, HEADER_BYTE_OFFSET); - TEST_EQ(PD_HEADER_CNT(header), 1, "%d"); - - /* - * 2. Port Power Role field = 1b (Source) - */ - TEST_EQ(PD_HEADER_PROLE(header), 1, "%d"); - - /* - * 3. Specification Revision field = 10b (Rev 3.0) - */ - TEST_EQ(PD_HEADER_REV(header), PD_REV30, "%d"); - - /* - * 4. Port Data Role field = 1b (DFP) - */ - TEST_EQ(PD_HEADER_DROLE(header), PD_ROLE_DFP, "%d"); - - /* - * 5. Extended = 0b - */ - TEST_EQ(PD_HEADER_EXT(header), 0, "%d"); - - /* - * 6. Invalid Battery Reference field (Bit 0) of the - * Battery Info field in the BSDO is 1 - */ - bsdo = UINT32_FROM_BYTE_ARRAY_LE(data, HEADER_BYTE_OFFSET + - HEADER_NUM_BYTES); - TEST_EQ(BSDO_INV_BATTERY_REF(bsdo), 1, "%d"); - - /* - * 7. Bits 7..1 of Battery Info field in the BSDO are 0 - * 8. Bits 7..0 of the BSDO are 0 - */ - TEST_EQ(BSDO_BATTERY_INFO(bsdo) & GENMASK(7, 1), 0, "%d"); - TEST_EQ(bsdo & GENMASK(7, 0), 0, "%d"); - } - - return EC_SUCCESS; -} diff --git a/test/usb_tcpmv2_td_pd_src_e1.c b/test/usb_tcpmv2_td_pd_src_e1.c deleted file mode 100644 index a617f90ca2..0000000000 --- a/test/usb_tcpmv2_td_pd_src_e1.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright 2020 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 "mock/tcpci_i2c_mock.h" -#include "task.h" -#include "tcpm/tcpci.h" -#include "test_util.h" -#include "timer.h" -#include "usb_tcpmv2_compliance.h" -#include "usb_tc_sm.h" - -/***************************************************************************** - * TD.PD.SRC.E1 Source Capabilities sent timely - * - * Description: - * As Consumer (UFP), the Tester verifies a Source Capabilities message - * from the Provider (DFP, UUT) is received timely - */ -int test_td_pd_src_e1(void) -{ - partner_set_pd_rev(PD_REV20); - - TEST_EQ(tcpci_startup(), EC_SUCCESS, "%d"); - - /* - * a) Run PROC.PD.E1 Bring-up according to the UUT role. - * - * NOTE: Calling PROC.PD.E1 with INITIAL_ATTACH will stop just before - * the PD_DATA_SOURCE_CAP is verified. We need to stop the process - * there to use the timeout verify. - */ - TEST_EQ(proc_pd_e1(PD_ROLE_DFP, INITIAL_ATTACH), EC_SUCCESS, "%d"); - - /* - * b) The test fails if the first bit of a Source Capabilities message - * is not received from the Provider within 250 ms (tFirstSourceCap - * max) after VBus present. - */ - TEST_EQ(verify_tcpci_tx_timeout(TCPCI_MSG_SOP, 0, - PD_DATA_SOURCE_CAP, - 250 * MSEC), - EC_SUCCESS, "%d"); - - return EC_SUCCESS; -} diff --git a/test/usb_tcpmv2_td_pd_src_e2.c b/test/usb_tcpmv2_td_pd_src_e2.c deleted file mode 100644 index f0e1b64c7e..0000000000 --- a/test/usb_tcpmv2_td_pd_src_e2.c +++ /dev/null @@ -1,163 +0,0 @@ -/* Copyright 2020 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 "mock/tcpci_i2c_mock.h" -#include "task.h" -#include "tcpm/tcpci.h" -#include "test_util.h" -#include "timer.h" -#include "usb_tcpmv2_compliance.h" -#include "usb_tc_sm.h" - -#define BUFFER_SIZE 100 - -#define HEADER_BYTE_OFFSET 1 -#define HEADER_BYTE_CNT 2 -#define PDO_BYTE_CNT 4 - -enum pd_revision { - REVISION_1 = 0, - REVISION_2 = 1, - REVISION_3 = 2, - REVISION_RESERVED = 3 -}; - -/***************************************************************************** - * TD.PD.SRC.E2 Source Capabilities Fields Checks - * - * Description: - * As Consumer (UFP), the Tester waits for a Source Capabilities message - * from the Provider (DFP,UUT) and verifies correct field values. - */ -int test_td_pd_src_e2(void) -{ - int i; - int msg_len; - uint8_t data[BUFFER_SIZE]; - uint16_t header; - uint16_t revision; - uint16_t pd_cnt; - uint32_t pdo; - uint32_t type; - uint32_t last_fixed_voltage = 0; - uint32_t last_battery_voltage = 0; - uint32_t last_variable_voltage = 0; - - partner_set_pd_rev(PD_REV20); - - TEST_EQ(tcpci_startup(), EC_SUCCESS, "%d"); - - /* - * a) Run PROC.PD.E1 Bring-up according to the UUT role. - * - * NOTE: Calling PROC.PD.E1 with INITIAL_ATTACH will stop just before - * the PD_DATA_SOURCE_CAP is verified. We need to stop the process - * there to gather the actual message data. - */ - TEST_EQ(proc_pd_e1(PD_ROLE_DFP, INITIAL_ATTACH), EC_SUCCESS, "%d"); - - /* - * b) Upon receipt of the Source Capabilities message from the - * Provider, if the Specification Revision field is 10b - * (Rev 3.0), the test passes and stops here, - */ - TEST_EQ(verify_tcpci_tx_with_data(TCPCI_MSG_SOP, - PD_DATA_SOURCE_CAP, - data, - sizeof(data), - &msg_len, - 0), - EC_SUCCESS, "%d"); - TEST_GE(msg_len, HEADER_BYTE_CNT, "%d"); - - header = UINT16_FROM_BYTE_ARRAY_LE(data, HEADER_BYTE_OFFSET); - revision = PD_HEADER_REV(header); - if (revision == REVISION_3) - return EC_SUCCESS; - - /* - * otherwise the Tester verifies: - * 1. Number of Data Objects field equals the number of Src_PDOs - * in the message and is not 000b. - * 2. Port Power Role field = 1b (Source) - * 3. Specification Revision field = 01b (Rev 2.0) - * 4. Port Data Role field = 1b (DFP) - * 5. Message Type field = 0001b (Source Capabilities) - * 6. Bit 15 = 0b (Reserved) - * 7. Bit 4 = 0b (Reserved) - */ - pd_cnt = PD_HEADER_CNT(header); - TEST_NE(pd_cnt, 0, "%d"); - TEST_EQ(msg_len, HEADER_BYTE_CNT + (pd_cnt * PDO_BYTE_CNT) + 1, "%d"); - TEST_EQ(PD_HEADER_PROLE(header), PD_ROLE_SOURCE, "%d"); - TEST_EQ(revision, REVISION_2, "%d"); - TEST_EQ(PD_HEADER_DROLE(header), PD_ROLE_DFP, "%d"); - TEST_EQ(PD_HEADER_TYPE(header), PD_DATA_SOURCE_CAP, "%d"); - TEST_EQ(header & (BIT(4)|BIT(15)), 0, "%d"); - - /* - * c) For the first PDO, the Tester verifies: - * 1. Bits 31..30 (PDO type) are 00b (Fixed Supply). - * 2. Voltage field = 100 (5 V) - * 3. Bits 24..22 = 000b (Reserved) - */ - pdo = UINT32_FROM_BYTE_ARRAY_LE(data, HEADER_BYTE_OFFSET + - HEADER_BYTE_CNT); - - type = pdo & PDO_TYPE_MASK; - TEST_EQ(type, PDO_TYPE_FIXED, "%d"); - - last_fixed_voltage = PDO_FIXED_VOLTAGE(pdo); - TEST_EQ(last_fixed_voltage, 5000, "%d"); - TEST_EQ(pdo & GENMASK(24, 22), 0, "%d"); - - /* - * d) For the other PDOs (if any), the Tester verifies: - * 1. Bits 31..30 (PDO type) are 00b (Fixed Supply), 01b (Battery), - * or 10b (Variable Supply). - * 2. If Bits 31..30 are 00b, Bits 29..22 are set to 0. - * 3. PDOs are in the order of Fixed Supply Objects (if present), - * Battery Supply Objects (if present) and then Variable Supply - * Objects (if present). - * 4. Fixed Supply Objects (if present) are in voltage order; lowest - * to highest. - * 5. Battery Supply Objects (if present) are in Minimum Voltage - * order; lowest to highest. - * 6. Variable Supply Objects (if present) are in Minimum Voltage - * order; lowest to highest. - */ - for (i = 1; i < pd_cnt; ++i) { - int offset; - uint32_t voltage; - - offset = HEADER_BYTE_OFFSET + - HEADER_BYTE_CNT + - (i * PDO_BYTE_CNT); - pdo = UINT32_FROM_BYTE_ARRAY_LE(data, offset); - - type = pdo & PDO_TYPE_MASK; - TEST_NE(type, PDO_TYPE_AUGMENTED, "%d"); - - if (type == PDO_TYPE_FIXED) { - TEST_EQ(pdo & GENMASK(29, 22), 0, "%d"); - TEST_EQ(last_battery_voltage, 0, "%d"); - TEST_EQ(last_variable_voltage, 0, "%d"); - voltage = PDO_FIXED_VOLTAGE(pdo); - TEST_GE(voltage, last_fixed_voltage, "%d"); - last_fixed_voltage = voltage; - } else if (type == PDO_TYPE_BATTERY) { - TEST_EQ(last_variable_voltage, 0, "%d"); - voltage = PDO_BATT_MIN_VOLTAGE(pdo); - TEST_GE(voltage, last_battery_voltage, "%d"); - last_battery_voltage = voltage; - } else { - voltage = PDO_VAR_MIN_VOLTAGE(pdo); - TEST_GE(voltage, last_variable_voltage, "%d"); - last_variable_voltage = voltage; - } - } - - return EC_SUCCESS; -} diff --git a/test/usb_tcpmv2_td_pd_src_e5.c b/test/usb_tcpmv2_td_pd_src_e5.c deleted file mode 100644 index eac1b93e8f..0000000000 --- a/test/usb_tcpmv2_td_pd_src_e5.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright 2020 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 "mock/tcpci_i2c_mock.h" -#include "task.h" -#include "tcpm/tcpci.h" -#include "test_util.h" -#include "timer.h" -#include "usb_tcpmv2_compliance.h" -#include "usb_tc_sm.h" - -/***************************************************************************** - * TD.PD.SRC.E5 SenderResponseTimer Timeout - Request - * - * Description: - * As Consumer (UFP), the Tester intentionally does not send the Request - * message, which is intended to cause a SenderResponseTimer timeout on - * the Provider (DFP, UUT). The Tester verifies correct implementation - * of this timer - */ -int test_td_pd_src_e5(void) -{ - uint64_t end_time; - - partner_set_pd_rev(PD_REV20); - - TEST_EQ(tcpci_startup(), EC_SUCCESS, "%d"); - - /* - * a) Run PROC.PD.E1 Bring-up according to the UUT role. - * - * NOTE: Calling PROC.PD.E1 with INITIAL_ATTACH will stop just before - * the PD_DATA_SOURCE_CAP is verified. We need to stop the process - * there to stop the REQUEST message. - */ - TEST_EQ(proc_pd_e1(PD_ROLE_DFP, INITIAL_ATTACH), EC_SUCCESS, "%d"); - - /* - * b) Upon receipt of the Source Capabilities message from the - * Provider, the Tester replies with a GoodCRC message. - */ - TEST_EQ(verify_tcpci_transmit(TCPCI_MSG_SOP, 0, PD_DATA_SOURCE_CAP), - EC_SUCCESS, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - - /* Save time GoodCRC was sent */ - end_time = get_time().val; - - /* - * c) The Tester intentionally does not send a Request message and - * waits for a Hard Reset. - */ - - /* - * d) If a Hard Reset is not detected within 30 ms from the time the - * last bit of the GoodCRC message EOP has been sent, the test - * fails. - * e) If a Hard Reset is detected before 24 ms from the time the - * last bit of the GoodCRC message EOP has been sent, the test - * fails. - */ - end_time += 24 * MSEC; - while (get_time().val < end_time) { - TEST_NE(mock_tcpci_get_reg(TCPC_REG_TRANSMIT), - TCPCI_MSG_TX_HARD_RESET, "%d"); - task_wait_event(1 * MSEC); - } - - end_time += 6 * MSEC; - while (get_time().val < end_time) { - if (mock_tcpci_get_reg(TCPC_REG_TRANSMIT) == - TCPCI_MSG_TX_HARD_RESET) - break; - task_wait_event(1 * MSEC); - } - TEST_EQ(mock_tcpci_get_reg(TCPC_REG_TRANSMIT), - TCPCI_MSG_TX_HARD_RESET, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS | TCPC_REG_ALERT_TX_FAILED); - mock_tcpci_set_reg(TCPC_REG_TRANSMIT, 0); - task_wait_event(1 * MSEC); - - return EC_SUCCESS; -} diff --git a/test/usb_tcpmv2_td_pd_vndi3_e3.c b/test/usb_tcpmv2_td_pd_vndi3_e3.c deleted file mode 100644 index cbfc0d75e3..0000000000 --- a/test/usb_tcpmv2_td_pd_vndi3_e3.c +++ /dev/null @@ -1,114 +0,0 @@ -/* Copyright 2021 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 "mock/tcpci_i2c_mock.h" -#include "task.h" -#include "tcpm/tcpci.h" -#include "test_util.h" -#include "timer.h" -#include "usb_tcpmv2_compliance.h" -#include "usb_tc_sm.h" - -uint32_t vdo = VDO(USB_SID_PD, 1, - VDO_SVDM_VERS(VDM_VER20) | - CMD_DISCOVER_IDENT); - - -/***************************************************************************** - * TD.PD.VNDI3.E3.VDM Identity - * - * Description: - * This test verifies that the VDM Information is as specified in the - * vendor-supplied information. - */ -static int td_pd_vndi3_e3(enum pd_data_role data_role) -{ - partner_set_pd_rev(PD_REV30); - - TEST_EQ(tcpci_startup(), EC_SUCCESS, "%d"); - - /* - * a) Run PROC.PD.E1 Bring-up according to the UUT role. - */ - TEST_EQ(proc_pd_e1(data_role, INITIAL_AND_ALREADY_ATTACHED), - EC_SUCCESS, "%d"); - - /* - * Make sure we are idle. Reject everything that is pending - */ - TEST_EQ(handle_attach_expected_msgs(data_role), EC_SUCCESS, "%d"); - - /* - * b) Tester executes a Discover Identity exchange - */ - partner_send_msg(TCPCI_MSG_SOP, PD_DATA_VENDOR_DEF, - 1, 0, &vdo); - - /* - * c) If the UUT is not a cable and if Responds_To_Discov_SOP is set to - * No, the tester checks that the UUT replies Not_Supported. The test - * stops here in this case. - */ - TEST_EQ(verify_tcpci_transmit(TCPCI_MSG_SOP, PD_CTRL_NOT_SUPPORTED, 0), - EC_SUCCESS, "%d"); - mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); - - /* - * TODO: Items d)-i) could be verified if the unit tests are configured - * to reply to Identity messages. - * - * d) For Cables, the Tester checks the consistency of - * Specification_Revision - * - * e) For all devices, the Tester checks in the ID Header consistency - * of: - * 1. Product_Type(UFP) - * 2. Product Type(Cable Plug) - * 3. Product Type (DFP) - * 4. USB_VID(_SOP) - * 5. Modal_Operation_Supported(_SOP) - * 6. Data_Capable_as_USB_Host(_SOP) - * 7. Data_Capable_as_USB_Device(_SOP) - * - * f) For all devices, the Tester checks in the Cert Stat VDO - * consistency of: - * 1. XID(_SOP) - * - * g) For all devices, the Tester checks in the Product VDO consistency - * of: - * 1. PID(_SOP) - * 2. bcdDevice(_SOP) - * - * h) For Cables, the Tester checks in the Cable VDO consistency of: - * 1. Cable_HW_Vers - * 2. Cable_FW_Vers - * 3. Type_C_to_Type_C_Capt_Vdm_V2 - * 4. Cable_Latency - * 5. Cable_Termination_Type - * 6. Max_VBUS_Voltage_Vdm_V2 - * 7. Cable_VBUS_Current - * 8. VBUS_through_cable - * 9. Cable_SOP''_controller - * 10. Cable_Superspeed_Support - * - * i) For Alt Mode Adapters, the Tester checks in the AMA VDO - * consistency of: - * 1. AMA_HW_Vers - * 2. AMA_FW_Vers - * 3. AMA_VCONN_power - * 4. AMA_VCONN_reqd - * 5. AMA_VBUS_reqd - * 6. AMA_Superspeed_Support - */ - return EC_SUCCESS; -} -int test_td_pd_vndi3_e3_dfp(void) -{ - return td_pd_vndi3_e3(PD_ROLE_DFP); -} -int test_td_pd_vndi3_e3_ufp(void) -{ - return td_pd_vndi3_e3(PD_ROLE_UFP); -} diff --git a/test/usb_test/Makefile b/test/usb_test/Makefile deleted file mode 100644 index e18e4a7c3b..0000000000 --- a/test/usb_test/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2015 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. - -PROGRAM := device_configuration -SOURCE := $(PROGRAM).c -LIBS := -LFLAGS := -CFLAGS := -std=gnu99 \ - -g3 \ - -O3 \ - -Wall \ - -Werror \ - -Wpointer-arith \ - -Wcast-align \ - -Wcast-qual \ - -Wundef \ - -Wsign-compare \ - -Wredundant-decls \ - -Wmissing-declarations - -# -# Add libusb-1.0 required flags -# -LIBS += $(shell pkg-config --libs libusb-1.0) -CFLAGS += $(shell pkg-config --cflags libusb-1.0) - -$(PROGRAM): $(SOURCE) Makefile - gcc $(CFLAGS) $(SOURCE) $(LFLAGS) $(LIBS) -o $@ - -.PHONY: clean - -clean: - rm -rf $(PROGRAM) *~ diff --git a/test/usb_test/README b/test/usb_test/README deleted file mode 100644 index 5d7af93f7e..0000000000 --- a/test/usb_test/README +++ /dev/null @@ -1,2 +0,0 @@ -These tests need to be built and run by hand, unless/until we set up a lab -with known devices attached to a test host. diff --git a/test/usb_test/device_configuration.c b/test/usb_test/device_configuration.c deleted file mode 100644 index 69f889c2d3..0000000000 --- a/test/usb_test/device_configuration.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright 2016 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 <errno.h> -#include <getopt.h> -#include <libusb.h> -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -/* Options */ -static uint16_t vid = 0x18d1; /* Google */ -static uint16_t pid = 0x5014; /* Cr50 */ - -static char *progname; - -static void usage(int errs) -{ - printf("\nUsage: %s [vid:pid] [value]\n" - "\n" - "Set/Get the USB Device Configuration value\n" - "\n" - "The default vid:pid is %04x:%04x\n" - "\n", progname, vid, pid); - - exit(!!errs); -} - -/* Globals */ -struct libusb_device_handle *devh = 0; - -static void stupid_usb(const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - vfprintf(stderr, format, ap); - va_end(ap); - - if (devh) - libusb_close(devh); - - libusb_exit(NULL); - - exit(1); -} - - -int main(int argc, char *argv[]) -{ - int r = 1; - int errorcnt = 0; - int do_set = 0; - uint16_t setval = 0; - uint8_t buf[80]; /* Arbitrary size */ - int i; - - progname = strrchr(argv[0], '/'); - if (progname) - progname++; - else - progname = argv[0]; - - opterr = 0; /* quiet, you */ - while ((i = getopt(argc, argv, "")) != -1) { - switch (i) { - case 'h': - usage(errorcnt); - break; - case 0: /* auto-handled option */ - break; - case '?': - if (optopt) - printf("Unrecognized option: -%c\n", optopt); - else - printf("Unrecognized option: %s\n", - argv[optind - 1]); - errorcnt++; - break; - case ':': - printf("Missing argument to %s\n", argv[optind - 1]); - errorcnt++; - break; - default: - printf("Internal error at %s:%d\n", __FILE__, __LINE__); - exit(1); - } - } - - if (errorcnt) - usage(errorcnt); - - if (optind < argc) { - uint16_t v, p; - - if (2 == sscanf(argv[optind], "%hx:%hx", &v, &p)) { - vid = v; - pid = p; - optind++; - } - } - - if (optind < argc) { - do_set = 1; - setval = atoi(argv[optind]); - } - - r = libusb_init(NULL); - if (r) { - printf("libusb_init() returned 0x%x: %s\n", - r, libusb_error_name(r)); - return 1; - } - - devh = libusb_open_device_with_vid_pid(NULL, vid, pid); - if (!devh) { - perror(progname); - stupid_usb("Can't open device %04x:%04x\n", vid, pid); - } - - - /* Set config*/ - if (do_set) { - printf("SetCfg %d\n", setval); - r = libusb_control_transfer( - devh, - 0x00, /* bmRequestType */ - 0x09, /* bRequest */ - setval, /* wValue */ - 0x0000, /* wIndex */ - NULL, /* data */ - 0x0000, /* wLength */ - 1000); /* timeout (ms) */ - - if (r < 0) - printf("transfer returned 0x%x %s\n", - r, libusb_error_name(r)); - } - - /* Get config */ - memset(buf, 0, sizeof(buf)); - - r = libusb_control_transfer( - devh, - 0x80, /* bmRequestType */ - 0x08, /* bRequest */ - 0x0000, /* wValue */ - 0x0000, /* wIndex */ - buf, /* data */ - 0x0001, /* wLength */ - 1000); /* timeout (ms) */ - - if (r <= 0) - stupid_usb("GetCfg transfer() returned 0x%x %s\n", - r, libusb_error_name(r)); - - printf("GetCfg returned %d bytes:", r); - for (i = 0; i < r; i++) - printf(" 0x%02x", buf[i]); - printf("\n"); - - /* done */ - if (devh) - libusb_close(devh); - libusb_exit(NULL); - - return 0; -} diff --git a/test/usb_typec_ctvpd.c b/test/usb_typec_ctvpd.c deleted file mode 100644 index 52c8be0639..0000000000 --- a/test/usb_typec_ctvpd.c +++ /dev/null @@ -1,1542 +0,0 @@ -/* Copyright 2019 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. - * - * Test USB Type-C VPD and CTVPD module. - */ -#include "common.h" -#include "crc.h" -#include "task.h" -#include "test_util.h" -#include "timer.h" -#include "usb_pd.h" -#include "usb_sm.h" -#include "usb_tc_sm.h" -#include "util.h" -#include "usb_pd_tcpm.h" -#include "usb_pd_test_util.h" -#include "usb_sm_checks.h" -#include "vpd_api.h" - -#define PORT0 0 - -enum cc_type {CC1, CC2}; -enum vbus_type {VBUS_0 = 0, VBUS_5 = 5000}; -enum vconn_type {VCONN_0 = 0, VCONN_3 = 3000, VCONN_5 = 5000}; -enum snk_con_voltage_type {SRC_CON_DEF, SRC_CON_1_5, SRC_CON_3_0}; - -/* - * These enum definitions are declared in usb_tc_*_sm and are private to that - * file. If those definitions are re-ordered, then we need to update these - * definitions (should be very rare). - */ -enum usb_tc_state { - /* Normal States */ - TC_DISABLED, - TC_UNATTACHED_SNK, - TC_ATTACH_WAIT_SNK, - TC_ATTACHED_SNK, - TC_ERROR_RECOVERY, - TC_TRY_SNK, - TC_UNATTACHED_SRC, - TC_ATTACH_WAIT_SRC, - TC_TRY_WAIT_SRC, - TC_ATTACHED_SRC, - TC_CT_TRY_SNK, - TC_CT_ATTACH_WAIT_UNSUPPORTED, - TC_CT_ATTACHED_UNSUPPORTED, - TC_CT_UNATTACHED_UNSUPPORTED, - TC_CT_UNATTACHED_VPD, - TC_CT_DISABLED_VPD, - TC_CT_ATTACHED_VPD, - TC_CT_ATTACH_WAIT_VPD, -}; - -/* Defined in implementation */ -enum usb_tc_state get_state_tc(const int port); - -struct pd_port_t { - int host_mode; - int has_vbus; - int msg_tx_id; - int msg_rx_id; - int polarity; - int partner_role; /* -1 for none */ - int partner_polarity; - int rev; -} pd_port[CONFIG_USB_PD_PORT_MAX_COUNT]; - -uint64_t wait_for_state_change(int port, uint64_t timeout) -{ - uint64_t start; - uint64_t wait; - enum usb_tc_state state = get_state_tc(port); - - task_wake(PD_PORT_TO_TASK_ID(port)); - - wait = get_time().val + timeout; - start = get_time().val; - while (get_state_tc(port) == state && get_time().val < wait) { - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(1 * MSEC); - } - - return get_time().val - start; -} - -#if defined(TEST_USB_TYPEC_CTVPD) -static int ct_connect_sink(enum cc_type cc, enum snk_con_voltage_type v) -{ - int ret; - - switch (v) { - case SRC_CON_DEF: - ret = (cc) ? mock_set_cc2_rp3a0_rd_l(PD_SRC_DEF_RD_THRESH_MV) : - mock_set_cc1_rp3a0_rd_l(PD_SRC_DEF_RD_THRESH_MV); - break; - case SRC_CON_1_5: - ret = (cc) ? mock_set_cc2_rp3a0_rd_l(PD_SRC_1_5_RD_THRESH_MV) : - mock_set_cc1_rp3a0_rd_l(PD_SRC_1_5_RD_THRESH_MV); - break; - case SRC_CON_3_0: - ret = (cc) ? mock_set_cc2_rp3a0_rd_l(PD_SRC_3_0_RD_THRESH_MV) : - mock_set_cc1_rp3a0_rd_l(PD_SRC_3_0_RD_THRESH_MV); - break; - default: - ret = 0; - } - - return ret; -} - -static int ct_disconnect_sink(void) -{ - int r1; - int r2; - - r1 = mock_set_cc1_rp3a0_rd_l(PD_SRC_DEF_VNC_MV); - r2 = mock_set_cc2_rp3a0_rd_l(PD_SRC_DEF_VNC_MV); - - return r1 & r2; -} - -static int ct_connect_source(enum cc_type cc, enum vbus_type vbus) -{ - mock_set_ct_vbus(vbus); - return (cc) ? mock_set_cc2_rpusb_odh(PD_SNK_VA_MV) : - mock_set_cc1_rpusb_odh(PD_SNK_VA_MV); -} - -static int ct_disconnect_source(void) -{ - int r1; - int r2; - - mock_set_ct_vbus(VBUS_0); - r1 = mock_set_cc1_rpusb_odh(0); - r2 = mock_set_cc2_rpusb_odh(0); - - return r1 & r2; -} -#endif - -static void host_disconnect_source(void) -{ - mock_set_host_vbus(VBUS_0); - mock_set_host_cc_source_voltage(0); - mock_set_host_cc_sink_voltage(0); -} - -static void host_connect_source(enum vbus_type vbus) -{ - mock_set_host_vbus(vbus); - mock_set_host_cc_source_voltage(PD_SNK_VA_MV); -} - -#if defined(TEST_USB_TYPEC_CTVPD) -static void host_connect_sink(enum snk_con_voltage_type v) -{ - switch (v) { - case SRC_CON_DEF: - mock_set_host_cc_sink_voltage(PD_SRC_DEF_RD_THRESH_MV); - break; - case SRC_CON_1_5: - mock_set_host_cc_sink_voltage(PD_SRC_1_5_RD_THRESH_MV); - break; - case SRC_CON_3_0: - mock_set_host_cc_sink_voltage(PD_SRC_3_0_RD_THRESH_MV); - break; - } -} -#endif - -static void init_port(int port) -{ - pd_port[port].polarity = 0; - pd_port[port].rev = PD_REV30; - pd_port[port].msg_tx_id = 0; - pd_port[port].msg_rx_id = 0; -} - -static int check_host_ra_rd(void) -{ - /* Make sure CC_RP3A0_RD_L is configured as GPO */ - if (mock_get_cfg_cc_rp3a0_rd_l() != PIN_GPO) - return 0; - - /* Make sure CC_RP3A0_RD_L is asserted low */ - if (mock_get_cc_rp3a0_rd_l() != 0) - return 0; - - /* Make sure VPDMCU_CC_EN is enabled */ - if (mock_get_mcu_cc_en() != 1) - return 0; - - /* Make sure CC_VPDMCU is configured as ADC */ - if (mock_get_cfg_cc_vpdmcu() != PIN_ADC) - return 0; - - /* Make sure CC_DB_EN_OD is HZ */ - if (mock_get_cc_db_en_od() != GPO_HZ) - return 0; - - return 1; -} - -static int check_host_rd(void) -{ - /* Make sure CC_RP3A0_RD_L is configured as GPO */ - if (mock_get_cfg_cc_rp3a0_rd_l() != PIN_GPO) - return 0; - - /* Make sure CC_RP3A0_RD_L is asserted low */ - if (mock_get_cc_rp3a0_rd_l() != 0) - return 0; - - /* Make sure VPDMCU_CC_EN is enabled */ - if (mock_get_mcu_cc_en() != 1) - return 0; - - /* Make sure CC_VPDMCU is configured as ADC */ - if (mock_get_cfg_cc_vpdmcu() != PIN_ADC) - return 0; - - /* Make sure CC_DB_EN_OD is LOW */ - if (mock_get_cc_db_en_od() != GPO_LOW) - return 0; - - return 1; -} - -#if defined(TEST_USB_TYPEC_CTVPD) -static int check_host_rp3a0(void) -{ - /* Make sure CC_RP3A0_RD_L is asserted high */ - if (mock_get_cc_rp3a0_rd_l() != 1) - return 0; - - return 1; -} - -static int check_host_rpusb(void) -{ - /* Make sure CC_RPUSB_ODH is asserted high */ - if (mock_get_cc_rpusb_odh() != 1) - return 0; - - /* Make sure CC_RP3A0_RD_L is configured as comparator */ - if (mock_get_cfg_cc_rp3a0_rd_l() != PIN_CMP) - return 0; - - return 1; -} - -static int check_host_cc_open(void) -{ - /* Make sure CC_RPUSB_ODH is hi-z */ - if (mock_get_cc_rpusb_odh() != GPO_HZ) - return 0; - - /* Make sure CC_RP3A0_RD_L is set to comparitor */ - if (mock_get_cfg_cc_rp3a0_rd_l() != PIN_CMP) - return 0; - - /* Make sure cc_db_en_od is set low */ - if (mock_get_cc_db_en_od() != GPO_LOW) - return 0; - - return 1; -} - -static int check_ct_ccs_hz(void) -{ - return (mock_get_ct_rd() == GPO_HIGH); -} - -static int check_ct_ccs_rd(void) -{ - return (mock_get_ct_rd() == GPO_LOW); -} - -static int check_ct_ccs_cc1_rpusb(void) -{ - return (mock_get_ct_cc1_rpusb() == 1); -} -#endif - -void inc_tx_id(int port) -{ - pd_port[port].msg_tx_id = (pd_port[port].msg_tx_id + 1) % 7; -} - -void inc_rx_id(int port) -{ - pd_port[port].msg_rx_id = (pd_port[port].msg_rx_id + 1) % 7; -} - -static int verify_goodcrc(int port, int role, int id) -{ - return pd_test_tx_msg_verify_sop_prime(port) && - pd_test_tx_msg_verify_short(port, PD_HEADER(PD_CTRL_GOOD_CRC, - role, role, id, 0, 0, 0)) && - pd_test_tx_msg_verify_crc(port) && - pd_test_tx_msg_verify_eop(port); -} - -static void simulate_rx_msg(int port, uint16_t header, int cnt, - const uint32_t *data) -{ - int i; - - pd_test_rx_set_preamble(port, 1); - pd_test_rx_msg_append_sop_prime(port); - pd_test_rx_msg_append_short(port, header); - - crc32_init(); - crc32_hash16(header); - - for (i = 0; i < cnt; ++i) { - pd_test_rx_msg_append_word(port, data[i]); - crc32_hash32(data[i]); - } - - pd_test_rx_msg_append_word(port, crc32_result()); - - pd_test_rx_msg_append_eop(port); - pd_test_rx_msg_append_last_edge(port); - - pd_simulate_rx(port); -} - -static void simulate_goodcrc(int port, int role, int id) -{ - simulate_rx_msg(port, PD_HEADER(PD_CTRL_GOOD_CRC, role, role, id, 0, - pd_port[port].rev, 0), 0, NULL); -} - -static void simulate_discovery_identity(int port) -{ - uint16_t header = PD_HEADER(PD_DATA_VENDOR_DEF, PD_ROLE_SOURCE, - 0, pd_port[port].msg_rx_id, - 1, pd_port[port].rev, 0); - uint32_t msg = VDO(USB_SID_PD, - 1, /* Structured VDM */ - VDO_SVDM_VERS(1) | - VDO_CMDT(CMDT_INIT) | - CMD_DISCOVER_IDENT); - - simulate_rx_msg(port, header, 1, (const uint32_t *)&msg); -} - -static int test_vpd_host_src_detection(void) -{ - int port = PORT0; - - mock_set_vconn(VCONN_0); - host_disconnect_source(); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - - /* - * TEST: - * Host is configured properly and start state is UNATTACHED_SNK - */ - TEST_ASSERT(check_host_ra_rd()); - TEST_ASSERT(get_state_tc(port) == TC_UNATTACHED_SNK); - - /* - * TEST: - * Host PORT Source Connection Detected - */ - - host_connect_source(VBUS_0); - mock_set_vconn(VCONN_0); - - wait_for_state_change(port, 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_ATTACH_WAIT_SNK); - - /* - * TEST: - * Host CC debounce in ATTACH_WAIT_SNK state - */ - - host_disconnect_source(); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(5 * MSEC); - - /* - * TEST: - * Host CC debounce in ATTACH_WAIT_SNK state - */ - - host_connect_source(VBUS_0); - mock_set_vconn(VCONN_0); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(50 * MSEC); - - /* - * TEST: - * Host Port Connection Removed - */ - host_disconnect_source(); - - wait_for_state_change(port, 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_UNATTACHED_SNK); - - return EC_SUCCESS; -} - -static int test_vpd_host_src_detection_vbus(void) -{ - int port = PORT0; - - mock_set_vconn(VCONN_0); - host_disconnect_source(); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - - /* - * TEST: - * Host is configured properly and start state is UNATTACHED_SNK - */ - - TEST_ASSERT(check_host_ra_rd()); - TEST_ASSERT(get_state_tc(port) == TC_UNATTACHED_SNK); - - /* - * TEST: - * Host Port Source Connection Detected - */ - - host_connect_source(VBUS_0); - mock_set_vconn(VCONN_0); - - wait_for_state_change(port, 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_ATTACH_WAIT_SNK); - - /* - * TEST: - * Host Port Source Detected for tCCDebounce and Host Port VBUS - * Detected. - */ - - host_connect_source(VBUS_5); - - wait_for_state_change(port, PD_T_CC_DEBOUNCE + 10 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_ATTACHED_SNK); - - /* - * TEST: - * Host Port VBUS Removed - */ - - host_connect_source(VBUS_0); - - /* - * The state changes from UNATTACHED_SNK to ATTACH_WAIT_SNK immediately - * if Rp is detected. - */ - wait_for_state_change(port, 10 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_ATTACH_WAIT_SNK); - - return EC_SUCCESS; -} - -static int test_vpd_host_src_detection_vconn(void) -{ - int port = PORT0; - - mock_set_vconn(VCONN_0); - host_disconnect_source(); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - - /* - * TEST: - * Host is configured properly and start state is UNATTACHED_SNK - */ - - TEST_ASSERT(check_host_ra_rd()); - TEST_ASSERT(get_state_tc(port) == TC_UNATTACHED_SNK); - - /* - * TEST: - * Host Source Connection Detected - */ - - host_connect_source(VBUS_0); - mock_set_vconn(VCONN_0); - - wait_for_state_change(port, 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_ATTACH_WAIT_SNK); - - /* - * TEST: - * Host Port Source Detected for tCCDebounce and VCONN Detected - */ - - host_connect_source(VBUS_0); - mock_set_vconn(VCONN_3); - - wait_for_state_change(port, PD_T_CC_DEBOUNCE + 10 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_ATTACHED_SNK); - - /* VCONN was detected. Make sure RA is removed */ - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - TEST_ASSERT(check_host_rd()); - - /* - * TEST: - * Host Port VCONN Removed - */ - - mock_set_host_cc_source_voltage(0); - mock_set_vconn(VCONN_0); - - wait_for_state_change(port, 10 * MSEC); - - TEST_EQ(get_state_tc(port), TC_UNATTACHED_SNK, "%d"); - - host_disconnect_source(); - - return EC_SUCCESS; -} - -static int test_vpd_host_src_detection_message_reception(void) -{ - int port = PORT0; - uint32_t expected_vdm_header = VDO(USB_VID_GOOGLE, - 1, /* Structured VDM */ - VDO_SVDM_VERS(1) | - VDO_CMDT(CMDT_RSP_ACK) | - CMD_DISCOVER_IDENT); - uint32_t expected_vdo_id_header = VDO_IDH( - 0, /* Not a USB Host */ - 1, /* Capable of being enumerated as USB Device */ - IDH_PTYPE_VPD, - 0, /* Modal Operation Not Supported */ - USB_VID_GOOGLE); - uint32_t expected_vdo_cert = 0; - uint32_t expected_vdo_product = VDO_PRODUCT( - CONFIG_USB_PID, - USB_BCD_DEVICE); - uint32_t expected_vdo_vpd = VDO_VPD( - VPD_HW_VERSION, - VPD_FW_VERSION, - VPD_MAX_VBUS_20V, - IS_ENABLED(CONFIG_USB_CTVPD) ? VPD_CT_CURRENT - : 0, - IS_ENABLED(CONFIG_USB_CTVPD) ? VPD_VBUS_IMP( - VPD_VBUS_IMPEDANCE) - : 0, - IS_ENABLED(CONFIG_USB_CTVPD) ? VPD_GND_IMP( - VPD_GND_IMPEDANCE) - : 0, - IS_ENABLED(CONFIG_USB_CTVPD) ? VPD_CTS_SUPPORTED - : VPD_CTS_NOT_SUPPORTED); - - mock_set_vconn(VCONN_0); - host_disconnect_source(); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - - /* - * TEST: - * Host is configured properly and start state is UNATTACHED_SNK - */ - - TEST_ASSERT(check_host_ra_rd()); - TEST_ASSERT(get_state_tc(port) == TC_UNATTACHED_SNK); - - /* - * Transition to ATTACHED_SNK - */ - - host_connect_source(VBUS_5); - - wait_for_state_change(port, 10 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_ATTACH_WAIT_SNK); - - wait_for_state_change(port, PD_T_CC_DEBOUNCE + 20 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_ATTACHED_SNK); - - /* Run state machines to enable rx monitoring */ - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - - /* - * TEST: - * Reception of Discovery Identity message - */ - - simulate_discovery_identity(port); - task_wait_event(30 * MSEC); - - TEST_ASSERT(verify_goodcrc(port, - PD_ROLE_SINK, pd_port[port].msg_rx_id)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - inc_rx_id(port); - - /* Test Discover Identity Ack */ - TEST_ASSERT(pd_test_tx_msg_verify_sop_prime(port)); - TEST_ASSERT(pd_test_tx_msg_verify_short(port, - PD_HEADER(PD_DATA_VENDOR_DEF, PD_PLUG_FROM_CABLE, 0, - pd_port[port].msg_tx_id, 5, pd_port[port].rev, 0))); - TEST_ASSERT(pd_test_tx_msg_verify_word(port, expected_vdm_header)); - TEST_ASSERT(pd_test_tx_msg_verify_word(port, expected_vdo_id_header)); - TEST_ASSERT(pd_test_tx_msg_verify_word(port, expected_vdo_cert)); - TEST_ASSERT(pd_test_tx_msg_verify_word(port, expected_vdo_product)); - TEST_ASSERT(pd_test_tx_msg_verify_word(port, expected_vdo_vpd)); - TEST_ASSERT(pd_test_tx_msg_verify_crc(port)); - TEST_ASSERT(pd_test_tx_msg_verify_eop(port)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - - /* Ack was good. Send GoodCRC */ - simulate_goodcrc(port, PD_ROLE_SOURCE, pd_port[port].msg_tx_id); - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(30 * MSEC); - inc_tx_id(port); - - /* - * TEST: - * Host Port VBUS Removed - */ - - host_disconnect_source(); - - wait_for_state_change(port, 100 * MSEC); - - TEST_EQ(get_state_tc(port), TC_UNATTACHED_SNK, "%d"); - - - return EC_SUCCESS; -} - -#if defined(TEST_USB_TYPEC_CTVPD) -static int test_ctvpd_behavior_case1(void) -{ - int port = PORT0; - - mock_set_vconn(VCONN_0); - host_disconnect_source(); - TEST_ASSERT(ct_disconnect_source()); - TEST_ASSERT(ct_disconnect_sink()); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - - /* - * CASE 1: The following tests the behavior when a DRP is connected to a - * Charge-Through VCONN-Powered USB Device (abbreviated CTVPD), - * with no Power Source attached to the ChargeThrough port on - * the CTVPD. - */ - - /* 1. DRP and CTVPD are both in the unattached state */ - TEST_ASSERT(get_state_tc(port) == TC_UNATTACHED_SNK); - - /* - * a. DRP alternates between Unattached.SRC and Unattached.SNK - * - * b. CTVPD has applied Rd on its Charge-Through port’s CC1 and CC2 - * pins and Rd on the Host-side port’s CC pin - */ - TEST_ASSERT(check_host_ra_rd()); - TEST_ASSERT(check_ct_ccs_rd()); - - /* - * 2. DRP transitions from Unattached.SRC to AttachWait.SRC to - * Attached.SRC - * - * a. DRP in Unattached.SRC detects the CC pull-down of CTVPD which - * is in Unattached.SNK and DRP enters AttachWait.SRC - * b. DRP in AttachWait.SRC detects that pull down on CC persists for - * tCCDebounce, enters Attached.SRC and turns on VBUS and VCONN - */ - host_connect_source(VBUS_5); - mock_set_vconn(VCONN_3); - - /* - * 3. CTVPD transitions from Unattached.SNK to Attached.SNK through - * AttachWait.SNK. - * - * a. CTVPD detects the host-side CC pull-up of the DRP and CTVPD - * enters AttachWait.SNK - * b. CTVPD in AttachWait.SNK detects that pull up on the Host-side - * port’s CC persists for tCCDebounce, VCONN present and enters - * Attached.SNK - * c. CTVPD present a high-impedance to ground (above zOPEN) on its - * Charge-Through port’s CC1 and CC2 pins - */ - wait_for_state_change(port, 40 * MSEC); - TEST_ASSERT(get_state_tc(port) == TC_ATTACH_WAIT_SNK); - - wait_for_state_change(port, PD_T_CC_DEBOUNCE + 40 * MSEC); - TEST_ASSERT(get_state_tc(port) == TC_ATTACHED_SNK); - TEST_ASSERT(check_ct_ccs_hz()); - - /* - * 4. While DRP and CTVPD are in their respective attached states, DRP - * discovers the ChargeThrough CTVPD and transitions to - * CTUnattached.SNK - * - * a. DRP (as Source) queries the device identity via USB PD - * (Device Identity Command) on SOP’. - * b. CTVPD responds on SOP’, advertising that it is a - * Charge-Through VCONN-Powered USB Device - * c. DRP (as Source) removes VBUS - * d. DRP (as Source) changes its Rp to a Rd - * e. DRP (as Sink) continues to provide VCONN and enters - * CTUnattached.SNK - */ - host_disconnect_source(); - - /* - * 5. CTVPD transitions to CTUnattached.VPD - * - * a. CTVPD detects VBUS removal, VCONN presence, the low Host-side - * CC pin and enters CTUnattached.VPD - * b. CTVPD changes its host-side Rd to a Rp advertising 3.0 A - * c. CTVPD isolates itself from VBUS - * d. CTVPD apply Rd on its Charge-Through port’s CC1 and CC2 pins - */ - wait_for_state_change(port, 40 * MSEC); - TEST_ASSERT(get_state_tc(port) == TC_CT_UNATTACHED_VPD); - - /* - * 6. While the CTVPD in CTUnattached.VPD state and the DRP in - * CTUnattached.SNK state: - * - * a. CTVPD monitors Charge-Though CC pins for a source or sink; - * when a Power Source attach is detected, enters - * CTAttachWait.VPD; when a sink is detected, enters - * CTAttachWait.Unsupported - * b. CTVPD monitors VCONN for Host detach and when detected, enters - * Unattached.SNK - * c. DRP monitors VBUS and CC for CTVPD detach for tVPDDetach and - * when detected, enters Unattached.SNK - * d. DRP monitors VBUS for Power Source attach and when detected, - * enters CTAttached.SNK - */ - /* Attach Power Source */ - TEST_ASSERT(ct_connect_source(CC2, VBUS_0)); - - wait_for_state_change(port, 40 * MSEC); - TEST_EQ(get_state_tc(port), TC_CT_ATTACH_WAIT_VPD, "%d"); - - /* Remove Power Source */ - TEST_ASSERT(ct_disconnect_source()); - - wait_for_state_change(port, 40 * MSEC); - - TEST_EQ(get_state_tc(port), TC_CT_UNATTACHED_VPD, "%d"); - - /* Attach Sink */ - TEST_ASSERT(ct_connect_sink(CC1, SRC_CON_DEF)); - - wait_for_state_change(port, 40 * MSEC); - - TEST_EQ(get_state_tc(port), TC_CT_ATTACH_WAIT_UNSUPPORTED, "%d"); - - /* Remove VCONN (Host detach) */ - mock_set_vconn(VCONN_0); - - wait_for_state_change(port, 40 * MSEC); - - TEST_EQ(get_state_tc(port), TC_UNATTACHED_SNK, "%d"); - - return EC_SUCCESS; -} - -static int test_ctvpd_behavior_case2(void) -{ - int port = PORT0; - - mock_set_vconn(VCONN_0); - host_disconnect_source(); - TEST_ASSERT(ct_disconnect_source()); - TEST_ASSERT(ct_disconnect_sink()); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - - /* - * CASE 2: The following tests the behavior when a Power Source is - * connected to a Charge-Through VCONN-Powered USB Device - * (abbreviated CTVPD), with a Host already attached to the - * Host-Side port on the CTVPD. - */ - - /* - * 1. DRP is in CTUnattached.SNK state, CTVPD in CTUnattached.VPD, and - * Power Source in the unattached state - * - * a. CTVPD has applied Rd on the Charge-Through port’s CC1 and CC2 - * pins and Rp termination advertising 3.0 A on the Host-side - * port’s CC pin - */ - TEST_ASSERT(get_state_tc(port) == TC_UNATTACHED_SNK); - - host_connect_source(VBUS_5); - mock_set_vconn(VCONN_3); - - wait_for_state_change(port, 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_ATTACH_WAIT_SNK); - - wait_for_state_change(port, PD_T_CC_DEBOUNCE + 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_ATTACHED_SNK); - - /* Remove Host CC */ - mock_set_host_cc_source_voltage(0); - - wait_for_state_change(port, 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_CT_UNATTACHED_VPD); - TEST_ASSERT(check_ct_ccs_rd()); - TEST_ASSERT(check_host_rp3a0()); - - /* - * 2. Power Source transitions from Unattached.SRC to Attached.SRC - * through AttachWait.SRC. - * - * a. Power Source detects the CC pull-down of the CTVPD and enters - * AttachWait.SRC - * b. Power Source in AttachWait.SRC detects that pull down on CC - * persists for tCCDebounce, enters Attached.SRC and turns on - * VBUS - */ - TEST_ASSERT(ct_connect_source(CC2, VBUS_5)); - - /* - * 3. CTVPD transitions from CTUnattached.VPD through CTAttachWait.VPD - * to CTAttached.VPD - * - * a. CTVPD detects the Source’s Rp on one of its Charge-Through CC - * pins, and transitions to CTAttachWait.VPD - * b. CTVPD finishes any active USB PD communication on SOP’ and - * ceases to respond to SOP’ queries - * c. CTVPD in CTAttachWait.VPD detects that the pull up on - * Charge-Through CC pin persists for tCCDebounce, detects VBUS - * and enters CTAttached.VPD - * d. CTVPD connects the active Charge-Through CC pin to the - * Host-side port’s CC pin - * e. CTVPD disables its Rp termination advertising 3.0 A on the - * Host-side port’s CC pin - * f. CTVPD disables its Rd on the Charge-Through CC pins - * g. CTVPD connects VBUS from the Charge-Through side to the Host - * side - */ - - wait_for_state_change(port, 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_CT_ATTACH_WAIT_VPD); - - wait_for_state_change(port, PD_T_CC_DEBOUNCE + 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_CT_ATTACHED_VPD); - TEST_ASSERT(moch_get_ct_cl_sel() == CT_CC2); - TEST_ASSERT(check_host_cc_open()); - TEST_ASSERT(check_ct_ccs_hz()); - TEST_ASSERT(mock_get_vbus_pass_en()); - - /* - * 4. DRP (as Sink) transitions to CTAttached.SNK - * a. DRP (as Sink) detects VBUS, monitors vRd for available current - * and enter CTAttached.SNK - */ - - /* - * 5. While the devices are all in their respective attached states: - * a. CTVPD monitors VCONN for DRP detach and when detected, - * enters CTDisabled.VPD - * b. CTVPD monitors VBUS and CC for Power Source detach and when - * detected, enters CTUnattached.VPD within tVPDCTDD - * c. DRP (as Sink) monitors VBUS for Charge-Through Power Source - * detach and when detected, enters CTUnattached.SNK - * d. DRP (as Sink) monitors VBUS and CC for CTVPD detach and when - * detected, enters Unattached.SNK (and resumes toggling between - * Unattached.SNK and Unattached.SRC) - * e. Power Source monitors CC for CTVPD detach and when detected, - * enters Unattached.SRC - */ - mock_set_vconn(VCONN_0); - - wait_for_state_change(port, 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_CT_DISABLED_VPD); - - return EC_SUCCESS; -} - -static int test_ctvpd_behavior_case3(void) -{ - int port = PORT0; - - mock_set_vconn(VCONN_0); - host_disconnect_source(); - TEST_ASSERT(ct_disconnect_source()); - TEST_ASSERT(ct_disconnect_sink()); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - - /* - * CASE 3: The following describes the behavior when a Power Source is - * connected to a ChargeThrough VCONN-Powered USB Device - * (abbreviated CTVPD), with no Host attached to the Host-side - * port on the CTVPD. - */ - - /* - * 1. CTVPD and Power Source are both in the unattached state - * a. CTVPD has applied Rd on the Charge-Through port’s CC1 and CC2 - * pins and Rd on the Host-side port’s CC pin - */ - TEST_ASSERT(get_state_tc(port) == TC_UNATTACHED_SNK); - - TEST_ASSERT(check_ct_ccs_rd()); - TEST_ASSERT(check_host_ra_rd()); - TEST_ASSERT(ct_connect_source(CC2, VBUS_5)); - - /* - * 2. Power Source transitions from Unattached.SRC to Attached.SRC - * through AttachWait.SRC. - * - * a. Power Source detects the CC pull-down of the CTVPD and enters - * AttachWait.SRC - * b. Power Source in AttachWait.SRC detects that pull down on CC - * persists for tCCDebounce, enters Attached.SRC and turns on - * VBUS - */ - - /* 3. CTVPD alternates between Unattached.SNk and Unattached.SRC - * - * a. CTVPD detects the Source’s Rp on one of its Charge-Through CC - * pins, detects VBUS for tCCDebounce and starts alternating - * between Unattached.SRC and Unattached.SNK - */ - wait_for_state_change(port, PD_T_CC_DEBOUNCE + 40 * MSEC); - TEST_ASSERT(get_state_tc(port) == TC_UNATTACHED_SRC); - - /* - * 4. While the CTVPD alternates between Unattached.SRC and - * Unattached.SNK state and the Power Source in Attached.SRC state: - * - * a. CTVPD monitors the Host-side port’s CC pin for device attach - * and when detected, enters AttachWait.SRC - * b. CTVPD monitors VBUS for Power Source detach and when detected, - * enters Unattached.SNK - * c. Power Source monitors CC for CTVPD detach and when detected, - * enters Unattached.SRC - */ - - /* Attached host side device */ - host_connect_sink(SRC_CON_DEF); - - wait_for_state_change(port, 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_ATTACH_WAIT_SRC); - - /* Remove VBUS */ - TEST_ASSERT(ct_disconnect_source()); - - wait_for_state_change(port, 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_UNATTACHED_SNK); - - return EC_SUCCESS; -} - -static int test_ctvpd_behavior_case4(void) -{ - int port = PORT0; - uint32_t expected_vdm_header = VDO(USB_VID_GOOGLE, - 1, /* Structured VDM */ - VDO_SVDM_VERS(1) | - VDO_CMDT(CMDT_RSP_ACK) | - CMD_DISCOVER_IDENT); - uint32_t expected_vdo_id_header = VDO_IDH( - 0, /* Not a USB Host */ - 1, /* Capable of being enumerated as USB Device */ - IDH_PTYPE_VPD, - 0, /* Modal Operation Not Supported */ - USB_VID_GOOGLE); - uint32_t expected_vdo_cert = 0; - uint32_t expected_vdo_product = VDO_PRODUCT( - CONFIG_USB_PID, - USB_BCD_DEVICE); - uint32_t expected_vdo_vpd = VDO_VPD( - VPD_HW_VERSION, - VPD_FW_VERSION, - VPD_MAX_VBUS_20V, - IS_ENABLED(CONFIG_USB_CTVPD) ? VPD_CT_CURRENT - : 0, - IS_ENABLED(CONFIG_USB_CTVPD) ? VPD_VBUS_IMP( - VPD_VBUS_IMPEDANCE) - : 0, - IS_ENABLED(CONFIG_USB_CTVPD) ? VPD_GND_IMP( - VPD_GND_IMPEDANCE) - : 0, - IS_ENABLED(CONFIG_USB_CTVPD) ? VPD_CTS_SUPPORTED - : VPD_CTS_NOT_SUPPORTED); - - init_port(port); - mock_set_vconn(VCONN_0); - host_disconnect_source(); - TEST_ASSERT(ct_disconnect_source()); - TEST_ASSERT(ct_disconnect_sink()); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - - /* - * CASE 4: The following describes the behavior when a DRP is connected - * to a Charge-Through VCONN-Powered USB Device - * (abbreviated CTVPD), with a Power Source already attached to - * the Charge-Through side on the CTVPD. - */ - - /* - * 1. DRP, CTVPD and Sink are all in the unattached state - * - * a. DRP alternates between Unattached.SRC and Unattached.SNK - * b. CTVPD has applied Rd on its Charge-Through port’s CC1 and CC2 - * pins and Rd on the Host-side port’s CC pin - */ - TEST_ASSERT(get_state_tc(port) == TC_UNATTACHED_SNK); - - TEST_ASSERT(check_ct_ccs_rd()); - TEST_ASSERT(check_host_ra_rd()); - - /* - * 2. DRP transitions from Unattached.SRC to AttachWait.SRC to - * Attached.SRC - * - * a. DRP in Unattached.SRC detects the CC pull-down of CTVPD which - * is in Unattached.SNK and DRP enters AttachWait.SRC - * b. DRP in AttachWait.SRC detects that pull down on CC persists - * for tCCDebounce, enters Attached.SRC and turns on VBUS and - * VCONN - */ - - host_connect_source(VBUS_5); - mock_set_vconn(VCONN_3); - - /* - * 3. CTVPD transitions from Unattached.SNK to Attached.SNK through - * AttachWait.SNK. - * - * a. CTVPD detects the host-side CC pull-up of the DRP and CTVPD - * enters AttachWait.SNK - * b. CTVPD in AttachWait.SNK detects that pull up on the - * Host-side port’s CC persists for tCCDebounce, VCONN present - * and enters Attached.SNK - * c. CTVPD present a high-impedance to ground (above zOPEN) on its - * Charge-Through port’s CC1 and CC2 pins - */ - - wait_for_state_change(port, 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_ATTACH_WAIT_SNK); - - wait_for_state_change(port, PD_T_CC_DEBOUNCE + 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_ATTACHED_SNK); - TEST_ASSERT(check_ct_ccs_hz()); - - /* - * 4. While DRP and CTVPD are in their respective attached states, DRP - * discovers the ChargeThrough CTVPD and transitions to - * CTUnattached.SNK - * - * a. DRP (as Source) queries the device identity via USB PD - * (Discover Identity Command) on SOP’. - * b. CTVPD responds on SOP’, advertising that it is a - * Charge-Through VCONN-Powered USB Device - * c. DRP (as Source) removes VBUS - * d. DRP (as Source) changes its Rp to a Rd - * e. DRP (as Sink) continues to provide VCONN and enters - * CTUnattached.SNK - */ - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - - simulate_discovery_identity(port); - task_wait_event(40 * MSEC); - - TEST_ASSERT(verify_goodcrc(port, - PD_ROLE_SINK, pd_port[port].msg_rx_id)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - inc_rx_id(port); - - /* Test Discover Identity Ack */ - TEST_ASSERT(pd_test_tx_msg_verify_sop_prime(port)); - TEST_ASSERT(pd_test_tx_msg_verify_short(port, - PD_HEADER(PD_DATA_VENDOR_DEF, PD_PLUG_FROM_CABLE, 0, - pd_port[port].msg_tx_id, 5, pd_port[port].rev, 0))); - TEST_ASSERT(pd_test_tx_msg_verify_word(port, expected_vdm_header)); - TEST_ASSERT(pd_test_tx_msg_verify_word(port, expected_vdo_id_header)); - TEST_ASSERT(pd_test_tx_msg_verify_word(port, expected_vdo_cert)); - TEST_ASSERT(pd_test_tx_msg_verify_word(port, expected_vdo_product)); - TEST_ASSERT(pd_test_tx_msg_verify_word(port, expected_vdo_vpd)); - TEST_ASSERT(pd_test_tx_msg_verify_crc(port)); - TEST_ASSERT(pd_test_tx_msg_verify_eop(port)); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - - /* Ack was good. Send GoodCRC */ - simulate_goodcrc(port, PD_ROLE_SOURCE, pd_port[port].msg_tx_id); - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - inc_tx_id(port); - - /* - * 5. CTVPD transitions to CTUnattached.VPD - * - * a. CTVPD detects VBUS removal, VCONN presence, the low Host-side - * CC pin and enters CTUnattached.VPD - * b. CTVPD changes its host-side Rd to a Rp termination advertising - * 3.0 A - * c. CTVPD isolates itself from VBUS - * d. CTVPD apply Rd on its Charge-Through port’s CC1 and CC2 pins - */ - host_disconnect_source(); - - wait_for_state_change(port, 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_CT_UNATTACHED_VPD); - TEST_ASSERT(check_ct_ccs_rd()); - TEST_ASSERT(check_host_rp3a0()); - - /* - * 6. CTVPD alternates between CTUnattached.VPD and - * CTUnattached.Unsupported - */ - wait_for_state_change(port, PD_T_DRP_SRC + 10 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_CT_UNATTACHED_UNSUPPORTED); - - wait_for_state_change(port, PD_T_DRP_SRC + 10 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_CT_UNATTACHED_VPD); - TEST_ASSERT(ct_connect_source(CC2, VBUS_5)); - - wait_for_state_change(port, 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_CT_ATTACH_WAIT_VPD); - - return EC_SUCCESS; -} - -static int test_ctvpd_behavior_case5(void) -{ - int port = PORT0; - - mock_set_vconn(VCONN_0); - host_disconnect_source(); - TEST_ASSERT(ct_disconnect_source()); - TEST_ASSERT(ct_disconnect_sink()); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - - /* - * CASE 5: The following describes the behavior when a Power Source is - * connected to a ChargeThrough VCONN-Powered USB Device - * (abbreviated CTVPD), with a DRP (with dead battery) attached - * to the Host-side port on the CTVPD. - */ - - /* - * 1. DRP, CTVPD and Power Source are all in the unattached state - * - * a. DRP apply dead battery Rd - * b. CTVPD apply Rd on the Charge-Through port’s CC1 and CC2 pins - * and Rd on the Host-side port’s CC pin - */ - TEST_ASSERT(get_state_tc(port) == TC_UNATTACHED_SNK); - - TEST_ASSERT(check_ct_ccs_rd()); - TEST_ASSERT(check_host_ra_rd()); - - /* - * 2. Power Source transitions from Unattached.SRC to Attached.SRC - * through AttachWait.SRC. - * - * a. Power Source detects the CC pull-down of the CTVPD and enters - * AttachWait.SRC - * b. Power Source in AttachWait.SRC detects that pull down on CC - * persists for tCCDebounce, enters Attached.SRC and enable VBUS - */ - TEST_ASSERT(ct_connect_source(CC2, VBUS_5)); - - /* - * 3. CTVPD alternates between Unattached.SNK and Unattached.SRC - * - * a. CTVPD detects the Source’s Rp on one of its Charge-Through CC - * pins, detects VBUS for tCCDebounce and starts alternating - * between Unattached.SRC and Unattached.SNK - */ - - wait_for_state_change(port, PD_T_CC_DEBOUNCE + 40 * MSEC); - TEST_ASSERT(get_state_tc(port) == TC_UNATTACHED_SRC); - - /* Connect Host With Dead Battery */ - host_connect_sink(SRC_CON_DEF); - - /* - * 4. CTVPD transitions from Unattached.SRC to Try.SNK through - * AttachWait.SRC - * - * a. CTVPD in Unattached.SRC detects the CC pull-down of DRP which - * is in Unattached.SNK and CTVPD enters AttachWait.SRC - * b. CTVPD in AttachWait.SRC detects that pull down on CC persists - * for tCCDebounce and enters Try.SNK - * c. CTVPD disables Rp termination advertising Default USB Power on - * the Host-side port’s CC - * d. CTVPD enables Rd on the Host-side port’s CC - */ - - wait_for_state_change(port, 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_ATTACH_WAIT_SRC); - - wait_for_state_change(port, PD_T_CC_DEBOUNCE + 10 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_TRY_SNK); - TEST_ASSERT(check_host_ra_rd()); - - /* 5. DRP in dead battery condition remains in Unattached.SNK */ - - /* - * 6. CTVPD transitions from Try.SNK to Attached.SRC through - * TryWait.SRC - * - * a. CTVPD didn’t detect the CC pull-up of the DRP for - * tTryDebounce after tDRPTry and enters TryWait.SRC - * b. CTVPD disables Rd on the Host-side port’s CC - * c. CTVPD enables Rp termination advertising Default USB Power on - * the Host-side port’s CC - * d. CTVPD detects the CC pull-down of the DRP for tTryCCDebounce - * and enters Attached.SRC - * e. CTVPD connects VBUS from the Charge-Through side to the Host - * side - */ - wait_for_state_change(port, PD_T_TRY_CC_DEBOUNCE + - PD_T_DRP_TRY + 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_TRY_WAIT_SRC); - TEST_ASSERT(check_host_rpusb()); - - wait_for_state_change(port, 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_ATTACHED_SRC); - TEST_ASSERT(mock_get_vbus_pass_en()); - - /* - * 7. DRP transitions from Unattached.SNK to Attached.SNK through - * AttachWait.SNK - * - * a. DRP in Unattached.SNK detects the CC pull-up of CTVPD which is - * in Attached.SRC and DRP enters AttachWait.SNK - * b. DRP in AttachWait.SNK detects that pull up on CC persists for - * tCCDebounce, VBUS present and enters Attached.SNK - */ - - /* - * 8. While the devices are all in their respective attached states: - * a. CTVPD monitors the Host-side port’s CC pin for device attach - * and when detected, enters Unattached.SNK - * b. CTVPD monitors VBUS for Power Source detach and when detected, - * enters Unattached.SNK - * c. Power Source monitors CC for CTVPD detach and when detected, - * enters Unattached.SRC - * d. DRP monitors VBUS for CTVPD detach and when detected, enters - * Unattached.SNK - * e. Additionally, the DRP may query the identity of the cable via - * USB PD on SOP’ when it has sufficient battery power and when - * a Charge-Through VPD is identified enters TryWait.SRC if - * implemented, or enters Unattached.SRC if TryWait.SRC is not - * supported - */ - TEST_ASSERT(ct_connect_source(CC2, VBUS_0)); - - wait_for_state_change(port, 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_UNATTACHED_SNK); - - return EC_SUCCESS; -} - -static int test_ctvpd_behavior_case6(void) -{ - int port = PORT0; - - mock_set_vconn(VCONN_0); - host_disconnect_source(); - TEST_ASSERT(ct_disconnect_source()); - TEST_ASSERT(ct_disconnect_sink()); - - task_wake(PD_PORT_TO_TASK_ID(port)); - task_wait_event(40 * MSEC); - - /* - * CASE 6: The following describes the behavior when a DRP is connected - * to a Charge-Through VCONN-Powered USB Device - * (abbreviated CTVPD) and a Sink is attached to the - * Charge-Through port on the CTVPD. - */ - - /* - * 1. DRP, CTVPD and Sink are all in the unattached state - * - * a. DRP alternates between Unattached.SRC and Unattached.SNK - * b. CTVPD has applied Rd on its Charge-Through port’s CC1 and CC2 - * pins and Rd on the Host-side port’s CC pin - */ - TEST_ASSERT(get_state_tc(port) == TC_UNATTACHED_SNK); - TEST_ASSERT(check_ct_ccs_rd()); - TEST_ASSERT(check_host_ra_rd()); - - /* - * 2. DRP transitions from Unattached.SRC to AttachWait.SRC to - * Attached.SRC - * - * a. DRP in Unattached.SRC detects the CC pull-down of CTVPD which - * is in Unattached.SNK and DRP enters AttachWait.SRC - * b. DRP in AttachWait.SRC detects that pull down on CC persists - * for tCCDebounce, enters Attached.SRC and turns on VBUS and - * VCONN - */ - host_connect_source(VBUS_5); - mock_set_vconn(VCONN_3); - - /* - * 3. CTVPD transitions from Unattached.SNK to Attached.SNK through - * AttachWait.SNK. - * - * a. CTVPD detects the host-side CC pull-up of the DRP and CTVPD - * enters AttachWait.SNK - * b. CTVPD in AttachWait.SNK detects that pull up on the Host-side - * port’s CC persists for tCCDebounce, VCONN present and enters - * Attached.SNK - * c. CTVPD present a high-impedance to ground (above zOPEN) on its - * Charge-Through port’s CC1 and CC2 pins - */ - wait_for_state_change(port, 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_ATTACH_WAIT_SNK); - - wait_for_state_change(port, PD_T_CC_DEBOUNCE + 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_ATTACHED_SNK); - TEST_ASSERT(check_ct_ccs_hz()); - - /* - * 4. While DRP and CTVPD are in their respective attached states, DRP - * discovers the ChargeThrough CTVPD and transitions to - * CTUnattached.SNK - * - * a. DRP (as Source) queries the device identity via USB PD - * (Discover Identity Command) on SOP’. - * b. CTVPD responds on SOP’, advertising that it is a - * Charge-Through VCONN-Powered USB Device - * c. DRP (as Source) removes VBUS - * d. DRP (as Source) changes its Rp to a Rd - * e. DRP (as Sink) continues to provide VCONN and enters - * CTUnattached.SNK - */ - - host_disconnect_source(); - host_connect_sink(SRC_CON_DEF); - - /* - * 5. CTVPD transitions to CTUnattached.VPD - * - * a. CTVPD detects VBUS removal, VCONN presence, the low Host-side - * CC pin and enters CTUnattached.VPD - * b. CTVPD changes its host-side Rd to a Rp termination advertising - * 3.0 A - * c. CTVPD isolates itself from VBUS - * d. CTVPD apply Rd on its Charge-Through port’s CC1 and CC2 pins - */ - wait_for_state_change(port, 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_CT_UNATTACHED_VPD); - TEST_ASSERT(check_host_rp3a0()); - TEST_ASSERT(mock_get_vbus_pass_en() == 0); - TEST_ASSERT(check_ct_ccs_rd()); - - /* - * 6. CTVPD alternates between CTUnattached.VPD and - * CTUnattached.Unsupported - * - * a. CTVPD detects SRC.open on its Charge-Through CC pins and - * starts alternating between CTUnattached.VPD and - * CTUnattached.Unsupported - */ - wait_for_state_change(port, PD_T_DRP_SNK + 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_CT_UNATTACHED_UNSUPPORTED); - - wait_for_state_change(port, PD_T_DRP_SNK + 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_CT_UNATTACHED_VPD); - - wait_for_state_change(port, PD_T_DRP_SNK + 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_CT_UNATTACHED_UNSUPPORTED); - - /* - * 7. CTVPD transitions from CTUnattached.Unsupported to CTTry.SNK - * through CTAttachWait.Unsupported - * - * a. CTVPD in CTUnattached.Unsupported detects the CC pull-down of - * the Sink which is in Unattached.SNK and CTVPD enters - * CTAttachWait.Unsupported - * b. CTVPD in CTAttachWait.Unsupported detects that pull down on CC - * persists for tCCDebounce and enters CTTry.SNK - * c. CTVPD disables Rp termination advertising Default USB Power on - * the ChargeThrough port’s CC pins - * d. CTVPD enables Rd on the Charge-Through port’s CC pins - */ - TEST_ASSERT(ct_connect_sink(CC1, SRC_CON_DEF)); - - wait_for_state_change(port, 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_CT_ATTACH_WAIT_UNSUPPORTED); - - wait_for_state_change(port, PD_T_CC_DEBOUNCE + 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_CT_TRY_SNK); - TEST_ASSERT(check_ct_ccs_rd()); - - /* - * 8. CTVPD transitions from CTTry.SNK to CTAttached.Unsupported - * - * a. CTVPD didn’t detect the CC pull-up of the potential Source - * for tDRPTryWait after tDRPTry and enters - * CTAttached.Unsupported - */ - - wait_for_state_change(port, PD_T_DRP_TRY + PD_T_TRY_WAIT + 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_CT_ATTACHED_UNSUPPORTED); - - /* - * 9. While the CTVPD in CTAttached.Unsupported state, the DRP in - * CTUnattached.SNK state and the Sink in Unattached.SNK state: - * - * a. CTVPD disables the Rd termination on the Charge-Through - * port’s CC pins and applies Rp termination advertising - * Default USB Power - * b. CTVPD exposes a USB Billboard Device Class to the DRP - * indicating that it is connected to an unsupported device on - * its Charge Through port - * c. CTVPD monitors Charge-Though CC pins for Sink detach and when - * detected, enters CTUnattached.VPD - * d. CTVPD monitors VCONN for Host detach and when detected, enters - * Unattached.SNK - * e. DRP monitors CC for CTVPD detach for tVPDDetach and when - * detected, enters Unattached.SNK - * f. DRP monitors VBUS for CTVPD Charge-Through source attach and, - * when detected, enters CTAttached.SNK - */ - - TEST_ASSERT(check_ct_ccs_cc1_rpusb()); - TEST_ASSERT(mock_get_present_billboard() == BB_SNK); - - TEST_ASSERT(ct_disconnect_sink()); - - wait_for_state_change(port, 40 * MSEC); - - TEST_ASSERT(get_state_tc(port) == TC_CT_UNATTACHED_VPD); - - return EC_SUCCESS; -} -#endif - -void run_test(int argc, char **argv) -{ - test_reset(); - - init_port(PORT0); - - /* VPD and CTVPD tests */ - RUN_TEST(test_vpd_host_src_detection); - RUN_TEST(test_vpd_host_src_detection_vbus); - RUN_TEST(test_vpd_host_src_detection_vconn); - RUN_TEST(test_vpd_host_src_detection_message_reception); - - /* CTVPD only tests */ -#if defined(TEST_USB_TYPEC_CTVPD) - /* DRP to VCONN-Powered USB Device (CTVPD) Behavior Tests */ - RUN_TEST(test_ctvpd_behavior_case1); - RUN_TEST(test_ctvpd_behavior_case2); - RUN_TEST(test_ctvpd_behavior_case3); - RUN_TEST(test_ctvpd_behavior_case4); - RUN_TEST(test_ctvpd_behavior_case5); - RUN_TEST(test_ctvpd_behavior_case6); -#endif - - /* Do basic state machine validity checks last. */ - RUN_TEST(test_tc_no_parent_cycles); - RUN_TEST(test_tc_all_states_named); - - /* - * Since you have to include TypeC layer when adding PE layer, the - * PE test would have the same build dependencies, so go ahead and test - * te PE statemachine here so we don't have to create another test exe - */ - RUN_TEST(test_pe_no_parent_cycles); - RUN_TEST(test_pe_all_states_named); - - test_print_result(); -} - diff --git a/test/usb_typec_ctvpd.tasklist b/test/usb_typec_ctvpd.tasklist deleted file mode 100644 index eb41326e3e..0000000000 --- a/test/usb_typec_ctvpd.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TEST_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) diff --git a/test/usb_typec_drp_acc_trysrc.c b/test/usb_typec_drp_acc_trysrc.c deleted file mode 100644 index 96ed5601b7..0000000000 --- a/test/usb_typec_drp_acc_trysrc.c +++ /dev/null @@ -1,841 +0,0 @@ -/* Copyright 2019 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. - * - * Test USB Type-C Dual Role Port, Audio Accessory, and Try.SRC Device module. - */ -#include "charge_manager.h" -#include "mock/tcpc_mock.h" -#include "mock/usb_mux_mock.h" -#include "system.h" -#include "task.h" -#include "test_util.h" -#include "timer.h" -#include "usb_mux.h" -#include "usb_pd_tcpm.h" -#include "usb_sm_checks.h" -#include "usb_tc_sm.h" - -#define PORT0 0 - -/* - * Amount of time to wait after a specified timeout. Allows for an extra loop - * through statemachine plus 1000 calls to clock - */ -#define FUDGE (6 * MSEC) - -/* Unreachable time in future */ -#define TIMER_DISABLED 0xffffffffffffffff - -/* Install Mock TCPC and MUX drivers */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { - { - .drv = &mock_tcpc_driver, - }, -}; - -const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { - { - .driver = &mock_usb_mux_driver, - } -}; - -void charge_manager_set_ceil(int port, enum ceil_requestor requestor, int ceil) -{ - /* Do Nothing, but needed for linking */ -} - -void pd_resume_check_pr_swap_needed(int port) -{ - /* Do Nothing, but needed for linking */ -} - -/* Vbus is turned on at the board level, so mock it here for our purposes */ -static bool board_vbus_enabled[CONFIG_USB_PD_PORT_MAX_COUNT]; - -static bool mock_get_vbus_enabled(int port) -{ - return board_vbus_enabled[port]; -} - -static void mock_set_vbus_enabled(int port, bool enabled) -{ - board_vbus_enabled[port] = enabled; -} - -static void mock_reset_vbus_enabled(void) -{ - int i; - - for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) - mock_set_vbus_enabled(i, false); -} - -int pd_set_power_supply_ready(int port) -{ - mock_set_vbus_enabled(port, true); - return EC_SUCCESS; -} - -void pd_power_supply_reset(int port) -{ - mock_set_vbus_enabled(port, false); -} - -__maybe_unused static int test_mux_con_dis_as_src(void) -{ - mock_tcpc.should_print_call = false; - mock_usb_mux.num_set_calls = 0; - - /* Update CC lines send state machine event to process */ - mock_tcpc.cc1 = TYPEC_CC_VOLT_RD; - mock_tcpc.cc2 = TYPEC_CC_VOLT_OPEN; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - pd_set_dual_role(0, PD_DRP_TOGGLE_ON); - - /* This wait trainsitions through AttachWait.SRC then Attached.SRC */ - task_wait_event(SECOND); - - /* We are in Attached.SRC now */ - TEST_EQ(mock_usb_mux.state, USB_PD_MUX_USB_ENABLED, "%d"); - TEST_EQ(mock_usb_mux.num_set_calls, 1, "%d"); - - mock_tcpc.cc1 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.cc2 = TYPEC_CC_VOLT_OPEN; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - /* This wait will go through TryWait.SNK then to Unattached.SNK */ - task_wait_event(10 * SECOND); - - /* We are in Unattached.SNK. The mux should have detached */ - TEST_EQ(mock_usb_mux.state, USB_PD_MUX_NONE, "%d"); - TEST_EQ(mock_usb_mux.num_set_calls, 2, "%d"); - - return EC_SUCCESS; -} - -__maybe_unused static int test_mux_con_dis_as_snk(void) -{ - mock_tcpc.should_print_call = false; - mock_usb_mux.num_set_calls = 0; - - /* - * we expect a PD-capable partner to be able to check below - * whether it is data capable. - */ - tc_pd_connection(0, 1); - - /* Update CC lines send state machine event to process */ - mock_tcpc.cc1 = TYPEC_CC_VOLT_RP_3_0; - mock_tcpc.cc2 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.vbus_level = 1; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - /* This wait will go through AttachWait.SNK to Attached.SNK */ - task_wait_event(5 * SECOND); - - /* - * We are in Attached.SNK now, but the port partner isn't data capable - * so we should not connect the USB data mux. - */ - TEST_EQ(mock_usb_mux.state, USB_PD_MUX_NONE, "%d"); - - mock_tcpc.cc1 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.cc2 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.vbus_level = 0; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - /* This wait will go through TryWait.SNK then to Unattached.SNK */ - task_wait_event(10 * SECOND); - - /* We are in Unattached.SNK. The mux should have detached */ - TEST_EQ(mock_usb_mux.state, USB_PD_MUX_NONE, "%d"); - TEST_LE(mock_usb_mux.num_set_calls, 2, "%d"); - - return EC_SUCCESS; -} - -__maybe_unused static int test_power_role_set(void) -{ - mock_tcpc.num_calls_to_set_header = 0; - - /* - * We need to allow auto toggling to see the port partner attach - * as a sink - */ - pd_set_dual_role(PORT0, PD_DRP_TOGGLE_ON); - - /* Update CC lines send state machine event to process */ - mock_tcpc.cc1 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.cc2 = TYPEC_CC_VOLT_RD; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - task_wait_event(10 * SECOND); - - /* We are in Attached.SRC now */ - TEST_EQ(mock_tcpc.last.power_role, PD_ROLE_SOURCE, "%d"); - TEST_EQ(mock_tcpc.last.data_role, PD_ROLE_DFP, "%d"); - - /* - * We allow 2 separate calls to update the header since power and data - * role updates can be separate calls depending on the state is came - * from. - */ - TEST_LE(mock_tcpc.num_calls_to_set_header, 2, "%d"); - - return EC_SUCCESS; -} - -__maybe_unused static int test_polarity_cc1_default(void) -{ - /* Update CC lines send state machine event to process */ - ccprints("[Test] Partner connects as SRC USB-DEF on CC1"); - mock_tcpc.cc1 = TYPEC_CC_VOLT_RP_DEF; - mock_tcpc.cc2 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.vbus_level = 1; - - /* - * In this test we are expecting value of polarity, which is set by - * default for tcpc mock. Initialize it with something else, in order - * to catch possible errors. - */ - mock_tcpc.last.polarity = POLARITY_COUNT; - - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - /* Before tCCDebounce elapses, we should SRC */ - task_wait_event(PD_T_CC_DEBOUNCE + FUDGE); - TEST_EQ(mock_tcpc.last.polarity, POLARITY_CC1, "%d"); - - return EC_SUCCESS; -} - -__maybe_unused static int test_polarity_cc1_1A5(void) -{ - /* Update CC lines send state machine event to process */ - ccprints("[Test] Partner connects as SRC USB-1A5 on CC1"); - mock_tcpc.cc1 = TYPEC_CC_VOLT_RP_1_5; - mock_tcpc.cc2 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.vbus_level = 1; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - /* Before tCCDebounce elapses, we should SRC */ - task_wait_event(PD_T_CC_DEBOUNCE + FUDGE); - TEST_EQ(mock_tcpc.last.polarity, POLARITY_CC1, "%d"); - - return EC_SUCCESS; -} - -__maybe_unused static int test_polarity_cc1_3A0(void) -{ - /* Update CC lines send state machine event to process */ - ccprints("[Test] Partner connects as SRC USB-3A0 on CC1"); - mock_tcpc.cc1 = TYPEC_CC_VOLT_RP_3_0; - mock_tcpc.cc2 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.vbus_level = 1; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - /* Before tCCDebounce elapses, we should SRC */ - task_wait_event(PD_T_CC_DEBOUNCE + FUDGE); - TEST_EQ(mock_tcpc.last.polarity, POLARITY_CC1, "%d"); - - return EC_SUCCESS; -} - -__maybe_unused static int test_polarity_cc2_default(void) -{ - /* Update CC lines send state machine event to process */ - ccprints("[Test] Partner connects as SRC USB-DEF on CC2"); - mock_tcpc.cc1 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.cc2 = TYPEC_CC_VOLT_RP_DEF; - mock_tcpc.vbus_level = 1; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - /* Before tCCDebounce elapses, we should SRC */ - task_wait_event(PD_T_CC_DEBOUNCE + FUDGE); - TEST_EQ(mock_tcpc.last.polarity, POLARITY_CC2, "%d"); - - return EC_SUCCESS; -} - -__maybe_unused static int test_polarity_cc2_1A5(void) -{ - /* Update CC lines send state machine event to process */ - ccprints("[Test] Partner connects as SRC USB-1A5 on CC2"); - mock_tcpc.cc1 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.cc2 = TYPEC_CC_VOLT_RP_1_5; - mock_tcpc.vbus_level = 1; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - /* Before tCCDebounce elapses, we should SRC */ - task_wait_event(PD_T_CC_DEBOUNCE + FUDGE); - TEST_EQ(mock_tcpc.last.polarity, POLARITY_CC2, "%d"); - - return EC_SUCCESS; -} - -__maybe_unused static int test_polarity_cc2_3A0(void) -{ - /* Update CC lines send state machine event to process */ - ccprints("[Test] Partner connects as SRC USB-3A0 on CC2"); - mock_tcpc.cc1 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.cc2 = TYPEC_CC_VOLT_RP_3_0; - mock_tcpc.vbus_level = 1; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - /* Before tCCDebounce elapses, we should SRC */ - task_wait_event(PD_T_CC_DEBOUNCE + FUDGE); - TEST_EQ(mock_tcpc.last.polarity, POLARITY_CC2, "%d"); - - return EC_SUCCESS; -} - -__maybe_unused static int test_polarity_dts_cc1_default(void) -{ - /* Update CC lines send state machine event to process */ - ccprints("[Test] Partner connects as SRC DTS-Default on CC1"); - mock_tcpc.cc1 = TYPEC_CC_VOLT_RP_3_0; - mock_tcpc.cc2 = TYPEC_CC_VOLT_RP_1_5; - mock_tcpc.vbus_level = 1; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - /* Before tCCDebounce elapses, we should SRC */ - task_wait_event(PD_T_CC_DEBOUNCE + FUDGE); - TEST_EQ(mock_tcpc.last.polarity, POLARITY_CC1_DTS, "%d"); - - return EC_SUCCESS; -} - -__maybe_unused static int test_polarity_dts_cc1_1A5(void) -{ - /* Update CC lines send state machine event to process */ - ccprints("[Test] Partner connects as SRC DTS-1A5 on CC1"); - mock_tcpc.cc1 = TYPEC_CC_VOLT_RP_1_5; - mock_tcpc.cc2 = TYPEC_CC_VOLT_RP_DEF; - mock_tcpc.vbus_level = 1; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - /* Before tCCDebounce elapses, we should SRC */ - task_wait_event(PD_T_CC_DEBOUNCE + FUDGE); - TEST_EQ(mock_tcpc.last.polarity, POLARITY_CC1_DTS, "%d"); - - return EC_SUCCESS; -} - -__maybe_unused static int test_polarity_dts_cc1_3A0(void) -{ - /* Update CC lines send state machine event to process */ - ccprints("[Test] Partner connects as SRC DTS-1A5 on CC1"); - mock_tcpc.cc1 = TYPEC_CC_VOLT_RP_3_0; - mock_tcpc.cc2 = TYPEC_CC_VOLT_RP_DEF; - mock_tcpc.vbus_level = 1; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - /* Before tCCDebounce elapses, we should SRC */ - task_wait_event(PD_T_CC_DEBOUNCE + FUDGE); - TEST_EQ(mock_tcpc.last.polarity, POLARITY_CC1_DTS, "%d"); - - return EC_SUCCESS; -} - -__maybe_unused static int test_polarity_dts_cc2_default(void) -{ - /* Update CC lines send state machine event to process */ - ccprints("[Test] Partner connects as SRC DTS-Default on CC2"); - mock_tcpc.cc1 = TYPEC_CC_VOLT_RP_1_5; - mock_tcpc.cc2 = TYPEC_CC_VOLT_RP_3_0; - mock_tcpc.vbus_level = 1; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - /* Before tCCDebounce elapses, we should SRC */ - task_wait_event(PD_T_CC_DEBOUNCE + FUDGE); - TEST_EQ(mock_tcpc.last.polarity, POLARITY_CC2_DTS, "%d"); - - return EC_SUCCESS; -} - -__maybe_unused static int test_polarity_dts_cc2_1A5(void) -{ - /* Update CC lines send state machine event to process */ - ccprints("[Test] Partner connects as SRC DTS-1A5 on CC2"); - mock_tcpc.cc1 = TYPEC_CC_VOLT_RP_DEF; - mock_tcpc.cc2 = TYPEC_CC_VOLT_RP_1_5; - mock_tcpc.vbus_level = 1; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - /* Before tCCDebounce elapses, we should SRC */ - task_wait_event(PD_T_CC_DEBOUNCE + FUDGE); - TEST_EQ(mock_tcpc.last.polarity, POLARITY_CC2_DTS, "%d"); - - return EC_SUCCESS; -} - -__maybe_unused static int test_polarity_dts_cc2_3A0(void) -{ - /* Update CC lines send state machine event to process */ - ccprints("[Test] Partner connects as SRC DTS-1A5 on CC2"); - mock_tcpc.cc1 = TYPEC_CC_VOLT_RP_DEF; - mock_tcpc.cc2 = TYPEC_CC_VOLT_RP_3_0; - mock_tcpc.vbus_level = 1; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - /* Before tCCDebounce elapses, we should SRC */ - task_wait_event(PD_T_CC_DEBOUNCE + FUDGE); - TEST_EQ(mock_tcpc.last.polarity, POLARITY_CC2_DTS, "%d"); - - return EC_SUCCESS; -} - -/* Record any calls that would change our CCs to Rp */ -static int changes_to_rp; -static int record_changes_to_rp(int port, int pull) -{ - if (pull == TYPEC_CC_RP) - ++changes_to_rp; - - return EC_SUCCESS; -}; - -__maybe_unused static int test_try_src_disabled(void) -{ - changes_to_rp = 0; - mock_tcpc.callbacks.set_cc = &record_changes_to_rp; - tc_try_src_override(TRY_SRC_OVERRIDE_OFF); - - /* Update CC lines send state machine event to process */ - ccprints("[Test] Partner connects as SRC"); - mock_tcpc.cc1 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.cc2 = TYPEC_CC_VOLT_RP_3_0; - mock_tcpc.vbus_level = 1; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - /* Wait a long time past many potential transitions */ - task_wait_event(10 * SECOND); - - TEST_EQ(mock_tcpc.last.cc, TYPEC_CC_RD, "%d"); - TEST_EQ(changes_to_rp, 0, "%d"); - TEST_EQ(mock_tcpc.last.power_role, PD_ROLE_SINK, "%d"); - TEST_EQ(mock_tcpc.last.data_role, PD_ROLE_UFP, "%d"); - TEST_EQ(mock_tcpc.last.polarity, POLARITY_CC2, "%d"); - TEST_EQ(tc_is_attached_snk(PORT0), true, "%d"); - - return EC_SUCCESS; -} - -/* Act like a PD device that switches to opposite role */ -static int switch_to_opposite_role(int port, int pull) -{ - static enum tcpc_cc_pull last_pull = -1; - - if (pull == last_pull) - return EC_SUCCESS; - - last_pull = pull; - - if (pull == TYPEC_CC_RP) { - /* If host is setting Rp, then CCs will negotiate as SNK */ - mock_tcpc.cc1 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.cc2 = TYPEC_CC_VOLT_RD; - mock_tcpc.vbus_level = 0; - ccprints("[Test] Partner presents SNK"); - } else if (pull == TYPEC_CC_RD) { - /* If host is setting Rd, then CCs will negotiate as SRC */ - mock_tcpc.cc1 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.cc2 = TYPEC_CC_VOLT_RP_3_0; - mock_tcpc.vbus_level = 1; - ccprints("[Test] Partner presents SRC with Vbus ON"); - } - - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - return EC_SUCCESS; -}; - -__maybe_unused static int test_try_src_partner_switches(void) -{ - mock_tcpc.callbacks.set_cc = &switch_to_opposite_role; - tc_try_src_override(TRY_SRC_OVERRIDE_ON); - - /* Update CC lines send state machine event to process */ - ccprints("[Test] Partner connects as SRC"); - mock_tcpc.cc1 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.cc2 = TYPEC_CC_VOLT_RP_3_0; - mock_tcpc.vbus_level = 1; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - /* We are in AttachWait.SNK now */ - /* Before tCCDebounce elapses, we should still be a SNK */ - task_wait_event(PD_T_CC_DEBOUNCE / 2); - TEST_EQ(mock_tcpc.last.cc, TYPEC_CC_RD, "%d"); - task_wait_event(PD_T_CC_DEBOUNCE / 2); - - /* We are in Try.SRC now */ - /* Before tCCDebounce elapses, we should SRC */ - task_wait_event(PD_T_CC_DEBOUNCE / 2); - TEST_EQ(mock_tcpc.last.cc, TYPEC_CC_RP, "%d"); - - /* Wait for tCCDebounce to elapse, then should be SRC */ - task_wait_event(PD_T_CC_DEBOUNCE); - TEST_EQ(mock_tcpc.last.power_role, PD_ROLE_SOURCE, "%d"); - TEST_EQ(mock_tcpc.last.data_role, PD_ROLE_DFP, "%d"); - TEST_EQ(mock_tcpc.last.polarity, POLARITY_CC2, "%d"); - TEST_EQ(tc_is_attached_src(PORT0), true, "%d"); - - return EC_SUCCESS; -} - -/* Act like a non-PD charger that always presents Vbus and Rp lines */ -static int dumb_src_charger_cc_response(int port, int pull) -{ - static enum tcpc_cc_pull last_pull = -1; - - if (pull == last_pull) - return EC_SUCCESS; - - last_pull = pull; - - if (pull == TYPEC_CC_RP) { - /* If host is setting Rp, then CCs will open */ - mock_tcpc.cc1 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.cc2 = TYPEC_CC_VOLT_OPEN; - } else if (pull == TYPEC_CC_RD) { - /* If host is setting Rd, then CCs will negotiate */ - mock_tcpc.cc1 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.cc2 = TYPEC_CC_VOLT_RP_3_0; - } - mock_tcpc.vbus_level = 1; - - ccprints("[Test] Partner presents SRC with Vbus ON"); - - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - return EC_SUCCESS; -}; - -__maybe_unused static int test_try_src_partner_does_not_switch_vbus(void) -{ - tc_try_src_override(TRY_SRC_OVERRIDE_ON); - mock_tcpc.callbacks.set_cc = &dumb_src_charger_cc_response; - - /* Update CC lines send state machine event to process */ - ccprints("[Test] Partner connects as SRC"); - mock_tcpc.cc1 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.cc2 = TYPEC_CC_VOLT_RP_3_0; - mock_tcpc.vbus_level = 1; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - /* We are in AttachWait.SNK now */ - /* Before tCCDebounce elapses, we should still be a SNK */ - task_wait_event(PD_T_CC_DEBOUNCE / 2); - TEST_EQ(mock_tcpc.last.cc, TYPEC_CC_RD, "%d"); - task_wait_event(PD_T_CC_DEBOUNCE / 2); - - /* We are in Try.SRC now */ - /* Before tCCDebounce elapses, we should SRC */ - task_wait_event(PD_T_CC_DEBOUNCE / 2); - TEST_EQ(mock_tcpc.last.cc, TYPEC_CC_RP, "%d"); - - /* - * Wait for tTryTimeout to elapse, then should be - * presenting SNK resistors again but not connected yet, until we - * debounce Vbus. - */ - task_wait_event(PD_T_TRY_TIMEOUT); - TEST_EQ(mock_tcpc.last.power_role, PD_ROLE_SINK, "%d"); - TEST_EQ(tc_is_attached_snk(PORT0), false, "%d"); - - /* Once we debouce Vbus, then we should be connected */ - task_wait_event(PD_T_CC_DEBOUNCE); - TEST_EQ(mock_tcpc.last.power_role, PD_ROLE_SINK, "%d"); - TEST_EQ(mock_tcpc.last.data_role, PD_ROLE_UFP, "%d"); - TEST_EQ(mock_tcpc.last.polarity, POLARITY_CC2, "%d"); - TEST_EQ(tc_is_attached_snk(PORT0), true, "%d"); - - return EC_SUCCESS; -} - -/* Act like a PD charger that will drop Vbus when CC lines are open */ -static int src_charger_drops_vbus_cc_response(int port, int pull) -{ - static enum tcpc_cc_pull last_pull = -1; - - if (pull == last_pull) - return EC_SUCCESS; - - last_pull = pull; - - if (pull == TYPEC_CC_RP) { - /* If host is setting Rp, then CCs will open */ - mock_tcpc.cc1 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.cc2 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.vbus_level = 0; - ccprints("[Test] Partner presents SRC with Vbus OFF"); - } else if (pull == TYPEC_CC_RD) { - /* If host is setting Rd, then CCs will negotiate */ - mock_tcpc.cc1 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.cc2 = TYPEC_CC_VOLT_RP_3_0; - mock_tcpc.vbus_level = 1; - ccprints("[Test] Partner presents SRC with Vbus ON"); - } - - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - return EC_SUCCESS; -}; - -__maybe_unused static int test_try_src_partner_does_not_switch_no_vbus(void) -{ - tc_try_src_override(TRY_SRC_OVERRIDE_ON); - mock_tcpc.callbacks.set_cc = &src_charger_drops_vbus_cc_response; - - /* Update CC lines send state machine event to process */ - ccprints("[Test] Partner connects as SRC"); - mock_tcpc.cc1 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.cc2 = TYPEC_CC_VOLT_RP_3_0; - mock_tcpc.vbus_level = 1; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - /* We are in AttachWait.SNK now */ - /* Before tCCDebounce elapses, we should still be a SNK */ - task_wait_event(PD_T_CC_DEBOUNCE / 2); - TEST_EQ(mock_tcpc.last.cc, TYPEC_CC_RD, "%d"); - task_wait_event(PD_T_CC_DEBOUNCE / 2); - - /* We are in Try.SRC now */ - /* Before tCCDebounce elapses, we should SRC */ - task_wait_event(PD_T_CC_DEBOUNCE / 2); - TEST_EQ(mock_tcpc.last.cc, TYPEC_CC_RP, "%d"); - - /* - * Wait for tTryTimeout to elapse, then should be - * presenting SNK resistors again but not connected yet, until we - * debounce Vbus. - */ - task_wait_event(PD_T_DRP_TRY); - TEST_EQ(mock_tcpc.last.power_role, PD_ROLE_SINK, "%d"); - TEST_EQ(tc_is_attached_snk(PORT0), false, "%d"); - - /* Once we debouce Vbus, then we should be connected */ - task_wait_event(PD_T_CC_DEBOUNCE); - TEST_EQ(mock_tcpc.last.power_role, PD_ROLE_SINK, "%d"); - TEST_EQ(mock_tcpc.last.data_role, PD_ROLE_UFP, "%d"); - TEST_EQ(mock_tcpc.last.polarity, POLARITY_CC2, "%d"); - TEST_EQ(tc_is_attached_snk(PORT0), true, "%d"); - - return EC_SUCCESS; -} - -/* Record the cc voltages */ -static enum tcpc_cc_pull cc_pull[16]; -static int cc_pull_count; -static int record_cc_pull(int port, int pull) -{ - if (cc_pull_count < ARRAY_SIZE(cc_pull)) - cc_pull[cc_pull_count++] = pull; - - return EC_SUCCESS; -}; - -__maybe_unused static int test_cc_open_on_normal_reset(void) -{ - uint32_t flags = system_get_reset_flags(); - - cc_pull_count = 0; - mock_tcpc.callbacks.set_cc = &record_cc_pull; - - system_clear_reset_flags(EC_RESET_FLAG_POWER_ON); - - task_set_event(TASK_ID_PD_C0, TASK_EVENT_RESET_DONE); - task_wait_event(SECOND * 10); - - /* Ensure that the first CC set call was to open (error recovery). */ - TEST_GT(cc_pull_count, 0, "%d"); - TEST_EQ(cc_pull[0], TYPEC_CC_OPEN, "%d"); - - /* Ensure that the second CC set call was to Rd (sink) */ - TEST_GT(cc_pull_count, 1, "%d"); - TEST_EQ(cc_pull[1], TYPEC_CC_RD, "%d"); - - /* Reset system flags after test */ - system_set_reset_flags(flags); - - return EC_SUCCESS; -} - -__maybe_unused static int test_cc_rd_on_por_reset(void) -{ - uint32_t flags = system_get_reset_flags(); - - cc_pull_count = 0; - mock_tcpc.callbacks.set_cc = &record_cc_pull; - - system_set_reset_flags(EC_RESET_FLAG_POWER_ON); - - task_set_event(TASK_ID_PD_C0, TASK_EVENT_RESET_DONE); - task_wait_event(SECOND * 10); - - /* Ensure that the first CC set call was to Rd (sink) */ - TEST_GT(cc_pull_count, 0, "%d"); - TEST_EQ(cc_pull[0], TYPEC_CC_RD, "%d"); - - /* Reset system flags after test */ - system_clear_reset_flags(~flags); - - return EC_SUCCESS; -} - -__maybe_unused static int test_auto_toggle_delay(void) -{ - uint64_t time; - - /* Start with auto toggle disabled so we can time the transition */ - pd_set_dual_role(PORT0, PD_DRP_TOGGLE_OFF); - task_wait_event(SECOND); - - /* Enabled auto toggle and start the timer for the transition */ - pd_set_dual_role(PORT0, PD_DRP_TOGGLE_ON); - time = get_time().val; - - /* - * Ensure we do not transition to auto toggle from Rd or Rp in less time - * than tDRP minimum (50 ms) * dcSRC.DRP minimum (30%) = 15 ms. - * Otherwise we can confuse external partners with the first transition - * to auto toggle. - */ - task_wait_event(SECOND); - TEST_GT(mock_tcpc.first_call_to_enable_auto_toggle - time, - (uint64_t)15 * MSEC, "%" PRIu64); - - return EC_SUCCESS; -} - -__maybe_unused static int test_auto_toggle_delay_early_connect(void) -{ - cc_pull_count = 0; - mock_tcpc.callbacks.set_cc = &record_cc_pull; - mock_tcpc.first_call_to_enable_auto_toggle = TIMER_DISABLED; - - /* Start with auto toggle disabled */ - pd_set_dual_role(PORT0, PD_DRP_TOGGLE_OFF); - task_wait_event(SECOND); - - /* Enabled auto toggle */ - pd_set_dual_role(PORT0, PD_DRP_TOGGLE_ON); - - /* Wait less than tDRP_SNK(40ms) and tDRP_SRC(30ms) */ - task_wait_event(MIN(PD_T_DRP_SNK, PD_T_DRP_SRC) - (10 * MSEC)); - - /* Have partner connect as SRC */ - mock_tcpc.cc1 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.cc2 = TYPEC_CC_VOLT_RP_3_0; - mock_tcpc.vbus_level = 1; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - /* Ensure the auto toggle enable was never called */ - task_wait_event(SECOND); - TEST_EQ(mock_tcpc.first_call_to_enable_auto_toggle, - TIMER_DISABLED, "%" PRIu64); - - /* Ensure that the first CC set call was to Rd. */ - TEST_GT(cc_pull_count, 0, "%d"); - TEST_EQ(cc_pull[0], TYPEC_CC_RD, "%d"); - - return EC_SUCCESS; -} - -/* TODO(b/153071799): test as SNK monitor for Vbus disconnect (not CC line) */ -__maybe_unused static int test_typec_dis_as_src(void) -{ - mock_tcpc.should_print_call = false; - - /* Update CC lines send state machine event to process */ - mock_tcpc.cc1 = TYPEC_CC_VOLT_RD; - mock_tcpc.cc2 = TYPEC_CC_VOLT_OPEN; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - pd_set_dual_role(0, PD_DRP_TOGGLE_ON); - - /* This wait trainsitions through AttachWait.SRC then Attached.SRC */ - task_wait_event(SECOND); - - /* - * We are in Attached.SRC now, verify: - * - Vbus was turned on - * - Rp is set - * - polarity is detected as CC1 - * - Rp was set to default configured level - */ - TEST_EQ(mock_tcpc.last.cc, TYPEC_CC_RP, "%d"); - TEST_EQ(mock_tcpc.last.polarity, POLARITY_CC1, "%d"); - TEST_EQ(mock_tcpc.last.rp, CONFIG_USB_PD_PULLUP, "%d"); - TEST_EQ(mock_get_vbus_enabled(0), true, "%d"); - - /* Force a detach through CC open */ - mock_tcpc.cc1 = TYPEC_CC_VOLT_OPEN; - mock_tcpc.cc2 = TYPEC_CC_VOLT_OPEN; - task_set_event(TASK_ID_PD_C0, PD_EVENT_CC); - - /* This wait will go through TryWait.SNK then to Unattached.SNK */ - task_wait_event(10 * SECOND); - - /* We are in Unattached.SNK. Verify Vbus has been removed */ - TEST_EQ(mock_get_vbus_enabled(0), false, "%d"); - - return EC_SUCCESS; -} - -/* Reset the mocks before each test */ -void before_test(void) -{ - mock_usb_mux_reset(); - mock_tcpc_reset(); - mock_reset_vbus_enabled(); - - /* Restart the PD task and let it settle */ - task_set_event(TASK_ID_PD_C0, TASK_EVENT_RESET_DONE); - task_wait_event(SECOND); - - /* Print out TCPC calls for easier debugging */ - mock_tcpc.should_print_call = true; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_polarity_cc1_default); - RUN_TEST(test_polarity_cc1_1A5); - RUN_TEST(test_polarity_cc1_3A0); - - RUN_TEST(test_polarity_cc2_default); - RUN_TEST(test_polarity_cc2_1A5); - RUN_TEST(test_polarity_cc2_3A0); - - RUN_TEST(test_polarity_dts_cc1_default); - RUN_TEST(test_polarity_dts_cc1_1A5); - RUN_TEST(test_polarity_dts_cc1_3A0); - - RUN_TEST(test_polarity_dts_cc2_default); - RUN_TEST(test_polarity_dts_cc2_1A5); - RUN_TEST(test_polarity_dts_cc2_3A0); - - RUN_TEST(test_mux_con_dis_as_src); - RUN_TEST(test_mux_con_dis_as_snk); - RUN_TEST(test_power_role_set); - - RUN_TEST(test_typec_dis_as_src); - - RUN_TEST(test_try_src_disabled); - RUN_TEST(test_try_src_partner_switches); - RUN_TEST(test_try_src_partner_does_not_switch_vbus); - RUN_TEST(test_try_src_partner_does_not_switch_no_vbus); - - RUN_TEST(test_cc_open_on_normal_reset); - RUN_TEST(test_cc_rd_on_por_reset); - RUN_TEST(test_auto_toggle_delay); - RUN_TEST(test_auto_toggle_delay_early_connect); - - /* Do basic state machine validity checks last. */ - RUN_TEST(test_tc_no_parent_cycles); - RUN_TEST(test_tc_all_states_named); - - test_print_result(); -} diff --git a/test/usb_typec_drp_acc_trysrc.mocklist b/test/usb_typec_drp_acc_trysrc.mocklist deleted file mode 100644 index 71c2e2cee9..0000000000 --- a/test/usb_typec_drp_acc_trysrc.mocklist +++ /dev/null @@ -1,8 +0,0 @@ -/* Copyright 2019 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 CONFIG_TEST_MOCK_LIST \ - MOCK(USB_MUX) \ - MOCK(TCPC) diff --git a/test/usb_typec_drp_acc_trysrc.tasklist b/test/usb_typec_drp_acc_trysrc.tasklist deleted file mode 100644 index eb41326e3e..0000000000 --- a/test/usb_typec_drp_acc_trysrc.tasklist +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2019 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. - */ - -/** - * See CONFIG_TEST_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) diff --git a/test/usb_typec_vpd.tasklist b/test/usb_typec_vpd.tasklist deleted file mode 120000 index 3e39415ded..0000000000 --- a/test/usb_typec_vpd.tasklist +++ /dev/null @@ -1 +0,0 @@ -usb_typec_ctvpd.tasklist
\ No newline at end of file diff --git a/test/utils.c b/test/utils.c deleted file mode 100644 index 7fe27b4549..0000000000 --- a/test/utils.c +++ /dev/null @@ -1,538 +0,0 @@ -/* Copyright 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. - * - * Test common utilities. - */ - -#include "common.h" -#include "console.h" -#include "shared_mem.h" -#include "system.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" -#include "watchdog.h" - -static int test_memmove(void) -{ - int i; - timestamp_t t0, t1, t2, t3; - char *buf; - const int buf_size = 1000; - const int len = 400; - const int iteration = 1000; - - TEST_ASSERT(shared_mem_acquire(buf_size, &buf) == EC_SUCCESS); - - for (i = 0; i < len; ++i) - buf[i] = i & 0x7f; - for (i = len; i < buf_size; ++i) - buf[i] = 0; - - t0 = get_time(); - for (i = 0; i < iteration; ++i) - memmove(buf + 101, buf, len); /* unaligned */ - t1 = get_time(); - TEST_ASSERT_ARRAY_EQ(buf + 101, buf, len); - ccprintf(" (speed gain: %" PRId64 " ->", t1.val-t0.val); - - t2 = get_time(); - for (i = 0; i < iteration; ++i) - memmove(buf + 100, buf, len); /* aligned */ - t3 = get_time(); - ccprintf(" %" PRId64 " us) ", t3.val-t2.val); - TEST_ASSERT_ARRAY_EQ(buf + 100, buf, len); - - /* Expected about 4x speed gain. Use 3x because it fluctuates */ - if (!IS_ENABLED(EMU_BUILD)) { - /* - * The speed gain is too unpredictable on host, especially on - * buildbots. Skip it if we are running in the emulator. - */ - int expected_speedup = 3; - - if (IS_ENABLED(CHIP_FAMILY_STM32H7)) - expected_speedup = 2; - - TEST_ASSERT((t1.val - t0.val) > - (unsigned int)(t3.val - t2.val) * expected_speedup); - } - - /* Test small moves */ - memmove(buf + 1, buf, 1); - TEST_ASSERT_ARRAY_EQ(buf + 1, buf, 1); - memmove(buf + 5, buf, 4); - memmove(buf + 1, buf, 4); - TEST_ASSERT_ARRAY_EQ(buf + 1, buf + 5, 4); - - shared_mem_release(buf); - return EC_SUCCESS; -} - -static int test_memcpy(void) -{ - int i; - timestamp_t t0, t1, t2, t3; - char *buf; - const int buf_size = 1000; - const int len = 400; - const int dest_offset = 500; - const int iteration = 1000; - - TEST_ASSERT(shared_mem_acquire(buf_size, &buf) == EC_SUCCESS); - - for (i = 0; i < len; ++i) - buf[i] = i & 0x7f; - for (i = len; i < buf_size; ++i) - buf[i] = 0; - - t0 = get_time(); - for (i = 0; i < iteration; ++i) - memcpy(buf + dest_offset + 1, buf, len); /* unaligned */ - t1 = get_time(); - TEST_ASSERT_ARRAY_EQ(buf + dest_offset + 1, buf, len); - ccprintf(" (speed gain: %" PRId64 " ->", t1.val-t0.val); - - t2 = get_time(); - for (i = 0; i < iteration; ++i) - memcpy(buf + dest_offset, buf, len); /* aligned */ - t3 = get_time(); - ccprintf(" %" PRId64 " us) ", t3.val-t2.val); - TEST_ASSERT_ARRAY_EQ(buf + dest_offset, buf, len); - - /* Expected about 4x speed gain. Use 3x because it fluctuates */ -#ifndef EMU_BUILD - /* - * The speed gain is too unpredictable on host, especially on - * buildbots. Skip it if we are running in the emulator. - */ - TEST_ASSERT((t1.val-t0.val) > (unsigned)(t3.val-t2.val) * 3); -#endif - - memcpy(buf + dest_offset + 1, buf + 1, len - 1); - TEST_ASSERT_ARRAY_EQ(buf + dest_offset + 1, buf + 1, len - 1); - - /* Test small copies */ - memcpy(buf + dest_offset, buf, 1); - TEST_ASSERT_ARRAY_EQ(buf + dest_offset, buf, 1); - memcpy(buf + dest_offset, buf, 4); - TEST_ASSERT_ARRAY_EQ(buf + dest_offset, buf, 4); - memcpy(buf + dest_offset + 1, buf, 1); - TEST_ASSERT_ARRAY_EQ(buf + dest_offset + 1, buf, 1); - memcpy(buf + dest_offset + 1, buf, 4); - TEST_ASSERT_ARRAY_EQ(buf + dest_offset + 1, buf, 4); - - shared_mem_release(buf); - return EC_SUCCESS; -} - -/* Plain memset, used as a reference to measure speed gain */ -static void *dumb_memset(void *dest, int c, int len) -{ - char *d = (char *)dest; - while (len > 0) { - *(d++) = c; - len--; - } - return dest; -} - -static int test_memset(void) -{ - int i; - timestamp_t t0, t1, t2, t3; - char *buf; - const int buf_size = 1000; - const int len = 400; - const int iteration = 1000; - - TEST_ASSERT(shared_mem_acquire(buf_size, &buf) == EC_SUCCESS); - - t0 = get_time(); - for (i = 0; i < iteration; ++i) - dumb_memset(buf, 1, len); - t1 = get_time(); - TEST_ASSERT_MEMSET(buf, (char)1, len); - ccprintf(" (speed gain: %" PRId64 " ->", t1.val-t0.val); - - t2 = get_time(); - for (i = 0; i < iteration; ++i) - memset(buf, 1, len); - t3 = get_time(); - TEST_ASSERT_MEMSET(buf, (char)1, len); - ccprintf(" %" PRId64 " us) ", t3.val-t2.val); - - /* - * Expected about 4x speed gain. Use smaller value since it - * fluctuates. - */ - if (!IS_ENABLED(EMU_BUILD)) { - /* - * The speed gain is too unpredictable on host, especially on - * buildbots. Skip it if we are running in the emulator. - */ - int expected_speedup = 3; - - if (IS_ENABLED(CHIP_FAMILY_STM32F4) || - IS_ENABLED(CHIP_FAMILY_STM32H7)) - expected_speedup = 2; - - TEST_ASSERT((t1.val - t0.val) > - (unsigned int)(t3.val - t2.val) * expected_speedup); - } - - memset(buf, 128, len); - TEST_ASSERT_MEMSET(buf, (char)128, len); - - memset(buf, -2, len); - TEST_ASSERT_MEMSET(buf, (char)-2, len); - - memset(buf + 1, 1, len - 2); - TEST_ASSERT_MEMSET(buf + 1, (char)1, len - 2); - - shared_mem_release(buf); - return EC_SUCCESS; -} - -static int test_memchr(void) -{ - char *buf = "1234"; - - TEST_ASSERT(memchr("123567890", '4', 8) == NULL); - TEST_ASSERT(memchr("123", '3', 2) == NULL); - TEST_ASSERT(memchr(buf, '3', 4) == buf + 2); - TEST_ASSERT(memchr(buf, '4', 4) == buf + 3); - return EC_SUCCESS; -} - -static int test_uint64divmod_0(void) -{ - uint64_t n = 8567106442584750ULL; - int d = 54870071; - int r = uint64divmod(&n, d); - - TEST_CHECK(r == 5991285 && n == 156134415ULL); -} - -static int test_uint64divmod_1(void) -{ - uint64_t n = 8567106442584750ULL; - int d = 2; - int r = uint64divmod(&n, d); - - TEST_CHECK(r == 0 && n == 4283553221292375ULL); -} - -static int test_uint64divmod_2(void) -{ - uint64_t n = 8567106442584750ULL; - int d = 0; - int r = uint64divmod(&n, d); - - TEST_CHECK(r == 0 && n == 0ULL); -} - -static int test_get_next_bit(void) -{ - uint32_t mask = 0x10001010; - - TEST_ASSERT(get_next_bit(&mask) == 28); - TEST_ASSERT(mask == 0x1010); - TEST_ASSERT(get_next_bit(&mask) == 12); - TEST_ASSERT(mask == 0x10); - TEST_ASSERT(get_next_bit(&mask) == 4); - TEST_ASSERT(mask == 0x0); - - return EC_SUCCESS; -} - -static int test_shared_mem(void) -{ - int i; - int sz = shared_mem_size(); - char *mem1, *mem2; - - TEST_ASSERT(shared_mem_acquire(sz, &mem1) == EC_SUCCESS); - TEST_ASSERT(shared_mem_acquire(sz, &mem2) == EC_ERROR_BUSY); - - for (i = 0; i < 256; ++i) { - memset(mem1, i, sz); - TEST_ASSERT_MEMSET(mem1, (char)i, sz); - if ((i & 0xf) == 0) - msleep(20); /* Yield to other tasks */ - } - - shared_mem_release(mem1); - - return EC_SUCCESS; -} - -static int test_scratchpad(void) -{ - uint32_t scratchpad_value; - - system_set_scratchpad(0xfeed); - TEST_EQ(system_get_scratchpad(&scratchpad_value), EC_SUCCESS, "%d"); - TEST_EQ(scratchpad_value, 0xfeed, "%d"); - - return EC_SUCCESS; -} - -static int test_cond_t(void) -{ - cond_t c; - - /* one-shot? */ - cond_init_false(&c); - cond_set_true(&c); - TEST_ASSERT(cond_went_true(&c)); - TEST_ASSERT(!cond_went_true(&c)); - TEST_ASSERT(!cond_went_true(&c)); - cond_set_false(&c); - TEST_ASSERT(cond_went_false(&c)); - TEST_ASSERT(!cond_went_false(&c)); - TEST_ASSERT(!cond_went_false(&c)); - - /* one-shot when initially true? */ - cond_init_true(&c); - cond_set_false(&c); - TEST_ASSERT(cond_went_false(&c)); - TEST_ASSERT(!cond_went_false(&c)); - TEST_ASSERT(!cond_went_false(&c)); - cond_set_true(&c); - TEST_ASSERT(cond_went_true(&c)); - TEST_ASSERT(!cond_went_true(&c)); - TEST_ASSERT(!cond_went_true(&c)); - - /* still one-shot even if set multiple times? */ - cond_init_false(&c); - cond_set_true(&c); - cond_set_true(&c); - cond_set_true(&c); - cond_set_true(&c); - cond_set_true(&c); - cond_set_true(&c); - TEST_ASSERT(cond_went_true(&c)); - TEST_ASSERT(!cond_went_true(&c)); - TEST_ASSERT(!cond_went_true(&c)); - cond_set_true(&c); - cond_set_false(&c); - cond_set_false(&c); - cond_set_false(&c); - cond_set_false(&c); - cond_set_false(&c); - TEST_ASSERT(cond_went_false(&c)); - TEST_ASSERT(!cond_went_false(&c)); - TEST_ASSERT(!cond_went_false(&c)); - - /* only the detected transition direction resets it */ - cond_set_true(&c); - TEST_ASSERT(!cond_went_false(&c)); - TEST_ASSERT(cond_went_true(&c)); - TEST_ASSERT(!cond_went_false(&c)); - TEST_ASSERT(!cond_went_true(&c)); - cond_set_false(&c); - TEST_ASSERT(!cond_went_true(&c)); - TEST_ASSERT(!cond_went_true(&c)); - TEST_ASSERT(cond_went_false(&c)); - TEST_ASSERT(!cond_went_false(&c)); - TEST_ASSERT(!cond_went_false(&c)); - TEST_ASSERT(!cond_went_true(&c)); - TEST_ASSERT(!cond_went_true(&c)); - - /* multiple transitions between checks should notice both edges */ - cond_set_true(&c); - cond_set_false(&c); - cond_set_true(&c); - cond_set_false(&c); - cond_set_true(&c); - cond_set_false(&c); - TEST_ASSERT(cond_went_true(&c)); - TEST_ASSERT(!cond_went_true(&c)); - TEST_ASSERT(!cond_went_true(&c)); - TEST_ASSERT(!cond_went_true(&c)); - TEST_ASSERT(cond_went_false(&c)); - TEST_ASSERT(!cond_went_false(&c)); - TEST_ASSERT(!cond_went_false(&c)); - TEST_ASSERT(!cond_went_false(&c)); - TEST_ASSERT(!cond_went_true(&c)); - TEST_ASSERT(!cond_went_true(&c)); - TEST_ASSERT(!cond_went_false(&c)); - - /* Still has last value? */ - cond_set_true(&c); - cond_set_false(&c); - cond_set_true(&c); - cond_set_false(&c); - TEST_ASSERT(cond_is_false(&c)); - cond_set_false(&c); - cond_set_true(&c); - cond_set_false(&c); - cond_set_true(&c); - TEST_ASSERT(cond_is_true(&c)); - - /* well okay then */ - return EC_SUCCESS; -} - -static int test_mula32(void) -{ - uint64_t r = 0x0; - uint64_t r2 = 0x0; - uint32_t b = 0x1; - uint32_t c = 0x1; - uint32_t i; - timestamp_t t0, t1; - - t0 = get_time(); - for (i = 0; i < 5000000; i++) { - r = mula32(b, c, r + (r >> 32)); - r2 = mulaa32(b, c, r2 >> 32, r2); - b = (b << 13) ^ (b >> 2) ^ i; - c = (c << 16) ^ (c >> 7) ^ i; - watchdog_reload(); - } - t1 = get_time(); - - ccprintf("After %d iterations, r=%08x%08x, r2=%08x%08x (time: %d)\n", - i, (uint32_t)(r >> 32), (uint32_t)r, - (uint32_t)(r2 >> 32), (uint32_t)r2, t1.le.lo-t0.le.lo); - TEST_ASSERT(r == 0x9df59b9fb0ab9d96L); - TEST_ASSERT(r2 == 0x9df59b9fb0beabd6L); - - /* well okay then */ - return EC_SUCCESS; -} - -#define SWAP_TEST_HARNESS(t, x, y) \ - do { \ - t a = x, b = y; \ - swap(a, b); \ - TEST_ASSERT(a == y); \ - TEST_ASSERT(b == x); \ - } while (0) - - -static int test_swap(void) -{ - SWAP_TEST_HARNESS(uint8_t, UINT8_MAX, 0); - SWAP_TEST_HARNESS(uint16_t, UINT16_MAX, 0); - SWAP_TEST_HARNESS(uint32_t, UINT32_MAX, 0); - SWAP_TEST_HARNESS(float, 1, 0); - SWAP_TEST_HARNESS(double, 1, 0); - return EC_SUCCESS; -} - -static int test_bytes_are_trivial(void) -{ - static const uint8_t all0x00[] = { 0x00, 0x00, 0x00 }; - static const uint8_t all0xff[] = { 0xff, 0xff, 0xff, 0xff }; - static const uint8_t nontrivial1[] = { 0x00, 0x01, 0x02 }; - static const uint8_t nontrivial2[] = { 0xdd, 0xee, 0xff }; - static const uint8_t nontrivial3[] = { 0x00, 0x00, 0x00, 0xff }; - static const uint8_t nontrivial4[] = { 0xff, 0x00, 0x00, 0x00 }; - - TEST_ASSERT(bytes_are_trivial(all0x00, sizeof(all0x00))); - TEST_ASSERT(bytes_are_trivial(all0xff, sizeof(all0xff))); - TEST_ASSERT(!bytes_are_trivial(nontrivial1, sizeof(nontrivial1))); - TEST_ASSERT(!bytes_are_trivial(nontrivial2, sizeof(nontrivial2))); - TEST_ASSERT(!bytes_are_trivial(nontrivial3, sizeof(nontrivial3))); - TEST_ASSERT(!bytes_are_trivial(nontrivial4, sizeof(nontrivial4))); - - return EC_SUCCESS; -} - -test_static int test_is_aligned(void) -{ - TEST_EQ(is_aligned(2, 0), false, "%d"); - TEST_EQ(is_aligned(2, 1), true, "%d"); - TEST_EQ(is_aligned(2, 2), true, "%d"); - TEST_EQ(is_aligned(2, 3), false, "%d"); - TEST_EQ(is_aligned(2, 4), false, "%d"); - - TEST_EQ(is_aligned(3, 0), false, "%d"); - TEST_EQ(is_aligned(3, 1), true, "%d"); - TEST_EQ(is_aligned(3, 2), false, "%d"); - TEST_EQ(is_aligned(3, 3), false, "%d"); - TEST_EQ(is_aligned(3, 4), false, "%d"); - - return EC_SUCCESS; -} - -test_static int test_safe_memcmp(void) -{ - const char str1[] = "abc"; - const char str2[] = "def"; - const char str3[] = "abc"; - - /* Verify that the compiler hasn't optimized str1 and str3 to point - * to the same underlying memory. - */ - TEST_NE(str1, str3, "%p"); - - TEST_EQ(safe_memcmp(NULL, NULL, 0), 0, "%d"); - TEST_EQ(safe_memcmp(str1, str2, sizeof(str1)), 1, "%d"); - TEST_EQ(safe_memcmp(str1, str3, sizeof(str1)), 0, "%d"); - return EC_SUCCESS; -} - -test_static int test_alignment_log2(void) -{ - TEST_EQ(alignment_log2(1), 0, "%d"); - TEST_EQ(alignment_log2(2), 1, "%d"); - TEST_EQ(alignment_log2(5), 0, "%d"); - TEST_EQ(alignment_log2(0x10070000), 16, "%d"); - TEST_EQ(alignment_log2(0x80000000), 31, "%d"); - return EC_SUCCESS; -} - -test_static int test_binary_first_base3_from_bits(void) -{ - int n0[] = {0, 0, 0}; /* LSB first */ - int n7[] = {1, 1, 1}; - int n8[] = {2, 0, 0}; - int n9[] = {2, 1, 0}; - int n10[] = {0, 2, 0}; - int n11[] = {1, 2, 0}; - int n18[] = {0, 0, 2}; - int n26[] = {2, 2, 2}; - int n38[] = {1, 2, 0, 1}; - - TEST_EQ(binary_first_base3_from_bits(n0, ARRAY_SIZE(n0)), 0, "%d"); - TEST_EQ(binary_first_base3_from_bits(n7, ARRAY_SIZE(n7)), 7, "%d"); - TEST_EQ(binary_first_base3_from_bits(n8, ARRAY_SIZE(n8)), 8, "%d"); - TEST_EQ(binary_first_base3_from_bits(n9, ARRAY_SIZE(n9)), 9, "%d"); - TEST_EQ(binary_first_base3_from_bits(n10, ARRAY_SIZE(n10)), 10, "%d"); - TEST_EQ(binary_first_base3_from_bits(n11, ARRAY_SIZE(n11)), 11, "%d"); - TEST_EQ(binary_first_base3_from_bits(n18, ARRAY_SIZE(n18)), 18, "%d"); - TEST_EQ(binary_first_base3_from_bits(n26, ARRAY_SIZE(n26)), 26, "%d"); - TEST_EQ(binary_first_base3_from_bits(n38, ARRAY_SIZE(n38)), 38, "%d"); - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_memmove); - RUN_TEST(test_memcpy); - RUN_TEST(test_memset); - RUN_TEST(test_memchr); - RUN_TEST(test_uint64divmod_0); - RUN_TEST(test_uint64divmod_1); - RUN_TEST(test_uint64divmod_2); - RUN_TEST(test_get_next_bit); - RUN_TEST(test_shared_mem); - RUN_TEST(test_scratchpad); - RUN_TEST(test_cond_t); - RUN_TEST(test_mula32); - RUN_TEST(test_swap); - RUN_TEST(test_bytes_are_trivial); - RUN_TEST(test_is_aligned); - RUN_TEST(test_safe_memcmp); - RUN_TEST(test_alignment_log2); - RUN_TEST(test_binary_first_base3_from_bits); - - test_print_result(); -} diff --git a/test/utils.tasklist b/test/utils.tasklist deleted file mode 100644 index da0ab6211a..0000000000 --- a/test/utils.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/utils_str.c b/test/utils_str.c deleted file mode 100644 index f184abffa6..0000000000 --- a/test/utils_str.c +++ /dev/null @@ -1,312 +0,0 @@ -/* Copyright 2017 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. - * - * Test common utilities (string functions). - */ - -#include "common.h" -#include "console.h" -#include "system.h" -#include "printf.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -static int test_isalpha(void) -{ - TEST_CHECK(isalpha('a') && isalpha('z') && isalpha('A') && - isalpha('Z') && !isalpha('0') && !isalpha('~') && - !isalpha(' ') && !isalpha('\0') && !isalpha('\n')); -} - -static int test_isprint(void) -{ - TEST_CHECK(isprint('a') && isprint('z') && isprint('A') && - isprint('Z') && isprint('0') && isprint('~') && - isprint(' ') && !isprint('\0') && !isprint('\n')); -} - -static int test_strstr(void) -{ - const char s1[] = "abcde"; - - TEST_ASSERT(strstr(s1, "ab") == s1); - TEST_ASSERT(strstr(s1, "") == NULL); - TEST_ASSERT(strstr("", "ab") == NULL); - TEST_ASSERT(strstr("", "x") == NULL); - TEST_ASSERT(strstr(s1, "de") == &s1[3]); - TEST_ASSERT(strstr(s1, "def") == NULL); - - return EC_SUCCESS; -} - -static int test_strtoi(void) -{ - char *e; - - TEST_ASSERT(strtoi("10", &e, 0) == 10); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoi("010", &e, 0) == 8); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoi("+010", &e, 0) == 8); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoi("-010", &e, 0) == -8); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoi("0x1f z", &e, 0) == 31); - TEST_ASSERT(e && (*e == ' ')); - TEST_ASSERT(strtoi("0X1f z", &e, 0) == 31); - TEST_ASSERT(e && (*e == ' ')); - TEST_ASSERT(strtoi("10a", &e, 16) == 266); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoi("0x02C", &e, 16) == 44); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoi("+0x02C", &e, 16) == 44); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoi("-0x02C", &e, 16) == -44); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoi("0x02C", &e, 0) == 44); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoi("+0x02C", &e, 0) == 44); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoi("-0x02C", &e, 0) == -44); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoi("0X02C", &e, 16) == 44); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoi("+0X02C", &e, 16) == 44); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoi("-0X02C", &e, 16) == -44); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoi("0X02C", &e, 0) == 44); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoi("+0X02C", &e, 0) == 44); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoi("-0X02C", &e, 0) == -44); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoi(" -12", &e, 0) == -12); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoi("!", &e, 0) == 0); - TEST_ASSERT(e && (*e == '!')); - TEST_ASSERT(strtoi("+!", &e, 0) == 0); - TEST_ASSERT(e && (*e == '!')); - TEST_ASSERT(strtoi("+0!", &e, 0) == 0); - TEST_ASSERT(e && (*e == '!')); - TEST_ASSERT(strtoi("+0x!", &e, 0) == 0); - TEST_ASSERT(e && (*e == '!')); - TEST_ASSERT(strtoi("+0X!", &e, 0) == 0); - TEST_ASSERT(e && (*e == '!')); - - return EC_SUCCESS; -} - -static int test_strtoull(void) -{ - char *e; - - TEST_ASSERT(strtoull("10", &e, 0) == 10); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoull("010", &e, 0) == 8); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoull("+010", &e, 0) == 8); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoull("-010", &e, 0) == 0); - TEST_ASSERT(e && (*e == '-')); - TEST_ASSERT(strtoull("0x1f z", &e, 0) == 31); - TEST_ASSERT(e && (*e == ' ')); - TEST_ASSERT(strtoull("0X1f z", &e, 0) == 31); - TEST_ASSERT(e && (*e == ' ')); - TEST_ASSERT(strtoull("10a", &e, 16) == 266); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoull("0x02C", &e, 16) == 44); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoull("+0x02C", &e, 16) == 44); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoull("-0x02C", &e, 16) == 0); - TEST_ASSERT(e && (*e == '-')); - TEST_ASSERT(strtoull("0x02C", &e, 0) == 44); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoull("+0x02C", &e, 0) == 44); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoull("-0x02C", &e, 0) == 0); - TEST_ASSERT(e && (*e == '-')); - TEST_ASSERT(strtoull("0X02C", &e, 16) == 44); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoull("+0X02C", &e, 16) == 44); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoull("-0X02C", &e, 16) == 0); - TEST_ASSERT(e && (*e == '-')); - TEST_ASSERT(strtoull("0X02C", &e, 0) == 44); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoull("+0X02C", &e, 0) == 44); - TEST_ASSERT(e && (*e == '\0')); - TEST_ASSERT(strtoull("-0X02C", &e, 0) == 0); - TEST_ASSERT(e && (*e == '-')); - TEST_ASSERT(strtoull(" -12", &e, 0) == 0); - TEST_ASSERT(e && (*e == '-')); - TEST_ASSERT(strtoull("!", &e, 0) == 0); - TEST_ASSERT(e && (*e == '!')); - TEST_ASSERT(strtoull("+!", &e, 0) == 0); - TEST_ASSERT(e && (*e == '!')); - TEST_ASSERT(strtoull("+0!", &e, 0) == 0); - TEST_ASSERT(e && (*e == '!')); - TEST_ASSERT(strtoull("+0x!", &e, 0) == 0); - TEST_ASSERT(e && (*e == '!')); - TEST_ASSERT(strtoull("+0X!", &e, 0) == 0); - TEST_ASSERT(e && (*e == '!')); - - return EC_SUCCESS; -} - -static int test_parse_bool(void) -{ - int v; - - TEST_ASSERT(parse_bool("on", &v) == 1); - TEST_ASSERT(v == 1); - TEST_ASSERT(parse_bool("off", &v) == 1); - TEST_ASSERT(v == 0); - TEST_ASSERT(parse_bool("enable", &v) == 1); - TEST_ASSERT(v == 1); - TEST_ASSERT(parse_bool("disable", &v) == 1); - TEST_ASSERT(v == 0); - TEST_ASSERT(parse_bool("di", &v) == 0); - TEST_ASSERT(parse_bool("en", &v) == 0); - TEST_ASSERT(parse_bool("of", &v) == 0); - - return EC_SUCCESS; -} - -static int test_strzcpy(void) -{ - char dest[10]; - - strzcpy(dest, "test", 10); - TEST_ASSERT_ARRAY_EQ("test", dest, 5); - strzcpy(dest, "testtesttest", 10); - TEST_ASSERT_ARRAY_EQ("testtestt", dest, 10); - strzcpy(dest, "aaaa", -1); - TEST_ASSERT_ARRAY_EQ("testtestt", dest, 10); - - return EC_SUCCESS; -} - -static int test_strncpy(void) -{ - char dest[10]; - - strncpy(dest, "test", 10); - TEST_ASSERT_ARRAY_EQ("test", dest, 5); - strncpy(dest, "12345", 6); - TEST_ASSERT_ARRAY_EQ("12345", dest, 6); - strncpy(dest, "testtesttest", 10); - TEST_ASSERT_ARRAY_EQ("testtestte", dest, 10); - - return EC_SUCCESS; -} - -static int test_strncmp(void) -{ - TEST_ASSERT(strncmp("123", "123", 8) == 0); - TEST_ASSERT(strncmp("789", "456", 8) > 0); - TEST_ASSERT(strncmp("abc", "abd", 4) < 0); - TEST_ASSERT(strncmp("abc", "abd", 2) == 0); - return EC_SUCCESS; -} - -static int test_strlen(void) -{ - TEST_CHECK(strlen("this is a string") == 16); -} - -static int test_strnlen(void) -{ - TEST_ASSERT(strnlen("this is a string", 17) == 16); - TEST_ASSERT(strnlen("this is a string", 16) == 16); - TEST_ASSERT(strnlen("this is a string", 5) == 5); - - return EC_SUCCESS; -} - -static int test_strcasecmp(void) -{ - TEST_CHECK((strcasecmp("test string", "TEST strIng") == 0) && - (strcasecmp("test123!@#", "TesT123!@#") == 0) && - (strcasecmp("lower", "UPPER") != 0)); -} - -static int test_strncasecmp(void) -{ - TEST_CHECK((strncasecmp("test string", "TEST str", 4) == 0) && - (strncasecmp("test string", "TEST str", 8) == 0) && - (strncasecmp("test123!@#", "TesT321!@#", 5) != 0) && - (strncasecmp("test123!@#", "TesT321!@#", 4) == 0) && - (strncasecmp("1test123!@#", "1TesT321!@#", 5) == 0) && - (strncasecmp("1test123", "teststr", 0) == 0)); -} - -static int test_atoi(void) -{ - TEST_CHECK((atoi(" 901") == 901) && - (atoi("-12c") == -12) && - (atoi(" 0 ") == 0) && - (atoi("\t111") == 111)); -} - -static int test_snprintf(void) -{ - char buffer[32]; - - TEST_CHECK(snprintf(buffer, sizeof(buffer), "%u", 1234) == 4); - TEST_CHECK(strncmp(buffer, "1234", sizeof(buffer))); -} - -static int test_strcspn(void) -{ - const char str1[] = "abc"; - const char str2[] = "This is a string\nwith newlines!"; - - TEST_EQ(strcspn(str1, "a"), (size_t)0, "%zu"); - TEST_EQ(strcspn(str1, "b"), (size_t)1, "%zu"); - TEST_EQ(strcspn(str1, "c"), (size_t)2, "%zu"); - TEST_EQ(strcspn(str1, "ccc"), (size_t)2, "%zu"); - TEST_EQ(strcspn(str1, "cba"), (size_t)0, "%zu"); - TEST_EQ(strcspn(str1, "cb"), (size_t)1, "%zu"); - TEST_EQ(strcspn(str1, "bc"), (size_t)1, "%zu"); - TEST_EQ(strcspn(str1, "cbc"), (size_t)1, "%zu"); - TEST_EQ(strcspn(str1, "z"), strlen(str1), "%zu"); - TEST_EQ(strcspn(str1, "xyz"), strlen(str1), "%zu"); - TEST_EQ(strcspn(str1, ""), strlen(str1), "%zu"); - - TEST_EQ(strcspn(str2, " "), (size_t)4, "%zu"); - TEST_EQ(strcspn(str2, "\n"), (size_t)16, "%zu"); - TEST_EQ(strcspn(str2, "\n "), (size_t)4, "%zu"); - TEST_EQ(strcspn(str2, "!"), strlen(str2) - 1, "%zu"); - TEST_EQ(strcspn(str2, "z"), strlen(str2), "%zu"); - TEST_EQ(strcspn(str2, "z!"), strlen(str2) - 1, "%zu"); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_isalpha); - RUN_TEST(test_isprint); - RUN_TEST(test_strstr); - RUN_TEST(test_strtoi); - RUN_TEST(test_strtoull); - RUN_TEST(test_parse_bool); - RUN_TEST(test_strzcpy); - RUN_TEST(test_strncpy); - RUN_TEST(test_strncmp); - RUN_TEST(test_strlen); - RUN_TEST(test_strnlen); - RUN_TEST(test_strcasecmp); - RUN_TEST(test_strncasecmp); - RUN_TEST(test_atoi); - RUN_TEST(test_snprintf); - RUN_TEST(test_strcspn); - - test_print_result(); -} diff --git a/test/utils_str.tasklist b/test/utils_str.tasklist deleted file mode 100644 index 7150f17cbd..0000000000 --- a/test/utils_str.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2017 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/vboot.c b/test/vboot.c deleted file mode 100644 index 7dab08ac05..0000000000 --- a/test/vboot.c +++ /dev/null @@ -1,141 +0,0 @@ -/* Copyright 2017 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. - * - * Test vboot - */ - -#include "common.h" -#include "rsa.h" -#include "test_util.h" -#include "vboot.h" -#include "rsa2048-3.h" -#include "rwsig.h" - -struct vboot_key { - struct vb21_packed_key vb21_key; - struct rsa_public_key key_data; -}; - -struct vboot_sig { - struct vb21_signature vb21_sig; - uint8_t sig_data[RSANUMBYTES]; -}; - -static void reset_data(struct vboot_key *k, struct vboot_sig *s) -{ - k->vb21_key.c.magic = VB21_MAGIC_PACKED_KEY; - k->vb21_key.key_offset = sizeof(struct vb21_packed_key); - k->vb21_key.key_size = sizeof(rsa_data); - memcpy(&k->key_data, rsa_data, sizeof(rsa_data)); - - s->vb21_sig.c.magic = VB21_MAGIC_SIGNATURE; - s->vb21_sig.sig_size = RSANUMBYTES; - s->vb21_sig.sig_offset = sizeof(struct vb21_signature); - s->vb21_sig.sig_alg = k->vb21_key.sig_alg; - s->vb21_sig.hash_alg = k->vb21_key.hash_alg; - s->vb21_sig.data_size = CONFIG_RW_SIZE - CONFIG_RW_SIG_SIZE - 32; - memcpy(s->sig_data, sig, sizeof(s->sig_data)); -} - -static int test_vboot(void) -{ - struct vboot_key k; - struct vboot_sig s; - uint8_t data[CONFIG_RW_SIZE]; - int len; - int err; - - /* Success */ - reset_data(&k, &s); - memset(data, 0xff, CONFIG_RW_SIZE); - err = vb21_is_packed_key_valid(&k.vb21_key); - TEST_ASSERT(err == EC_SUCCESS); - err = vb21_is_signature_valid(&s.vb21_sig, &k.vb21_key); - TEST_ASSERT(err == EC_SUCCESS); - len = s.vb21_sig.data_size; - err = vboot_is_padding_valid(data, len, - CONFIG_RW_SIZE - CONFIG_RW_SIG_SIZE); - TEST_ASSERT(err == EC_SUCCESS); - - /* Invalid magic */ - reset_data(&k, &s); - k.vb21_key.c.magic = VB21_MAGIC_SIGNATURE; - err = vb21_is_packed_key_valid(&k.vb21_key); - TEST_ASSERT(err == EC_ERROR_VBOOT_KEY_MAGIC); - - /* Invalid key size */ - reset_data(&k, &s); - k.vb21_key.key_size--; - err = vb21_is_packed_key_valid(&k.vb21_key); - TEST_ASSERT(err == EC_ERROR_VBOOT_KEY_SIZE); - - /* Invalid magic */ - reset_data(&k, &s); - s.vb21_sig.c.magic = VB21_MAGIC_PACKED_KEY; - err = vb21_is_signature_valid(&s.vb21_sig, &k.vb21_key); - TEST_ASSERT(err == EC_ERROR_VBOOT_SIG_MAGIC); - - /* Invalid sig size */ - reset_data(&k, &s); - s.vb21_sig.sig_size--; - err = vb21_is_signature_valid(&s.vb21_sig, &k.vb21_key); - TEST_ASSERT(err == EC_ERROR_VBOOT_SIG_SIZE); - - /* Sig algorithm mismatch */ - reset_data(&k, &s); - s.vb21_sig.sig_alg++; - err = vb21_is_signature_valid(&s.vb21_sig, &k.vb21_key); - TEST_ASSERT(err == EC_ERROR_VBOOT_SIG_ALGORITHM); - - /* Hash algorithm mismatch */ - reset_data(&k, &s); - s.vb21_sig.hash_alg++; - err = vb21_is_signature_valid(&s.vb21_sig, &k.vb21_key); - TEST_ASSERT(err == EC_ERROR_VBOOT_HASH_ALGORITHM); - - /* Invalid sig_offset */ - reset_data(&k, &s); - s.vb21_sig.sig_offset--; - err = vb21_is_signature_valid(&s.vb21_sig, &k.vb21_key); - TEST_ASSERT(err == EC_ERROR_VBOOT_SIG_OFFSET); - - /* Invalid data size */ - reset_data(&k, &s); - s.vb21_sig.data_size = CONFIG_RW_SIZE; - err = vb21_is_signature_valid(&s.vb21_sig, &k.vb21_key); - TEST_ASSERT(err == EC_ERROR_VBOOT_DATA_SIZE); - - /* Invalid padding */ - reset_data(&k, &s); - len = s.vb21_sig.data_size; - data[len] = 0; - err = vboot_is_padding_valid(data, len, - CONFIG_RW_SIZE - CONFIG_RW_SIG_SIZE); - TEST_ASSERT(err == EC_ERROR_INVAL); - - /* Invalid padding size */ - reset_data(&k, &s); - len = s.vb21_sig.data_size + 1; - err = vboot_is_padding_valid(data, len, - CONFIG_RW_SIZE - CONFIG_RW_SIG_SIZE); - TEST_ASSERT(err == EC_ERROR_INVAL); - - /* Padding size is too large */ - reset_data(&k, &s); - len = s.vb21_sig.data_size + 64; - err = vboot_is_padding_valid(data, len, - CONFIG_RW_SIZE - CONFIG_RW_SIG_SIZE); - TEST_ASSERT(err == EC_ERROR_INVAL); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_vboot); - - test_print_result(); -} diff --git a/test/vboot.tasklist b/test/vboot.tasklist deleted file mode 100644 index 7150f17cbd..0000000000 --- a/test/vboot.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2017 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/version.c b/test/version.c deleted file mode 100644 index ad7571d5f6..0000000000 --- a/test/version.c +++ /dev/null @@ -1,149 +0,0 @@ -/* Copyright 2021 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. - * - * Test ec version - */ - -#include "common.h" -#include "ec_commands.h" -#include "stddef.h" -#include "system.h" -#include "util.h" -#include "test_util.h" - -/* - * Tests that fw version adheres to the expected format. - * Example fw version: host_v2.0.10135+b3e38e380c - */ -static int test_version(void) -{ - const char *fw_version; - size_t board_name_length, major_version_length, minor_version_length, - sub_minor_version_length, hash_length; - const char *major_version_ptr, *minor_version_ptr, - *sub_minor_version_ptr, *hash_ptr; - - fw_version = system_get_version(EC_IMAGE_RO); - - TEST_ASSERT(fw_version != NULL); - - ccprintf("fw_version: %s\n", fw_version); - - TEST_LE(strlen(fw_version), (size_t)32, "%zu"); - - board_name_length = strcspn(fw_version, "_"); - - TEST_GE(board_name_length, (size_t)3, "%zu"); - - major_version_ptr = fw_version + board_name_length + 1; - major_version_length = strcspn(major_version_ptr, "."); - - TEST_GE(major_version_length, (size_t)2, "%zu"); - TEST_EQ(major_version_ptr[0], 'v', "%c"); - for (int i = 1; i < major_version_length; i++) - TEST_ASSERT(isdigit(major_version_ptr[i])); - - minor_version_ptr = major_version_ptr + major_version_length + 1; - minor_version_length = strcspn(minor_version_ptr, "."); - - TEST_GE(minor_version_length, (size_t)1, "%zu"); - for (int i = 0; i < minor_version_length; i++) - TEST_ASSERT(isdigit(minor_version_ptr[i])); - - sub_minor_version_ptr = minor_version_ptr + minor_version_length + 1; - sub_minor_version_length = strcspn(sub_minor_version_ptr, "-+"); - - TEST_GE(sub_minor_version_length, (size_t)1, "%zu"); - for (int i = 0; i < sub_minor_version_length; i++) - TEST_ASSERT(isdigit(sub_minor_version_ptr[i])); - - hash_ptr = sub_minor_version_ptr + sub_minor_version_length + 1; - hash_length = strlen(hash_ptr); - - TEST_GE(hash_length, (size_t)8, "%zu"); - for (int i = 0; i < hash_length; i++) - TEST_ASSERT(isdigit(hash_ptr[i]) || - (hash_ptr[i] >= 'a' && hash_ptr[i] <= 'f')); - - return EC_SUCCESS; -} - -/* - * Tests that cros fwid adheres to the expected format. - * Example cros fwid: host_14175.0.21_08_24 - */ -static int test_fwid(void) -{ - const char *cros_fwid; - size_t board_name_length, major_version_length, minor_version_length, - sub_minor_version_length; - const char *major_version_ptr, *minor_version_ptr, - *sub_minor_version_ptr; - - cros_fwid = system_get_cros_fwid(EC_IMAGE_RO); - - TEST_ASSERT(cros_fwid != NULL); - - ccprintf("cros_fwid: %s\n", cros_fwid); - - TEST_LE(strlen(cros_fwid), (size_t)32, "%zu"); - - board_name_length = strcspn(cros_fwid, "_"); - TEST_GE(board_name_length, (size_t)3, "%zu"); - - major_version_ptr = cros_fwid + board_name_length + 1; - major_version_length = strcspn(major_version_ptr, "."); - TEST_GE(major_version_length, (size_t)5, "%zu"); - - for (int i = 0; i < major_version_length; i++) - TEST_ASSERT(isdigit(major_version_ptr[i])); - - minor_version_ptr = major_version_ptr + major_version_length + 1; - minor_version_length = strcspn(minor_version_ptr, "."); - TEST_GE(minor_version_length, (size_t)1, "%zu"); - - for (int i = 0; i < minor_version_length; i++) - TEST_ASSERT(isdigit(minor_version_ptr[i])); - - sub_minor_version_ptr = minor_version_ptr + minor_version_length + 1; - sub_minor_version_length = strlen(sub_minor_version_ptr); - TEST_GE(sub_minor_version_length, (size_t)1, "%zu"); - - for (int i = 0; i < sub_minor_version_length; i++) - TEST_ASSERT(isdigit(sub_minor_version_ptr[i]) || - sub_minor_version_ptr[i] == '_'); - - return EC_SUCCESS; -} - -/* - * Tests requesting TEST. - * Example fw version: host_v2.0.10135+b3e38e380c - */ -static int test_image_unknown(void) -{ - const char *fw_version; - const char *cros_fwid; - - fw_version = system_get_version(EC_IMAGE_UNKNOWN); - - TEST_ASSERT(fw_version != NULL); - TEST_LE(strlen(fw_version), (size_t)32, "%zu"); - - cros_fwid = system_get_cros_fwid(EC_IMAGE_UNKNOWN); - - TEST_ASSERT(cros_fwid != NULL); - TEST_LE(strlen(cros_fwid), (size_t)32, "%zu"); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - RUN_TEST(test_version); - RUN_TEST(test_fwid); - RUN_TEST(test_image_unknown); - - test_print_result(); -} diff --git a/test/version.tasklist b/test/version.tasklist deleted file mode 100644 index e54ea001bd..0000000000 --- a/test/version.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2021 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/vpd_api.c b/test/vpd_api.c deleted file mode 100644 index 65e86adb96..0000000000 --- a/test/vpd_api.c +++ /dev/null @@ -1,586 +0,0 @@ -/* Copyright 2019 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 "registers.h" -#include "vpd_api.h" -#include "driver/tcpm/tcpm.h" -#include "console.h" -/* - * Polarity based on 'DFP Perspective' (see table USB Type-C Cable and Connector - * Specification) - * - * CC1 CC2 STATE POSITION - * ---------------------------------------- - * open open NC N/A - * Rd open UFP attached 1 - * open Rd UFP attached 2 - * open Ra pwr cable no UFP N/A - * Ra open pwr cable no UFP N/A - * Rd Ra pwr cable & UFP 1 - * Ra Rd pwr cable & UFP 2 - * Rd Rd dbg accessory N/A - * Ra Ra audio accessory N/A - * - * Note, V(Rd) > V(Ra) - */ -#ifndef PD_SRC_RD_THRESHOLD -#define PD_SRC_RD_THRESHOLD PD_SRC_DEF_RD_THRESH_MV -#endif -#ifndef PD_SRC_VNC -#define PD_SRC_VNC PD_SRC_DEF_VNC_MV -#endif - -#ifndef CC_RA -#define CC_RA(port, cc, sel) (cc < pd_src_rd_threshold[ct_cc_rp_value]) -#endif -#define CC_RD(cc) ((cc >= PD_SRC_RD_THRESHOLD) && (cc < PD_SRC_VNC)) -#ifndef CC_NC -#define CC_NC(port, cc, sel) (cc >= PD_SRC_VNC) -#endif - -/* - * Polarity based on 'UFP Perspective'. - * - * CC1 CC2 STATE POSITION - * ---------------------------------------- - * open open NC N/A - * Rp open DFP attached 1 - * open Rp DFP attached 2 - * Rp Rp Accessory attached N/A - */ -#ifndef PD_SNK_VA -#define PD_SNK_VA PD_SNK_VA_MV -#endif - -#define CC_RP(cc) (cc >= PD_SNK_VA) - -/* Mock Board State */ -static enum vpd_pwr mock_vconn_pwr_sel_odl; -static enum vpd_gpo mock_cc1_cc2_rd_l; -static enum vpd_gpo mock_cc_db_en_od; -static enum vpd_gpo mock_cc_rpusb_odh; -static enum vpd_cc mock_ct_cl_sel; -static int mock_mcu_cc_en; -static enum vpd_billboard mock_present_billboard; -static int mock_red_led; -static int mock_green_led; -static int mock_vbus_pass_en; - -static int mock_read_host_vbus; -static int mock_read_ct_vbus; -static int mock_read_vconn; - -static struct mock_pin mock_cc2_rpusb_odh; -static struct mock_pin mock_cc2_rp3a0_rd_l; -static struct mock_pin mock_cc1_rpusb_odh; -static struct mock_pin mock_cc1_rp3a0_rd_l; -static struct mock_pin mock_cc_vpdmcu; -static struct mock_pin mock_cc_rp3a0_rd_l; - -/* Charge-Through pull up/down enabled */ -static int ct_cc_pull; -/* Charge-Through pull up value */ -static int ct_cc_rp_value; - -/* Charge-Through pull up/down enabled */ -static int host_cc_pull; -/* Charge-Through pull up value */ -static int host_cc_rp_value; - -/* Voltage thresholds for Ra attach in normal SRC mode */ -static int pd_src_rd_threshold[TYPEC_RP_RESERVED] = { - PD_SRC_DEF_RD_THRESH_MV, - PD_SRC_1_5_RD_THRESH_MV, - PD_SRC_3_0_RD_THRESH_MV, -}; - -enum vpd_pwr mock_get_vconn_pwr_source(void) -{ - return mock_vconn_pwr_sel_odl; -} - -int mock_get_ct_cc1_rpusb(void) -{ - return mock_cc1_rpusb_odh.value; -} - -int mock_get_ct_cc2_rpusb(void) -{ - return mock_cc2_rpusb_odh.value; -} - -enum vpd_gpo mock_get_ct_rd(void) -{ - return mock_cc1_cc2_rd_l; -} - -enum vpd_gpo mock_get_cc_rpusb_odh(void) -{ - return mock_cc_rpusb_odh; -} - -enum vpd_gpo mock_get_cc_db_en_od(void) -{ - return mock_cc_db_en_od; -} - -enum vpd_cc moch_get_ct_cl_sel(void) -{ - return mock_ct_cl_sel; -} - -int mock_get_mcu_cc_en(void) -{ - return mock_mcu_cc_en; -} - -enum vpd_billboard mock_get_present_billboard(void) -{ - return mock_present_billboard; -} - -int mock_get_red_led(void) -{ - return mock_red_led; -} - -int mock_get_green_led(void) -{ - return mock_green_led; -} - -int mock_get_vbus_pass_en(void) -{ - return mock_vbus_pass_en; -} - -void mock_set_host_cc_sink_voltage(int v) -{ - mock_cc_vpdmcu.value = v; -} - -void mock_set_host_cc_source_voltage(int v) -{ - mock_cc_vpdmcu.value2 = v; -} - -void mock_set_host_vbus(int v) -{ - mock_read_host_vbus = v; -} - -void mock_set_ct_vbus(int v) -{ - mock_read_ct_vbus = v; -} - -void mock_set_vconn(int v) -{ - mock_read_vconn = v; -} - -int mock_get_cfg_cc2_rpusb_odh(void) -{ - return mock_cc2_rpusb_odh.cfg; -} - -int mock_set_cc2_rpusb_odh(int v) -{ - if (mock_cc2_rpusb_odh.cfg == PIN_ADC) { - mock_cc2_rpusb_odh.value = v; - return 1; - } - return 0; -} - -int mock_get_cfg_cc2_rp3a0_rd_l(void) -{ - return mock_cc2_rp3a0_rd_l.cfg; -} - -int mock_set_cc2_rp3a0_rd_l(int v) -{ - if (mock_cc2_rp3a0_rd_l.cfg == PIN_ADC) { - mock_cc2_rp3a0_rd_l.value = v; - return 1; - } - - return 0; -} - -int mock_get_cc1_rpusb_odh(void) -{ - return mock_cc1_rpusb_odh.cfg; -} - -int mock_set_cc1_rpusb_odh(int v) -{ - if (mock_cc1_rpusb_odh.cfg == PIN_ADC) { - mock_cc1_rpusb_odh.value = v; - return 1; - } - - return 0; -} - -int mock_get_cfg_cc_vpdmcu(void) -{ - return mock_cc_vpdmcu.cfg; -} - -enum vpd_pin mock_get_cfg_cc_rp3a0_rd_l(void) -{ - return mock_cc_rp3a0_rd_l.cfg; -} - -int mock_get_cc_rp3a0_rd_l(void) -{ - return mock_cc_rp3a0_rd_l.value; -} - -int mock_get_cfg_cc1_rp3a0_rd_l(void) -{ - return mock_cc1_rp3a0_rd_l.cfg; -} - -int mock_set_cc1_rp3a0_rd_l(int v) -{ - if (mock_cc1_rp3a0_rd_l.cfg == PIN_ADC) { - mock_cc1_rp3a0_rd_l.value = v; - return 1; - } - - return 0; -} - -/* Convert CC voltage to CC status */ -static int vpd_cc_voltage_to_status(int cc_volt, int cc_pull) -{ - /* If we have a pull-up, then we are source, check for Rd. */ - if (cc_pull == TYPEC_CC_RP) { - if (CC_NC(0, cc_volt, 0)) - return TYPEC_CC_VOLT_OPEN; - else if (CC_RA(0, cc_volt, 0)) - return TYPEC_CC_VOLT_RA; - else - return TYPEC_CC_VOLT_RD; - /* If we have a pull-down, then we are sink, check for Rp. */ - } else if (cc_pull == TYPEC_CC_RD || cc_pull == TYPEC_CC_RA_RD) { - if (cc_volt >= TYPE_C_SRC_3000_THRESHOLD) - return TYPEC_CC_VOLT_RP_3_0; - else if (cc_volt >= TYPE_C_SRC_1500_THRESHOLD) - return TYPEC_CC_VOLT_RP_1_5; - else if (CC_RP(cc_volt)) - return TYPEC_CC_VOLT_RP_DEF; - else - return TYPEC_CC_VOLT_OPEN; - } else { - /* If we are open, then always return 0 */ - return 0; - } -} - -void vpd_ct_set_pull(int pull, int rp_value) -{ - ct_cc_pull = pull; - - switch (pull) { - case TYPEC_CC_RP: - ct_cc_rp_value = rp_value; - vpd_cc1_cc2_db_en_l(GPO_HIGH); - switch (rp_value) { - case TYPEC_RP_USB: - vpd_config_cc1_rp3a0_rd_l(PIN_ADC, 0); - vpd_config_cc2_rp3a0_rd_l(PIN_ADC, 0); - vpd_config_cc1_rpusb_odh(PIN_GPO, 1); - vpd_config_cc2_rpusb_odh(PIN_GPO, 1); - break; - case TYPEC_RP_3A0: - vpd_config_cc1_rpusb_odh(PIN_ADC, 0); - vpd_config_cc2_rpusb_odh(PIN_ADC, 0); - vpd_config_cc1_rp3a0_rd_l(PIN_GPO, 1); - vpd_config_cc2_rp3a0_rd_l(PIN_GPO, 1); - break; - } - break; - case TYPEC_CC_RD: - vpd_config_cc1_rpusb_odh(PIN_ADC, 0); - vpd_config_cc2_rpusb_odh(PIN_ADC, 0); - vpd_config_cc1_rp3a0_rd_l(PIN_ADC, 0); - vpd_config_cc2_rp3a0_rd_l(PIN_ADC, 0); - vpd_cc1_cc2_db_en_l(GPO_LOW); - break; - case TYPEC_CC_OPEN: - vpd_cc1_cc2_db_en_l(GPO_HIGH); - vpd_config_cc1_rpusb_odh(PIN_ADC, 0); - vpd_config_cc2_rpusb_odh(PIN_ADC, 0); - vpd_config_cc1_rp3a0_rd_l(PIN_ADC, 0); - vpd_config_cc2_rp3a0_rd_l(PIN_ADC, 0); - break; - } -} - -void vpd_ct_get_cc(int *cc1, int *cc2) -{ - int cc1_v = 0; - int cc2_v = 0; - - switch (ct_cc_pull) { - case TYPEC_CC_RP: - switch (ct_cc_rp_value) { - case TYPEC_RP_USB: - cc1_v = mock_cc1_rp3a0_rd_l.value; - cc2_v = mock_cc2_rp3a0_rd_l.value; - break; - case TYPEC_RP_3A0: - cc1_v = mock_cc1_rpusb_odh.value; - cc2_v = mock_cc2_rpusb_odh.value; - break; - } - - if (!cc1_v && !cc2_v) { - cc1_v = PD_SRC_VNC; - cc2_v = PD_SRC_VNC; - } - break; - case TYPEC_CC_RD: - cc1_v = mock_cc1_rpusb_odh.value; - cc2_v = mock_cc2_rpusb_odh.value; - break; - case TYPEC_CC_OPEN: - *cc1 = 0; - *cc2 = 0; - return; - } - - *cc1 = vpd_cc_voltage_to_status(cc1_v, ct_cc_pull); - *cc2 = vpd_cc_voltage_to_status(cc2_v, ct_cc_pull); -} - -void vpd_host_set_pull(int pull, int rp_value) -{ - host_cc_pull = pull; - - switch (pull) { - case TYPEC_CC_RP: - vpd_cc_db_en_od(GPO_LOW); - host_cc_rp_value = rp_value; - switch (rp_value) { - case TYPEC_RP_USB: - vpd_config_cc_rp3a0_rd_l(PIN_CMP, 0); - vpd_cc_rpusb_odh(GPO_HIGH); - break; - case TYPEC_RP_3A0: - vpd_cc_rpusb_odh(GPO_HZ); - vpd_config_cc_rp3a0_rd_l(PIN_GPO, 1); - break; - } - break; - case TYPEC_CC_RD: - vpd_cc_rpusb_odh(GPO_HZ); - vpd_cc_db_en_od(GPO_LOW); - - vpd_config_cc_rp3a0_rd_l(PIN_GPO, 0); - break; - case TYPEC_CC_RA_RD: - vpd_cc_rpusb_odh(GPO_HZ); - vpd_config_cc_rp3a0_rd_l(PIN_GPO, 0); - - /* - * RA is connected to VCONN - * RD is connected to CC - */ - vpd_cc_db_en_od(GPO_HZ); - break; - case TYPEC_CC_OPEN: - vpd_cc_rpusb_odh(GPO_HZ); - vpd_config_cc_rp3a0_rd_l(PIN_CMP, 0); - vpd_cc_db_en_od(GPO_LOW); - - /* - * Do nothing. CC is open on entry to this function - */ - break; - } -} - -void vpd_host_get_cc(int *cc) -{ - int v; - - if (host_cc_pull == TYPEC_CC_OPEN) { - *cc = 0; - return; - } else if (host_cc_pull == TYPEC_CC_RP) { - v = mock_cc_vpdmcu.value; - } else { - v = mock_cc_vpdmcu.value2; - } - - *cc = vpd_cc_voltage_to_status(v, host_cc_pull); -} - -void vpd_rx_enable(int en) -{ - if (en) { - mock_ct_cl_sel = 0; - mock_mcu_cc_en = 1; - } - - tcpm_set_polarity(0, 0); - tcpm_set_rx_enable(0, en); -} - -/* - * PA1: Configure as ADC, CMP, or GPO - */ -void vpd_config_cc_vpdmcu(enum vpd_pin cfg, int en) -{ - mock_cc_vpdmcu.cfg = cfg; - - if (cfg == PIN_GPO) - mock_cc_vpdmcu.value = en ? 1 : 0; -} - -/* - * PA2: Configure as COMP2_INM6 or GPO - */ -void vpd_config_cc_rp3a0_rd_l(enum vpd_pin cfg, int en) -{ - mock_cc_rp3a0_rd_l.cfg = cfg; - - if (cfg == PIN_GPO) - mock_cc_rp3a0_rd_l.value = en ? 1 : 0; -} - -/* - * PA4: Configure as ADC, CMP, or GPO - */ -void vpd_config_cc1_rp3a0_rd_l(enum vpd_pin cfg, int en) -{ - mock_cc1_rp3a0_rd_l.cfg = cfg; - - if (cfg == PIN_GPO) - mock_cc1_rp3a0_rd_l.value = en ? 1 : 0; -} - -/* - * PA5: Configure as ADC, COMP, or GPO - */ -void vpd_config_cc2_rp3a0_rd_l(enum vpd_pin cfg, int en) -{ - mock_cc2_rp3a0_rd_l.cfg = cfg; - - if (cfg == PIN_GPO) - mock_cc2_rp3a0_rd_l.value = en ? 1 : 0; -} - -/* - * PB0: Configure as ADC or GPO - */ -void vpd_config_cc1_rpusb_odh(enum vpd_pin cfg, int en) -{ - mock_cc1_rpusb_odh.cfg = cfg; - - if (cfg == PIN_GPO) - mock_cc1_rpusb_odh.value = en ? 1 : 0; -} - -/* - * PB1: Configure as ADC or GPO - */ -void vpd_config_cc2_rpusb_odh(enum vpd_pin cfg, int en) -{ - mock_cc2_rpusb_odh.cfg = cfg; - - if (cfg == PIN_GPO) - mock_cc2_rpusb_odh.value = en ? 1 : 0; -} - -int vpd_read_host_vbus(void) -{ - return mock_read_host_vbus; -} - -int vpd_read_ct_vbus(void) -{ - return mock_read_ct_vbus; -} - -int vpd_read_vconn(void) -{ - return mock_read_vconn; -} - -int vpd_is_host_vbus_present(void) -{ - return (vpd_read_host_vbus() >= PD_SNK_VA); -} - -int vpd_is_ct_vbus_present(void) -{ - return (vpd_read_ct_vbus() >= PD_SNK_VA); -} - -int vpd_is_vconn_present(void) -{ - return (vpd_read_vconn() >= PD_SNK_VA); -} - -int vpd_read_rdconnect_ref(void) -{ - return 200; /* 200 mV */ -} - -void vpd_red_led(int on) -{ - mock_red_led = on ? 0 : 1; -} - -void vpd_green_led(int on) -{ - mock_green_led = on ? 0 : 1; -} - -void vpd_vbus_pass_en(int en) -{ - mock_vbus_pass_en = en ? 1 : 0; -} - -void vpd_present_billboard(enum vpd_billboard bb) -{ - mock_present_billboard = bb; -} - -void vpd_mcu_cc_en(int en) -{ - mock_mcu_cc_en = en ? 1 : 0; -} - -void vpd_ct_cc_sel(enum vpd_cc sel) -{ - mock_ct_cl_sel = sel; -} - -/* Set as GPO High, GPO Low, or High-Z */ -void vpd_cc_db_en_od(enum vpd_gpo val) -{ - mock_cc_db_en_od = val; -} - -void vpd_cc_rpusb_odh(enum vpd_gpo val) -{ - mock_cc_rpusb_odh = val; -} - -void vpd_cc1_cc2_db_en_l(enum vpd_gpo val) -{ - mock_cc1_cc2_rd_l = val; -} - -void vpd_vconn_pwr_sel_odl(enum vpd_pwr en) -{ - mock_vconn_pwr_sel_odl = en; -} diff --git a/test/vpd_api.h b/test/vpd_api.h deleted file mode 100644 index f848138172..0000000000 --- a/test/vpd_api.h +++ /dev/null @@ -1,332 +0,0 @@ -/* Copyright 2019 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. - */ - -/* Vconn Power Device API module */ - -#ifndef __CROS_EC_VPD_API_H -#define __CROS_EC_VPD_API_H - -#include "gpio.h" -#include "usb_pd.h" - -/* - * Type C power source charge current limits are identified by their cc - * voltage (set by selecting the proper Rd resistor). Any voltage below - * TYPE_C_SRC_DEFAULT_THRESHOLD will not be identified as a type C charger. - */ -#define TYPE_C_SRC_DEFAULT_THRESHOLD 200 /* mV */ -#define TYPE_C_SRC_1500_THRESHOLD 660 /* mV */ -#define TYPE_C_SRC_3000_THRESHOLD 1230 /* mV */ - - -enum vpd_pin { - PIN_ADC, - PIN_CMP, - PIN_GPO -}; - -enum vpd_gpo { - GPO_HZ, - GPO_HIGH, - GPO_LOW -}; - -enum vpd_pwr { - PWR_VCONN, - PWR_VBUS, -}; - -enum vpd_cc { - CT_OPEN, - CT_CC1, - CT_CC2 -}; - -enum vpd_billboard { - BB_NONE, - BB_SRC, - BB_SNK -}; - -struct mock_pin { - enum vpd_pin cfg; - int value; - int value2; -}; - -enum vpd_pwr mock_get_vconn_pwr_source(void); -enum vpd_gpo mock_get_ct_rd(void); -enum vpd_gpo mock_get_cc_rp1a5_odh(void); -enum vpd_gpo mock_get_cc_rpusb_odh(void); -enum vpd_gpo mock_get_cc_db_en_od(void); -enum vpd_cc moch_get_ct_cl_sel(void); -int mock_get_mcu_cc_en(void); -enum vpd_billboard mock_get_present_billboard(void); -int mock_get_red_led(void); -int mock_get_green_led(void); -int mock_get_vbus_pass_en(void); -int mock_set_cc_vpdmcu(int v); -void mock_set_host_vbus(int v); -void mock_set_ct_vbus(int v); -void mock_set_vconn(int v); -int mock_get_cfg_cc2_rpusb_odh(void); -int mock_set_cc2_rpusb_odh(int v); -int mock_get_cfg_cc2_rp3a0_rd_l(void); -int mock_set_cc2_rp3a0_rd_l(int v); -int mock_get_cfg_cc1_rpusb_odh(void); -int mock_set_cc1_rpusb_odh(int v); -int mock_get_cfg_cc_vpdmcu(void); -int mock_get_cc_vpdmcu(int v); -enum vpd_pin mock_get_cfg_cc_rp3a0_rd_l(void); -int mock_get_cc_rp3a0_rd_l(void); -int mock_get_cfg_cc1_rp3a0_rd_l(void); -int mock_set_cc1_rp3a0_rd_l(int v); -void mock_set_host_cc_sink_voltage(int v); -void mock_set_host_cc_source_voltage(int v); -int mock_get_ct_cc1_rpusb(void); -int mock_get_ct_cc2_rpusb(void); - -/** - * Set Charge-Through Rp or Rd on CC lines - * - * @param pull Either TYPEC_CC_RP or TYPEC_CC_RD - * @param rp_value When pull is RP, set this to - * TYPEC_RP_USB or TYPEC_RP_1A5. Ignored - * for TYPEC_CC_RD - */ -void vpd_ct_set_pull(int pull, int rp_value); - -/** - * Get the status of the Charge-Through CC lines - * - * @param cc1 Either TYPEC_CC_VOLT_OPEN, - * TYPEC_CC_VOLT_RA, - * TYPEC_CC_VOLT_RD, - * any other value is considered RP - * @param cc2 Either TYPEC_CC_VOLT_OPEN, - * TYPEC_CC_VOLT_RA, - * TYPEC_CC_VOLT_RD, - * any other value is considered RP - */ -void vpd_ct_get_cc(int *cc1, int *cc2); - -/** - * Set Host Rp or Rd on CC lines - * - * @param pull Either TYPEC_CC_RP or TYPEC_CC_RD - * @param rp_value When pull is RP, set this to - * TYPEC_RP_USB or TYPEC_RP_1A5. Ignored - * for TYPEC_CC_RD - */ -void vpd_host_set_pull(int pull, int rp_value); - -/** - * Get the status of the Host CC line - * - * @param cc Either TYPEC_CC_VOLT_SNK_DEF, TYPEC_CC_VOLT_SNK_1_5, - * TYPEC_CC_VOLT_SNK_3_0, or TYPEC_CC_RD - */ -void vpd_host_get_cc(int *cc); - -/** - * Set RX Enable flag - * - * @param en 1 for enable, 0 for disable - */ -void vpd_rx_enable(int en); - -/** - * Configure the cc_vpdmcu pin as ADC, CMP, or GPO - * - * @param cfg PIN_ADC, PIN_CMP, or PIN_GPO - * @param en When cfg is PIN_GPO, 1 sets pin high - * and 0 sets pin low. Else ignored - */ -void vpd_config_cc_vpdmcu(enum vpd_pin cfg, int en); - -/** - * Configure the cc_rp3a0_rd_l pin as ADC, CMP, or GPO - * - * @param cfg PIN_ADC, PIN_CMP, or PIN_GPO - * @param en When cfg is PIN_GPO, 1 sets pin high - * and 0 sets pin low. Else ignored - */ -void vpd_config_cc_rp3a0_rd_l(enum vpd_pin cfg, int en); - -/** - * Configure the cc1_rp3a0_rd_l pin as ADC, CMP, or GPO - * - * @param cfg PIN_ADC, PIN_CMP, or PIN_GPO - * @param en When cfg is PIN_GPO, 1 sets pin high - * and 0 sets pin low. Else ignored - */ -void vpd_config_cc1_rp3a0_rd_l(enum vpd_pin cfg, int en); - -/** - * Configure the cc2_rp3a0_rd_l pin as ADC, CMP, or GPO - * - * @param cfg PIN_ADC, PIN_CMP, or PIN_GPO - * @param en When cfg is PIN_GPO, 1 sets pin high - * and 0 sets pin low. Else ignored - */ -void vpd_config_cc2_rp3a0_rd_l(enum vpd_pin cfg, int en); - -/** - * Configure the cc1_rpusb_odh pin as ADC, CMP, or GPO - * - * @param cfg PIN_ADC, PIN_CMP, or PIN_GPO - * @param en When cfg is PIN_GPO, 1 sets pin high - * and 0 sets pin low. Else ignored - */ -void vpd_config_cc1_rpusb_odh(enum vpd_pin cfg, int en); - -/** - * Configure the cc2_rpusb_odh pin as ADC, CMP, or GPO - * - * @param cfg PIN_ADC, PIN_CMP, or PIN_GPO - * @param en When cfg is PIN_GPO, 1 sets pin high - * and 0 sets pin low. Else ignored - */ -void vpd_config_cc2_rpusb_odh(enum vpd_pin cfg, int en); - -/** - * Configure the cc_db_en_od pin to High-Impedance, low, or high - * - * @param val GPO_HZ, GPO_HIGH, GPO_LOW - */ -void vpd_cc_db_en_od(enum vpd_gpo val); - -/** - * Configure the cc_rpusb_odh pin to High-Impedance, low, or high - * - * @param val GPO_HZ, GPO_HIGH, GPO_LOW - */ -void vpd_cc_rpusb_odh(enum vpd_gpo val); - -/** - * Configure the cc_rp1a5_odh pin to High-Impedance, low, or high - * - * @param val GPO_HZ, GPO_HIGH, GPO_LOW - */ -void vpd_cc_rp1a5_odh(enum vpd_gpo val); - -/** - * Configure the cc1_cc2_db_en_l pin to High-Impedance, low, or high - * - * @param val GPO_HZ, GPO_HIGH, GPO_LOW - */ -void vpd_cc1_cc2_db_en_l(enum vpd_gpo val); - -/** - * Get status of host vbus - * - * @return 1 if host vbus is present, else 0 - */ -int vpd_is_host_vbus_present(void); - -/** - * Get status of charge-through vbus - * - * @return 1 if charge-through vbus is present, else 0 - */ -int vpd_is_ct_vbus_present(void); - -/** - * Get status of vconn - * - * @return 1 if vconn is present, else 0 - */ -int vpd_is_vconn_present(void); - -/** - * Read Host VBUS voltage. Range from 22000mV to 3000mV - * - * @return vbus voltage - */ -int vpd_read_host_vbus(void); - -/** - * Read Host CC voltage. - * - * @return cc voltage - */ -int vpd_read_cc_host(void); - -/** - * Read voltage on cc_vpdmcu pin - * - * @return cc_vpdmcu voltage - */ -int vpd_read_cc_vpdmcu(void); - -/** - * Read charge-through VBUS voltage. Range from 22000mV to 3000mV - * - * @return charge-through vbus voltage - */ -int vpd_read_ct_vbus(void); - -/** - * Read VCONN Voltage. Range from 5500mV to 3000mV - * - * @return vconn voltage - */ -int vpd_read_vconn(void); - -/** - * Turn ON/OFF Red LED. Should be off when performing power - * measurements. - * - * @param on 0 turns LED off, any other value turns it ON - */ -void vpd_red_led(int on); - -/** - * Turn ON/OFF Green LED. Should be off when performing power - * measurements. - * - * @param on 0 turns LED off, any other value turns it ON - */ -void vpd_green_led(int on); - -/** - * Connects/Disconnects the Host VBUS to the Charge-Through VBUS. - * - * @param en 0 disconnectes the VBUS, any other value connects VBUS. - */ -void vpd_vbus_pass_en(int en); - -/** - * Preset Billboard device - * - * @param bb BB_NONE no billboard presented, - * BB_SRC source connected but not in charge-through - * BB_SNK sink connected - */ -void vpd_present_billboard(enum vpd_billboard bb); - -/** - * Enables the MCU to host cc communication - * - * @param en 1 enabled, 0 disabled - */ -void vpd_mcu_cc_en(int en); - -/** - * Selects which supply to power the VPD from - * - * @param en PWR_VCONN or PWR_VBUS - */ -void vpd_vconn_pwr_sel_odl(enum vpd_pwr en); - -/** - * Controls if the Charge-Through's CC1, CC2, or neither is - * connected to Host CC - * - * @param sel CT_OPEN neither, CT_CC1 cc1, CT_CC2 cc2 - */ -void vpd_ct_cc_sel(enum vpd_cc sel); - -#endif /* __CROS_EC_VPD_API_H */ diff --git a/test/x25519.c b/test/x25519.c deleted file mode 120000 index 75aefa9842..0000000000 --- a/test/x25519.c +++ /dev/null @@ -1 +0,0 @@ -../third_party/boringssl/test/x25519.c
\ No newline at end of file diff --git a/test/x25519.tasklist b/test/x25519.tasklist deleted file mode 100644 index 80072bb620..0000000000 --- a/test/x25519.tasklist +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2017 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TEST_TASK_LIST |