diff options
| author | hathach <[email protected]> | 2018-03-28 13:38:17 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-03-28 13:38:17 +0700 |
| commit | 604275341ecbb830e852a3522d7957ad66828dee (patch) | |
| tree | 7593a52cb324df454d84b180cfcc76212707c4c6 | |
| parent | 03582f74b8ac7fd83c9bb695777713f781e8f1a1 (diff) | |
repo cleanup
| -rw-r--r-- | tinyusb/class/hid/hid_host.c | 6 | ||||
| -rw-r--r-- | tinyusb/class/msc/msc_device.c | 2 | ||||
| -rw-r--r-- | tinyusb/common/assertion.h | 32 | ||||
| -rw-r--r-- | tinyusb/common/binary.h | 2 | ||||
| -rw-r--r-- | tinyusb/common/compiler/tusb_compiler_gcc.h (renamed from tinyusb/common/compiler/compiler_gcc.h) | 0 | ||||
| -rw-r--r-- | tinyusb/common/compiler/tusb_compiler_iar.h (renamed from tinyusb/common/compiler/compiler_iar.h) | 0 | ||||
| -rw-r--r-- | tinyusb/common/timeout_timer.h | 2 | ||||
| -rw-r--r-- | tinyusb/common/tusb_common.h | 2 | ||||
| -rw-r--r-- | tinyusb/common/tusb_compiler.h (renamed from tinyusb/common/compiler/tusb_compiler.h) | 4 | ||||
| -rw-r--r-- | tinyusb/common/tusb_types.h | 2 | ||||
| -rw-r--r-- | tinyusb/common/verify.h | 4 |
11 files changed, 14 insertions, 42 deletions
diff --git a/tinyusb/class/hid/hid_host.c b/tinyusb/class/hid/hid_host.c index 3c32d120a..0d57a5577 100644 --- a/tinyusb/class/hid/hid_host.c +++ b/tinyusb/class/hid/hid_host.c @@ -76,9 +76,9 @@ tusb_error_t hidh_interface_get_report(uint8_t dev_addr, void * report, hidh_int {
//------------- parameters validation -------------//
// TODO change to use is configured function
- ASSERT_INT (TUSB_DEVICE_STATE_CONFIGURED, tuh_device_get_state(dev_addr), TUSB_ERROR_DEVICE_NOT_READY);
- ASSERT_PTR (report, TUSB_ERROR_INVALID_PARA);
- ASSERT_FALSE(hcd_pipe_is_busy(p_hid->pipe_hdl), TUSB_ERROR_INTERFACE_IS_BUSY);
+ ASSERT_INT (TUSB_DEVICE_STATE_CONFIGURED, tuh_device_get_state(dev_addr), TUSB_ERROR_DEVICE_NOT_READY);
+ ASSERT_PTR (report, TUSB_ERROR_INVALID_PARA);
+ TU_ASSSERT (!hcd_pipe_is_busy(p_hid->pipe_hdl), TUSB_ERROR_INTERFACE_IS_BUSY);
ASSERT_STATUS( hcd_pipe_xfer(p_hid->pipe_hdl, report, p_hid->report_size, true) ) ;
diff --git a/tinyusb/class/msc/msc_device.c b/tinyusb/class/msc/msc_device.c index d01d39f55..cb1921090 100644 --- a/tinyusb/class/msc/msc_device.c +++ b/tinyusb/class/msc/msc_device.c @@ -203,7 +203,7 @@ tusb_error_t mscd_xfer_cb(uint8_t rhport, uint8_t ep_addr, tusb_event_t event, u void const *p_buffer = NULL;
// TODO SCSI data out transfer is not yet supported
- ASSERT_FALSE( p_cbw->xfer_bytes > 0 && !BIT_TEST_(p_cbw->dir, 7), TUSB_ERROR_NOT_SUPPORTED_YET);
+ TU_ASSERT( !(p_cbw->xfer_bytes > 0 && !BIT_TEST_(p_cbw->dir, 7)), TUSB_ERROR_NOT_SUPPORTED_YET);
p_csw->status = tud_msc_scsi_cb(rhport, p_cbw->lun, p_cbw->command, &p_buffer, &p_msc->data_len);
diff --git a/tinyusb/common/assertion.h b/tinyusb/common/assertion.h index edb3f69f7..edc1a2c45 100644 --- a/tinyusb/common/assertion.h +++ b/tinyusb/common/assertion.h @@ -49,10 +49,10 @@ extern "C" {
#endif
-#include "tusb_option.h"
#include <stdbool.h>
#include <stdint.h>
-#include "compiler/tusb_compiler.h"
+#include "tusb_option.h"
+#include "tusb_compiler.h"
#include "tusb_hal.h" // TODO find a way to break hal dependency
@@ -108,9 +108,7 @@ extern "C" //--------------------------------------------------------------------+
#define ASSERT(...) ASSERT_TRUE(__VA_ARGS__)
#define ASSERT_TRUE(condition , error) ASSERT_DEFINE( , (condition), error, "%s", "evaluated to false")
-#define ASSERT_FALSE(condition , error) ASSERT_DEFINE( ,!(condition), error, "%s", "evaluated to true")
#define ASSERT_FAILED(error) ASSERT_DEFINE( , false, error, "%s", "FAILED")
-#define ASSERT_FAILED_MSG(error, msg) ASSERT_DEFINE( , false, error, "FAILED: %s", msg)
//--------------------------------------------------------------------+
// Pointer Assert
@@ -150,32 +148,6 @@ extern "C" #define ASSERT_HEX_EQUAL(...) ASSERT_XXX_EQUAL("0x%x", __VA_ARGS__)
#define ASSERT_HEX_WITHIN(...) ASSERT_XXX_WITHIN("0x%x", __VA_ARGS__)
-//--------------------------------------------------------------------+
-// Bin Assert
-//--------------------------------------------------------------------+
-#define BIN8_PRINTF_PATTERN "%d%d%d%d%d%d%d%d"
-#define BIN8_PRINTF_CONVERT(byte) \
- ((byte) & 0x80 ? 1 : 0), \
- ((byte) & 0x40 ? 1 : 0), \
- ((byte) & 0x20 ? 1 : 0), \
- ((byte) & 0x10 ? 1 : 0), \
- ((byte) & 0x08 ? 1 : 0), \
- ((byte) & 0x04 ? 1 : 0), \
- ((byte) & 0x02 ? 1 : 0), \
- ((byte) & 0x01 ? 1 : 0)
-
-#define ASSERT_BIN8(...) ASSERT_BIN8_EQUAL(__VA_ARGS__)
-#define ASSERT_BIN8_EQUAL(expected, actual, error)\
- ASSERT_DEFINE(\
- uint8_t exp = (expected); uint8_t act = (actual),\
- exp==act,\
- error,\
- "expected " BIN8_PRINTF_PATTERN ", actual " BIN8_PRINTF_PATTERN, BIN8_PRINTF_CONVERT(exp), BIN8_PRINTF_CONVERT(act) )
-
-//--------------------------------------------------------------------+
-// TODO Bit Assert
-//--------------------------------------------------------------------+
-
#ifdef __cplusplus
}
diff --git a/tinyusb/common/binary.h b/tinyusb/common/binary.h index 4f2c81786..3ab87e3f8 100644 --- a/tinyusb/common/binary.h +++ b/tinyusb/common/binary.h @@ -49,7 +49,7 @@ #include <stdbool.h>
#include <stdint.h>
-#include "compiler/tusb_compiler.h"
+#include "tusb_compiler.h"
//------------- Bit manipulation -------------//
#define BIT_(n) (1U << (n)) ///< n-th Bit
diff --git a/tinyusb/common/compiler/compiler_gcc.h b/tinyusb/common/compiler/tusb_compiler_gcc.h index c9f716d48..c9f716d48 100644 --- a/tinyusb/common/compiler/compiler_gcc.h +++ b/tinyusb/common/compiler/tusb_compiler_gcc.h diff --git a/tinyusb/common/compiler/compiler_iar.h b/tinyusb/common/compiler/tusb_compiler_iar.h index 1703ea45f..1703ea45f 100644 --- a/tinyusb/common/compiler/compiler_iar.h +++ b/tinyusb/common/compiler/tusb_compiler_iar.h diff --git a/tinyusb/common/timeout_timer.h b/tinyusb/common/timeout_timer.h index d8dcc87ed..2de71ded3 100644 --- a/tinyusb/common/timeout_timer.h +++ b/tinyusb/common/timeout_timer.h @@ -44,7 +44,7 @@ #ifndef _TUSB_TIMEOUT_TTIMER_H_
#define _TUSB_TIMEOUT_TTIMER_H_
-#include "compiler/tusb_compiler.h"
+#include "tusb_compiler.h"
#ifdef __cplusplus
extern "C" {
diff --git a/tinyusb/common/tusb_common.h b/tinyusb/common/tusb_common.h index 0b39621ea..15b36ab52 100644 --- a/tinyusb/common/tusb_common.h +++ b/tinyusb/common/tusb_common.h @@ -62,7 +62,7 @@ #include "tusb_option.h"
//------------- General Header -------------//
-#include "compiler/tusb_compiler.h"
+#include "tusb_compiler.h"
#include "assertion.h"
#include "verify.h"
#include "binary.h"
diff --git a/tinyusb/common/compiler/tusb_compiler.h b/tinyusb/common/tusb_compiler.h index 40cd5ea66..7a686079e 100644 --- a/tinyusb/common/compiler/tusb_compiler.h +++ b/tinyusb/common/tusb_compiler.h @@ -73,9 +73,9 @@ #if defined(__GNUC__)
- #include "compiler_gcc.h"
+ #include "compiler/tusb_compiler_gcc.h"
#elif defined __ICCARM__
- #include "compiler_iar.h"
+ #include "compiler/tusb_compiler_iar.h"
#endif
#endif /* _TUSB_COMPILER_H_ */
diff --git a/tinyusb/common/tusb_types.h b/tinyusb/common/tusb_types.h index a74b5876b..6c61699b1 100644 --- a/tinyusb/common/tusb_types.h +++ b/tinyusb/common/tusb_types.h @@ -43,9 +43,9 @@ #ifndef _TUSB_TYPES_H_
#define _TUSB_TYPES_H_
-#include "compiler/tusb_compiler.h"
#include <stdbool.h>
#include <stdint.h>
+#include "tusb_compiler.h"
#ifdef __cplusplus
extern "C" {
diff --git a/tinyusb/common/verify.h b/tinyusb/common/verify.h index 7d71c255f..efea73815 100644 --- a/tinyusb/common/verify.h +++ b/tinyusb/common/verify.h @@ -36,10 +36,10 @@ #ifndef VERIFY_H_ #define VERIFY_H_ -#include "tusb_option.h" #include <stdbool.h> #include <stdint.h> -#include "compiler/tusb_compiler.h" +#include "tusb_option.h" +#include "tusb_compiler.h" #ifdef __cplusplus extern "C" { |
