From 18f248b142a477b2134d23a2902d8d7de6e4c195 Mon Sep 17 00:00:00 2001 From: hathach Date: Sun, 24 Mar 2019 01:19:32 +0700 Subject: remove tusb_hal_millis() usage, less work for porting --- src/common/tusb_timeout.h | 4 +++ src/osal/osal.c | 48 ----------------------------- src/osal/osal.h | 2 -- src/osal/osal_none.h | 9 +++--- src/portable/nordic/nrf5x/hal_nrf5x.c | 2 -- src/portable/nxp/lpc18_43/dcd_lpc18_43.c | 2 -- src/tusb.h | 1 - src/tusb_hal.h | 52 -------------------------------- 8 files changed, 9 insertions(+), 111 deletions(-) delete mode 100644 src/osal/osal.c delete mode 100644 src/tusb_hal.h (limited to 'src') diff --git a/src/common/tusb_timeout.h b/src/common/tusb_timeout.h index bdade6b42..83a4dac63 100644 --- a/src/common/tusb_timeout.h +++ b/src/common/tusb_timeout.h @@ -43,6 +43,8 @@ typedef struct { uint32_t interval; }tu_timeout_t; +#if 0 + extern uint32_t tusb_hal_millis(void); static inline void tu_timeout_set(tu_timeout_t* tt, uint32_t msec) @@ -67,6 +69,8 @@ static inline void tu_timeout_restart(tu_timeout_t* tt) tt->start = tusb_hal_millis(); } +#endif + #ifdef __cplusplus } #endif diff --git a/src/osal/osal.c b/src/osal/osal.c deleted file mode 100644 index b1ffa3942..000000000 --- a/src/osal/osal.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2018, hathach (tinyusb.org) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * This file is part of the TinyUSB stack. - */ - -#include "tusb_option.h" -#include "osal.h" - -//--------------------------------------------------------------------+ -// TICK API -//--------------------------------------------------------------------+ -#if CFG_TUSB_OS == OPT_OS_FREERTOS - -uint32_t tusb_hal_millis(void) -{ - return ( ( ((uint64_t) xTaskGetTickCount()) * 1000) / configTICK_RATE_HZ ); -} - -#elif CFG_TUSB_OS == OPT_OS_MYNEWT - -uint32_t tusb_hal_millis(void) -{ - return os_time_ticks_to_ms32( os_time_get() ); -} - -#endif - diff --git a/src/osal/osal.h b/src/osal/osal.h index 413189b4e..7ceb22125 100644 --- a/src/osal/osal.h +++ b/src/osal/osal.h @@ -52,8 +52,6 @@ typedef void (*osal_task_func_t)( void * ); #include "osal_none.h" #else /* RTOS Porting API - * - * uint32_t tusb_hal_millis(void) * * Task * void osal_task_delay(uint32_t msec) diff --git a/src/osal/osal_none.h b/src/osal/osal_none.h index 17a802ed8..6144f3e5c 100644 --- a/src/osal/osal_none.h +++ b/src/osal/osal_none.h @@ -27,8 +27,6 @@ #ifndef _TUSB_OSAL_NONE_H_ #define _TUSB_OSAL_NONE_H_ -#include "tusb_hal.h" - #ifdef __cplusplus extern "C" { #endif @@ -38,8 +36,11 @@ //--------------------------------------------------------------------+ static inline void osal_task_delay(uint32_t msec) { - uint32_t start = tusb_hal_millis(); - while ( ( tusb_hal_millis() - start ) < msec ) {} + (void) msec; + // TODO only used by Host stack, will implement using SOF + +// uint32_t start = tusb_hal_millis(); +// while ( ( tusb_hal_millis() - start ) < msec ) {} } //--------------------------------------------------------------------+ diff --git a/src/portable/nordic/nrf5x/hal_nrf5x.c b/src/portable/nordic/nrf5x/hal_nrf5x.c index 1d149eb8c..8477a56cd 100644 --- a/src/portable/nordic/nrf5x/hal_nrf5x.c +++ b/src/portable/nordic/nrf5x/hal_nrf5x.c @@ -40,8 +40,6 @@ #endif #include "nrfx_power.h" - -#include "tusb_hal.h" #include "device/dcd.h" /*------------------------------------------------------------------*/ diff --git a/src/portable/nxp/lpc18_43/dcd_lpc18_43.c b/src/portable/nxp/lpc18_43/dcd_lpc18_43.c index ec3ac188b..df82f70b9 100644 --- a/src/portable/nxp/lpc18_43/dcd_lpc18_43.c +++ b/src/portable/nxp/lpc18_43/dcd_lpc18_43.c @@ -32,8 +32,6 @@ // INCLUDE //--------------------------------------------------------------------+ #include "common/tusb_common.h" -#include "tusb_hal.h" - #include "device/dcd.h" #include "dcd_lpc18_43.h" diff --git a/src/tusb.h b/src/tusb.h index c6d572436..122851b45 100644 --- a/src/tusb.h +++ b/src/tusb.h @@ -35,7 +35,6 @@ // INCLUDE //--------------------------------------------------------------------+ #include "common/tusb_common.h" -#include "tusb_hal.h" #include "osal/osal.h" #include "common/tusb_fifo.h" diff --git a/src/tusb_hal.h b/src/tusb_hal.h deleted file mode 100644 index 2dcafa77f..000000000 --- a/src/tusb_hal.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2018, hathach (tinyusb.org) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * This file is part of the TinyUSB stack. - */ - -#ifndef _TUSB_HAL_H_ -#define _TUSB_HAL_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -//--------------------------------------------------------------------+ -// INCLUDES -//--------------------------------------------------------------------+ -#include "common/tusb_common.h" - -//--------------------------------------------------------------------+ -// HAL API -//--------------------------------------------------------------------+ - -// Only required to implement if using No RTOS (osal_none) -// TODO could be remove -uint32_t tusb_hal_millis(void); - -#ifdef __cplusplus - } -#endif - -#endif /* _TUSB_HAL_H_ */ - -- cgit v1.3.1