mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-06 15:01:35 +00:00
BRANCH=None BUG=None TEST=Manual - Connect handshake and gpio test lines between th and dut - Build tests - run 'cat /dev/ttyACM0' in one terminal - run 'cat /def/ttyACM1' in another - Flash boards - All test results print their test name followed by a space and and integer error code Change-Id: If52e9b50705779b3a291e2d0f6b0721a5b6197d8 Reviewed-on: https://chromium-review.googlesource.com/359988 Commit-Ready: Chris Chen <twothreecc@google.com> Tested-by: Chris Chen <twothreecc@google.com> Reviewed-by: Randall Spangler <rspangler@chromium.org>
37 lines
910 B
C
37 lines
910 B
C
/* 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 "gpio.h"
|
|
#include "timer.h"
|
|
#include "watchdog.h"
|
|
#include "cts_common.h"
|
|
#include "th_common.h"
|
|
|
|
/* Return SUCCESS if and only if we reach end of function
|
|
* Returning success here means sync was successful
|
|
*/
|
|
enum cts_rc sync(void)
|
|
{
|
|
int input_level;
|
|
|
|
gpio_set_level(GPIO_HANDSHAKE_OUTPUT, 0);
|
|
do {
|
|
watchdog_reload();
|
|
input_level = gpio_get_level(GPIO_HANDSHAKE_INPUT);
|
|
} while (input_level);
|
|
gpio_set_level(GPIO_HANDSHAKE_OUTPUT, 1);
|
|
do {
|
|
watchdog_reload();
|
|
input_level = gpio_get_level(GPIO_HANDSHAKE_INPUT);
|
|
} while (!input_level);
|
|
gpio_set_level(GPIO_HANDSHAKE_OUTPUT, 0);
|
|
do {
|
|
watchdog_reload();
|
|
input_level = gpio_get_level(GPIO_HANDSHAKE_INPUT);
|
|
} while (input_level);
|
|
|
|
return CTS_RC_SUCCESS;
|
|
}
|