2015-03-03 05:59:04 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the Black Magic Debug project.
|
|
|
|
*
|
2016-06-08 22:55:42 +00:00
|
|
|
* Copyright (C) 2016 Black Sphere Technologies Ltd.
|
|
|
|
* Written by Gareth McMullin <gareth@blacksphere.co.nz>
|
2015-03-03 05:59:04 +00:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2016-06-08 22:55:42 +00:00
|
|
|
#include "general.h"
|
2015-03-03 05:59:04 +00:00
|
|
|
|
2016-06-08 22:55:42 +00:00
|
|
|
void platform_timeout_set(platform_timeout *t, uint32_t ms)
|
|
|
|
{
|
2021-07-25 21:48:35 +00:00
|
|
|
if (ms <= SYSTICKMS)
|
|
|
|
ms = SYSTICKMS;
|
2016-06-08 22:55:42 +00:00
|
|
|
t->time = platform_time_ms() + ms;
|
|
|
|
}
|
2015-03-03 05:59:04 +00:00
|
|
|
|
2016-06-08 22:55:42 +00:00
|
|
|
bool platform_timeout_is_expired(platform_timeout *t)
|
|
|
|
{
|
2021-07-25 21:48:35 +00:00
|
|
|
return platform_time_ms() > t->time;
|
2016-06-08 22:55:42 +00:00
|
|
|
}
|